Class DefaultPreFlightRequestHandler
java.lang.Object
org.springframework.web.servlet.handler.DefaultPreFlightRequestHandler
- All Implemented Interfaces:
Aware, InitializingBean, ApplicationContextAware, PreFlightRequestHandler
public class DefaultPreFlightRequestHandler
extends Object
implements PreFlightRequestHandler, ApplicationContextAware, 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 TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.Return 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(ApplicationContext applicationContext) Set the ApplicationContext that this object runs in.
-
Constructor Details
-
DefaultPreFlightRequestHandler
public DefaultPreFlightRequestHandler()
-
-
Method Details
-
setApplicationContext
Description copied from interface:ApplicationContextAwareSet the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as
InitializingBean.afterPropertiesSet()or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(ResourceLoader),ApplicationEventPublisherAware.setApplicationEventPublisher(ApplicationEventPublisher)andMessageSourceAware, if applicable.- Specified by:
setApplicationContextin interfaceApplicationContextAware- Parameters:
applicationContext- the ApplicationContext object to be used by this object- See Also:
-
getHandlerMappings
Return the configured or detectedHandlerMappings. -
afterPropertiesSet
public void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
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 interfacePreFlightRequestHandler- Parameters:
request- current HTTP requestresponse- current HTTP response- Throws:
NoHandlerFoundException- if no handler matches the requestException
-