Package org.codelibs.fess.cors
Class DefaultCorsHandler
java.lang.Object
org.codelibs.fess.cors.CorsHandler
org.codelibs.fess.cors.DefaultCorsHandler
Default implementation of CORS (Cross-Origin Resource Sharing) handler.
This handler automatically registers itself for origins configured in the system
and applies standard CORS headers based on the application configuration.
-
Field Summary
Fields inherited from class org.codelibs.fess.cors.CorsHandler
ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_ALLOW_PRIVATE_NETWORK, ACCESS_CONTROL_MAX_AGE, ALLOW_ORIGIN_ALL, ORIGIN, VARY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprocess(String origin, CorsMatchType matchType, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Processes the CORS request by setting standard CORS headers on the response.voidregister()Registers this CORS handler with the factory for configured allowed origins.
-
Constructor Details
-
DefaultCorsHandler
public DefaultCorsHandler()Creates a new instance of DefaultCorsHandler. This constructor initializes the default CORS handler for applying standard CORS headers based on application configuration.
-
-
Method Details
-
register
@PostConstruct public void register()Registers this CORS handler with the factory for configured allowed origins. This method is automatically called after bean initialization. -
process
public void process(String origin, CorsMatchType matchType, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Processes the CORS request by setting standard CORS headers on the response. For an EXACT origin match the request Origin is reflected and credentials may be sent; for a WILDCARD match a literal "*" is returned and credentials are never sent.- Specified by:
processin classCorsHandler- Parameters:
origin- the origin of the requestmatchType- how the origin matched the allow listrequest- the servlet requestresponse- the servlet response to add CORS headers to
-