类 HttpWebHandlerAdapter
- java.lang.Object
- org.springframework.web.server.handler.WebHandlerDecorator
- org.springframework.web.server.adapter.HttpWebHandlerAdapter
- 所有已实现的接口:
HttpHandler
,WebHandler
public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHandler
Default adapter ofWebHandler
to theHttpHandler
contract.By default creates and configures a
DefaultServerWebExchange
and then invokes the targetWebHandler
.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev, Sebastien Deleuze
构造器概要
构造器 构造器 说明 HttpWebHandlerAdapter(WebHandler delegate)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
This method must be invoked after all properties have been set to complete initialization.protected ServerWebExchange
createExchange(ServerHttpRequest request, ServerHttpResponse response)
protected String
formatRequest(ServerHttpRequest request)
Format the request for logging purposes including HTTP method and URL.ApplicationContext
getApplicationContext()
Return the configuredApplicationContext
, if any.ServerCodecConfigurer
getCodecConfigurer()
Return the configuredServerCodecConfigurer
.ForwardedHeaderTransformer
getForwardedHeaderTransformer()
Return the configuredForwardedHeaderTransformer
.LocaleContextResolver
getLocaleContextResolver()
Return the configuredLocaleContextResolver
.WebSessionManager
getSessionManager()
Return the configuredWebSessionManager
.reactor.core.publisher.Mono<Void>
handle(ServerHttpRequest request, ServerHttpResponse response)
Handle the given request and write to the response.void
setApplicationContext(ApplicationContext applicationContext)
Configure theApplicationContext
associated with the web application, if it was initialized with one viaWebHttpHandlerBuilder.applicationContext(ApplicationContext)
.void
setCodecConfigurer(ServerCodecConfigurer codecConfigurer)
Configure a customServerCodecConfigurer
.void
setForwardedHeaderTransformer(ForwardedHeaderTransformer transformer)
Enable processing of forwarded headers, either extracting and removing, or remove only.void
setLocaleContextResolver(LocaleContextResolver resolver)
Configure a customLocaleContextResolver
.void
setSessionManager(WebSessionManager sessionManager)
Configure a customWebSessionManager
to use for managing web sessions.从类继承的方法 org.springframework.web.server.handler.WebHandlerDecorator
getDelegate, handle, toString
构造器详细资料
HttpWebHandlerAdapter
public HttpWebHandlerAdapter(WebHandler delegate)
方法详细资料
setSessionManager
public void setSessionManager(WebSessionManager sessionManager)
Configure a customWebSessionManager
to use for managing web sessions. The provided instance is set on each createdDefaultServerWebExchange
.By default this is set to
DefaultWebSessionManager
.- 参数:
sessionManager
- the session manager to use
getSessionManager
public WebSessionManager getSessionManager()
Return the configuredWebSessionManager
.
setCodecConfigurer
public void setCodecConfigurer(ServerCodecConfigurer codecConfigurer)
Configure a customServerCodecConfigurer
. The provided instance is set on each createdDefaultServerWebExchange
.By default this is set to
ServerCodecConfigurer.create()
.- 参数:
codecConfigurer
- the codec configurer to use
getCodecConfigurer
public ServerCodecConfigurer getCodecConfigurer()
Return the configuredServerCodecConfigurer
.
setLocaleContextResolver
public void setLocaleContextResolver(LocaleContextResolver resolver)
Configure a customLocaleContextResolver
. The provided instance is set on each createdDefaultServerWebExchange
.By default this is set to
AcceptHeaderLocaleContextResolver
.- 参数:
resolver
- the locale context resolver to use
getLocaleContextResolver
public LocaleContextResolver getLocaleContextResolver()
Return the configuredLocaleContextResolver
.
setForwardedHeaderTransformer
public void setForwardedHeaderTransformer(ForwardedHeaderTransformer transformer)
Enable processing of forwarded headers, either extracting and removing, or remove only.By default this is not set.
- 参数:
transformer
- the transformer to use- 从以下版本开始:
- 5.1
getForwardedHeaderTransformer
@Nullable public ForwardedHeaderTransformer getForwardedHeaderTransformer()
Return the configuredForwardedHeaderTransformer
.- 从以下版本开始:
- 5.1
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
Configure theApplicationContext
associated with the web application, if it was initialized with one viaWebHttpHandlerBuilder.applicationContext(ApplicationContext)
.- 参数:
applicationContext
- the context- 从以下版本开始:
- 5.0.3
getApplicationContext
@Nullable public ApplicationContext getApplicationContext()
Return the configuredApplicationContext
, if any.- 从以下版本开始:
- 5.0.3
afterPropertiesSet
public void afterPropertiesSet()
This method must be invoked after all properties have been set to complete initialization.
handle
public reactor.core.publisher.Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response)
从接口复制的说明:HttpHandler
Handle the given request and write to the response.- 指定者:
handle
在接口中HttpHandler
- 参数:
request
- current requestresponse
- current response- 返回:
- indicates completion of request handling
createExchange
protected ServerWebExchange createExchange(ServerHttpRequest request, ServerHttpResponse response)
formatRequest
protected String formatRequest(ServerHttpRequest request)
Format the request for logging purposes including HTTP method and URL.By default this prints the HTTP method, the URL path, and the query.
- 参数:
request
- the request to format- 返回:
- the String to display, never empty or
null