Package org.codelibs.fess.cors
Class CorsHandler
java.lang.Object
org.codelibs.fess.cors.CorsHandler
- Direct Known Subclasses:
DefaultCorsHandler
Abstract base class for handling CORS (Cross-Origin Resource Sharing) requests.
Provides common CORS header constants and defines the processing interface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringCORS header for allowing credentials.protected static final StringCORS header for specifying allowed headers.protected static final StringCORS header for specifying allowed HTTP methods.protected static final StringCORS header for specifying allowed origin.protected static final StringCORS header for allowing private network access.protected static final StringCORS header for specifying cache duration for preflight requests.protected static final StringLiteral value returned inAccess-Control-Allow-Originfor wildcard (non-credentialed) CORS.protected static final StringHTTPOriginheader name.protected static final StringHTTPVaryresponse header name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidprocess(String origin, CorsMatchType matchType, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Processes the CORS request by setting appropriate headers.
-
Field Details
-
ACCESS_CONTROL_ALLOW_ORIGIN
CORS header for specifying allowed origin.- See Also:
-
ACCESS_CONTROL_ALLOW_HEADERS
CORS header for specifying allowed headers.- See Also:
-
ACCESS_CONTROL_ALLOW_METHODS
CORS header for specifying allowed HTTP methods.- See Also:
-
ACCESS_CONTROL_ALLOW_PRIVATE_NETWORK
CORS header for allowing private network access.- See Also:
-
ACCESS_CONTROL_ALLOW_CREDENTIALS
CORS header for allowing credentials.- See Also:
-
ACCESS_CONTROL_MAX_AGE
CORS header for specifying cache duration for preflight requests.- See Also:
-
ALLOW_ORIGIN_ALL
Literal value returned inAccess-Control-Allow-Originfor wildcard (non-credentialed) CORS.- See Also:
-
VARY
HTTPVaryresponse header name.- See Also:
-
ORIGIN
HTTPOriginheader name. Appended toVaryfor every origin-bearing request.- See Also:
-
-
Constructor Details
-
CorsHandler
public CorsHandler()Creates a new instance of CorsHandler.
-
-
Method Details
-
process
public abstract void process(String origin, CorsMatchType matchType, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Processes the CORS request by setting appropriate headers.- Parameters:
origin- the origin of the requestmatchType- how the origin matched the allow list (EXACT reflects the origin and may send credentials; WILDCARD returns literal "*")request- the servlet requestresponse- the servlet response
-