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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturn the configured or detectedHandlerMappings.voidhandlePreFlight(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Find the matchingHandlerMappingfor the request, and invoke the handler it returns as aPreFlightRequestHandler.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Constructor Details
-
DefaultPreFlightRequestHandler
public DefaultPreFlightRequestHandler()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getHandlerMappings
Return the configured or detectedHandlerMappings. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
handlePreFlight
public void handlePreFlight(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws Exception Find the matchingHandlerMappingfor the request, and invoke the handler it returns as aPreFlightRequestHandler.- Specified by:
handlePreFlightin interfaceorg.springframework.web.cors.PreFlightRequestHandler- Throws:
NoHandlerFoundException- if no handler matches the requestException
-