Class HttpWebHandlerAdapter
java.lang.Object
org.springframework.web.server.handler.WebHandlerDecorator
org.springframework.web.server.adapter.HttpWebHandlerAdapter
- All Implemented Interfaces:
- HttpHandler,- WebHandler
Default adapter of 
WebHandler to the HttpHandler contract.
 By default creates and configures a DefaultServerWebExchange and
 then invokes the target WebHandler.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Sebastien Deleuze, Brian Clozel
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidThis method must be invoked after all properties have been set to complete initialization.protected ServerWebExchangecreateExchange(ServerHttpRequest request, ServerHttpResponse response) protected StringformatRequest(ServerHttpRequest request) Format the request for logging purposes including HTTP method and URL.Return the configuredApplicationContext, if any.Return the configuredServerCodecConfigurer.Return the configuredForwardedHeaderTransformer.Return the configuredLocaleContextResolver.Return the Observation convention configured for server exchanges observations.io.micrometer.observation.ObservationRegistryReturn the configuredObservationRegistry.Return the configuredWebSessionManager.reactor.core.publisher.Mono<Void>handle(ServerHttpRequest request, ServerHttpResponse response) Handle the given request and write to the response.voidsetApplicationContext(ApplicationContext applicationContext) Configure theApplicationContextassociated with the web application, if it was initialized with one viaWebHttpHandlerBuilder.applicationContext(ApplicationContext).voidsetCodecConfigurer(ServerCodecConfigurer codecConfigurer) Configure a customServerCodecConfigurer.voidsetForwardedHeaderTransformer(ForwardedHeaderTransformer transformer) Enable processing of forwarded headers, either extracting and removing, or remove only.voidConfigure a customLocaleContextResolver.voidsetObservationConvention(ServerRequestObservationConvention observationConvention) Configure aServerRequestObservationConventionfor server exchanges observations.voidsetObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Configure anObservationRegistryfor recording server exchange observations.voidsetSessionManager(WebSessionManager sessionManager) Configure a customWebSessionManagerto use for managing web sessions.Methods inherited from class org.springframework.web.server.handler.WebHandlerDecoratorgetDelegate, handle, toString
- 
Constructor Details- 
HttpWebHandlerAdapter
 
- 
- 
Method Details- 
setSessionManagerConfigure a customWebSessionManagerto use for managing web sessions. The provided instance is set on each createdDefaultServerWebExchange.By default this is set to DefaultWebSessionManager.- Parameters:
- sessionManager- the session manager to use
 
- 
getSessionManagerReturn the configuredWebSessionManager.
- 
setCodecConfigurerConfigure a customServerCodecConfigurer. The provided instance is set on each createdDefaultServerWebExchange.By default this is set to ServerCodecConfigurer.create().- Parameters:
- codecConfigurer- the codec configurer to use
 
- 
getCodecConfigurerReturn the configuredServerCodecConfigurer.
- 
setLocaleContextResolverConfigure a customLocaleContextResolver. The provided instance is set on each createdDefaultServerWebExchange.By default this is set to AcceptHeaderLocaleContextResolver.- Parameters:
- resolver- the locale context resolver to use
 
- 
getLocaleContextResolverReturn the configuredLocaleContextResolver.
- 
setForwardedHeaderTransformerEnable processing of forwarded headers, either extracting and removing, or remove only.By default this is not set. - Parameters:
- transformer- the transformer to use
- Since:
- 5.1
 
- 
getForwardedHeaderTransformerReturn the configuredForwardedHeaderTransformer.- Since:
- 5.1
 
- 
setObservationRegistrypublic void setObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Configure anObservationRegistryfor recording server exchange observations. By default, ano-opinstance will be used.- Parameters:
- observationRegistry- the observation registry to use
- Since:
- 6.1
 
- 
getObservationRegistrypublic io.micrometer.observation.ObservationRegistry getObservationRegistry()Return the configuredObservationRegistry.- Since:
- 6.1
 
- 
setObservationConventionConfigure aServerRequestObservationConventionfor server exchanges observations. By default, aDefaultServerRequestObservationConventioninstance will be used.- Parameters:
- observationConvention- the observation convention to use
- Since:
- 6.1
 
- 
getObservationConventionReturn the Observation convention configured for server exchanges observations.- Since:
- 6.1
 
- 
setApplicationContextConfigure theApplicationContextassociated with the web application, if it was initialized with one viaWebHttpHandlerBuilder.applicationContext(ApplicationContext).- Parameters:
- applicationContext- the context
- Since:
- 5.0.3
 
- 
getApplicationContextReturn the configuredApplicationContext, if any.- Since:
- 5.0.3
 
- 
afterPropertiesSetpublic void afterPropertiesSet()This method must be invoked after all properties have been set to complete initialization.
- 
handlepublic reactor.core.publisher.Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) Description copied from interface:HttpHandlerHandle the given request and write to the response.- Specified by:
- handlein interface- HttpHandler
- Parameters:
- request- current request
- response- current response
- Returns:
- indicates completion of request handling
 
- 
createExchange
- 
formatRequestFormat the request for logging purposes including HTTP method and URL.By default this prints the HTTP method, the URL path, and the query. - Parameters:
- request- the request to format
- Returns:
- the String to display, never empty or null
 
 
-