public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHandler
WebHandler
to the HttpHandler
contract.
By default creates and configures a DefaultServerWebExchange
and
then invokes the target WebHandler
.
Constructor and Description |
---|
HttpWebHandlerAdapter(WebHandler delegate) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
This method must be invoked after all properties have been set to
complete initialization.
|
protected ServerWebExchange |
createExchange(ServerHttpRequest request,
ServerHttpResponse response) |
ApplicationContext |
getApplicationContext()
Return the configured
ApplicationContext , if any. |
ServerCodecConfigurer |
getCodecConfigurer()
Return the configured
ServerCodecConfigurer . |
ForwardedHeaderTransformer |
getForwardedHeaderTransformer()
Return the configured
ForwardedHeaderTransformer . |
LocaleContextResolver |
getLocaleContextResolver()
Return the configured
LocaleContextResolver . |
WebSessionManager |
getSessionManager()
Return the configured
WebSessionManager . |
reactor.core.publisher.Mono<Void> |
handle(ServerHttpRequest request,
ServerHttpResponse response)
Handle the given request and write to the response.
|
void |
setApplicationContext(ApplicationContext applicationContext)
Configure the
ApplicationContext associated with the web application,
if it was initialized with one via
WebHttpHandlerBuilder.applicationContext(ApplicationContext) . |
void |
setCodecConfigurer(ServerCodecConfigurer codecConfigurer)
Configure a custom
ServerCodecConfigurer . |
void |
setForwardedHeaderTransformer(ForwardedHeaderTransformer transformer)
Enable processing of forwarded headers, either extracting and removing,
or remove only.
|
void |
setLocaleContextResolver(LocaleContextResolver resolver)
Configure a custom
LocaleContextResolver . |
void |
setSessionManager(WebSessionManager sessionManager)
Configure a custom
WebSessionManager to use for managing web
sessions. |
getDelegate, handle, toString
public HttpWebHandlerAdapter(WebHandler delegate)
public void setSessionManager(WebSessionManager sessionManager)
WebSessionManager
to use for managing web
sessions. The provided instance is set on each created
DefaultServerWebExchange
.
By default this is set to DefaultWebSessionManager
.
sessionManager
- the session manager to usepublic WebSessionManager getSessionManager()
WebSessionManager
.public void setCodecConfigurer(ServerCodecConfigurer codecConfigurer)
ServerCodecConfigurer
. The provided instance is set on
each created DefaultServerWebExchange
.
By default this is set to ServerCodecConfigurer.create()
.
codecConfigurer
- the codec configurer to usepublic ServerCodecConfigurer getCodecConfigurer()
ServerCodecConfigurer
.public void setLocaleContextResolver(LocaleContextResolver resolver)
LocaleContextResolver
. The provided instance is set on
each created DefaultServerWebExchange
.
By default this is set to
AcceptHeaderLocaleContextResolver
.
resolver
- the locale context resolver to usepublic LocaleContextResolver getLocaleContextResolver()
LocaleContextResolver
.public void setForwardedHeaderTransformer(ForwardedHeaderTransformer transformer)
By default this is not set.
transformer
- the transformer to use@Nullable public ForwardedHeaderTransformer getForwardedHeaderTransformer()
ForwardedHeaderTransformer
.public void setApplicationContext(ApplicationContext applicationContext)
ApplicationContext
associated with the web application,
if it was initialized with one via
WebHttpHandlerBuilder.applicationContext(ApplicationContext)
.applicationContext
- the context@Nullable public ApplicationContext getApplicationContext()
ApplicationContext
, if any.public void afterPropertiesSet()
public reactor.core.publisher.Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response)
HttpHandler
handle
in interface HttpHandler
request
- current requestresponse
- current responseprotected ServerWebExchange createExchange(ServerHttpRequest request, ServerHttpResponse response)