Class CorsConfiguration


  • public class CorsConfiguration
    extends Object
    • Constructor Detail

      • CorsConfiguration

        public CorsConfiguration()
    • Method Detail

      • setAllowedOrigins

        public void setAllowedOrigins​(Collection<String> allowedOrigins)
      • isSupportsCredentials

        public boolean isSupportsCredentials()
      • setSupportsCredentials

        public void setSupportsCredentials​(boolean supportsCredentials)
      • getPreflightMaxAge

        public long getPreflightMaxAge()
      • setPreflightMaxAge

        public void setPreflightMaxAge​(long preflightMaxAge)
      • isDecorateRequest

        public boolean isDecorateRequest()
      • setDecorateRequest

        public void setDecorateRequest​(boolean decorateRequest)
      • isEnabled

        public boolean isEnabled()
      • setEnabled

        public void setEnabled​(boolean enabled)
      • parseAndStore

        public void parseAndStore​(String corsEnabled,
                                  String allowedOrigins,
                                  String allowedHttpMethods,
                                  String allowedHttpHeaders,
                                  String exposedHeaders,
                                  String supportsCredentials,
                                  String preflightMaxAge,
                                  String decorateRequest)
                           throws jakarta.servlet.ServletException
        Parses each param-value and populates configuration variables. If a param is provided, it overrides the default.
        Parameters:
        corsEnabled - "true" if CORS needs to be enabled.
        allowedOrigins - A String of comma separated origins.
        allowedHttpMethods - A String of comma separated HTTP methods.
        allowedHttpHeaders - A String of comma separated HTTP headers.
        exposedHeaders - A String of comma separated headers that needs to be exposed.
        supportsCredentials - "true" if support credentials needs to be enabled.
        preflightMaxAge - The amount of seconds the user agent is allowed to cache the result of the pre-flight request.
        decorateRequest - "true" if request needs to enhanced
        Throws:
        jakarta.servlet.ServletException
      • isOriginAllowed

        public boolean isOriginAllowed​(String origin)
      • isAnyOriginAllowed

        public boolean isAnyOriginAllowed()