Class CorsHandlerFactory

java.lang.Object
org.codelibs.fess.cors.CorsHandlerFactory

public class CorsHandlerFactory extends Object
Factory for managing CORS handlers based on origin. Maintains a registry of CORS handlers for different origins and provides lookup functionality.
  • Field Details

    • handerMap

      protected Map<String,CorsHandler> handerMap
      Map of origin patterns to their corresponding CORS handlers.
  • Constructor Details

    • CorsHandlerFactory

      public CorsHandlerFactory()
      Creates a new instance of CorsHandlerFactory.
  • Method Details

    • add

      public void add(String origin, CorsHandler handler)
      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

      public CorsHandler get(String origin)
      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

      public CorsResolution resolve(String origin)
      Resolves the CORS handler and match type for the specified origin. An exact registration yields CorsMatchType.EXACT; a "*" fallback yields CorsMatchType.WILDCARD; no match yields null.
      Parameters:
      origin - the origin to look up
      Returns:
      the resolution, or null if neither an exact nor a wildcard handler is registered