Package org.codelibs.fess.cors
Class CorsHandlerFactory
java.lang.Object
org.codelibs.fess.cors.CorsHandlerFactory
Factory for managing CORS handlers based on origin.
Maintains a registry of CORS handlers for different origins and provides lookup functionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, CorsHandler> Map of origin patterns to their corresponding CORS handlers. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String origin, CorsHandler handler) Adds a CORS handler for the specified origin.Gets the CORS handler for the specified origin.Resolves the CORS handler and match type for the specified origin.
-
Field Details
-
handerMap
Map of origin patterns to their corresponding CORS handlers.
-
-
Constructor Details
-
CorsHandlerFactory
public CorsHandlerFactory()Creates a new instance of CorsHandlerFactory.
-
-
Method Details
-
add
Adds a CORS handler for the specified origin.- Parameters:
origin- the origin pattern (can be "*" for wildcard)handler- the CORS handler to associate with the origin
-
get
Gets the CORS handler for the specified origin. If no specific handler is found, returns the wildcard handler.- Parameters:
origin- the origin to look up- Returns:
- the CORS handler for the origin, or null if none found
-
resolve
Resolves the CORS handler and match type for the specified origin. An exact registration yieldsCorsMatchType.EXACT; a"*"fallback yieldsCorsMatchType.WILDCARD; no match yieldsnull.- Parameters:
origin- the origin to look up- Returns:
- the resolution, or
nullif neither an exact nor a wildcard handler is registered
-