Class DefaultPreFlightRequestHandler

java.lang.Object
org.springframework.web.servlet.handler.DefaultPreFlightRequestHandler
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.web.cors.PreFlightRequestHandler

public class DefaultPreFlightRequestHandler extends Object implements org.springframework.web.cors.PreFlightRequestHandler, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Default implementation of PreFlightRequestHandler that emulates the DispatcherServlet's algorithm for finding a matching HandlerMapping for a pre-flight request, and then invokes the matched handler as a PreFlightRequestHandler.
Since:
7.1
Author:
Rossen Stoyanchev
  • Constructor Details

    • DefaultPreFlightRequestHandler

      public DefaultPreFlightRequestHandler()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
    • getHandlerMappings

      public List<HandlerMapping> getHandlerMappings()
      Return the configured or detected HandlerMappings.
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • handlePreFlight

      public void handlePreFlight(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws Exception
      Find the matching HandlerMapping for the request, and invoke the handler it returns as a PreFlightRequestHandler.
      Specified by:
      handlePreFlight in interface org.springframework.web.cors.PreFlightRequestHandler
      Throws:
      NoHandlerFoundException - if no handler matches the request
      Exception