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 |
---|---|
protected ServerWebExchange |
createExchange(ServerHttpRequest request,
ServerHttpResponse response) |
ApplicationContext |
getApplicationContext()
Return the configured
ApplicationContext , if any. |
ServerCodecConfigurer |
getCodecConfigurer()
Return the configured
ServerCodecConfigurer . |
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 |
setLocaleContextResolver(LocaleContextResolver localeContextResolver)
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 localeContextResolver)
LocaleContextResolver
. The provided instance is set on
each created DefaultServerWebExchange
.
By default this is set to
AcceptHeaderLocaleContextResolver
.
localeContextResolver
- the locale context resolver to usepublic LocaleContextResolver getLocaleContextResolver()
LocaleContextResolver
.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 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)