接口的使用
org.springframework.http.HttpRequest
使用HttpRequest的程序包 程序包 说明 org.springframework.http.client Contains an abstraction over client-side HTTP.org.springframework.http.client.support This package provides generic HTTP support classes, to be used by higher-level classes like RestTemplate.org.springframework.http.server Contains an abstraction over server-side HTTP.org.springframework.http.server.reactive Abstractions for reactive HTTP server support including aServerHttpRequestandServerHttpResponsealong with anHttpHandlerfor processing.org.springframework.mock.http.client Mock implementations of client-side HTTP abstractions.org.springframework.mock.http.server.reactive Mock implementations of reactive HTTP server contracts.org.springframework.web.multipart.support Support classes for the multipart resolution framework.org.springframework.web.reactive.function.client Provides a reactiveWebClientthat builds on top of theorg.springframework.http.client.reactivereactive HTTP adapter layer.org.springframework.web.util Miscellaneous web utility classes, such as HTML escaping, Log4j initialization, and cookie handling.org.springframework.http.client中HttpRequest的使用
org.springframework.http.client中HttpRequest的子接口 修饰符和类型 接口 说明 interfaceAsyncClientHttpRequest已过时。as of Spring 5.0, in favor ofClientRequestinterfaceClientHttpRequestRepresents a client-side HTTP request.实现HttpRequest的org.springframework.http.client中的类 修饰符和类型 类 说明 classAbstractClientHttpRequestAbstract base forClientHttpRequestthat makes sure that headers and body are not written multiple times.参数类型为HttpRequest的org.springframework.http.client中的方法 修饰符和类型 方法 说明 ClientHttpResponseClientHttpRequestExecution. execute(HttpRequest request, byte[] body)Execute the request with the given request attributes and body, and return the response.ListenableFuture<ClientHttpResponse>AsyncClientHttpRequestExecution. executeAsync(HttpRequest request, byte[] body)已过时。Resume the request execution by invoking the next interceptor in the chain or executing the request to the remote service.ListenableFuture<ClientHttpResponse>AsyncClientHttpRequestInterceptor. intercept(HttpRequest request, byte[] body, AsyncClientHttpRequestExecution execution)已过时。Intercept the given request, and return a response future.ClientHttpResponseClientHttpRequestInterceptor. intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)Intercept the given request, and return a response.org.springframework.http.client.support中HttpRequest的使用
实现HttpRequest的org.springframework.http.client.support中的类 修饰符和类型 类 说明 classHttpRequestWrapperProvides a convenient implementation of theHttpRequestinterface that can be overridden to adapt the request.返回HttpRequest的org.springframework.http.client.support中的方法 修饰符和类型 方法 说明 HttpRequestHttpRequestWrapper. getRequest()Return the wrapped request.参数类型为HttpRequest的org.springframework.http.client.support中的方法 修饰符和类型 方法 说明 ClientHttpResponseBasicAuthenticationInterceptor. intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)ClientHttpResponseBasicAuthorizationInterceptor. intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)已过时。参数类型为HttpRequest的org.springframework.http.client.support中的构造器 构造器 说明 HttpRequestWrapper(HttpRequest request)Create a newHttpRequestwrapping the given request object.org.springframework.http.server中HttpRequest的使用
org.springframework.http.server中HttpRequest的子接口 修饰符和类型 接口 说明 interfaceServerHttpRequestRepresents a server-side HTTP request.实现HttpRequest的org.springframework.http.server中的类 修饰符和类型 类 说明 classServletServerHttpRequestServerHttpRequestimplementation that is based on aHttpServletRequest.org.springframework.http.server.reactive中HttpRequest的使用
org.springframework.http.server.reactive中HttpRequest的子接口 修饰符和类型 接口 说明 interfaceServerHttpRequestRepresents a reactive server-side HTTP request.实现HttpRequest的org.springframework.http.server.reactive中的类 修饰符和类型 类 说明 classAbstractServerHttpRequestCommon base class forServerHttpRequestimplementations.classServerHttpRequestDecoratorWraps anotherServerHttpRequestand delegates all methods to it.org.springframework.mock.http.client中HttpRequest的使用
实现HttpRequest的org.springframework.mock.http.client中的类 修饰符和类型 类 说明 classMockAsyncClientHttpRequest已过时。as of Spring 5.0, with no direct replacementclassMockClientHttpRequestMock implementation ofClientHttpRequest.org.springframework.mock.http.server.reactive中HttpRequest的使用
实现HttpRequest的org.springframework.mock.http.server.reactive中的类 修饰符和类型 类 说明 classMockServerHttpRequestMock extension ofAbstractServerHttpRequestfor use in tests without an actual server.org.springframework.web.multipart.support中HttpRequest的使用
实现HttpRequest的org.springframework.web.multipart.support中的类 修饰符和类型 类 说明 classRequestPartServletServerHttpRequestServerHttpRequestimplementation that accesses one part of a multipart request.org.springframework.web.reactive.function.client中HttpRequest的使用
返回HttpRequest的org.springframework.web.reactive.function.client中的方法 修饰符和类型 方法 说明 HttpRequestWebClientResponseException. getRequest()Return the corresponding request.参数类型为HttpRequest的org.springframework.web.reactive.function.client中的方法 修饰符和类型 方法 说明 static WebClientResponseExceptionWebClientResponseException. create(int statusCode, String statusText, HttpHeaders headers, byte[] body, Charset charset, HttpRequest request)CreateWebClientResponseExceptionor an HTTP status specific subclass.ClientResponse.BuilderClientResponse.Builder. request(HttpRequest request)Set the request associated with the response.参数类型为HttpRequest的org.springframework.web.reactive.function.client中的构造器 构造器 说明 UnknownHttpStatusCodeException(int statusCode, HttpHeaders headers, byte[] responseBody, Charset responseCharset, HttpRequest request)Create a new instance of theUnknownHttpStatusCodeExceptionwith the given parameters.WebClientResponseException(int status, String reasonPhrase, HttpHeaders headers, byte[] body, Charset charset, HttpRequest request)Constructor with response data only, and a default message.WebClientResponseException(String message, int statusCode, String statusText, HttpHeaders headers, byte[] responseBody, Charset charset, HttpRequest request)Constructor with a prepared message.org.springframework.web.util中HttpRequest的使用
参数类型为HttpRequest的org.springframework.web.util中的方法 修饰符和类型 方法 说明 static UriComponentsBuilderUriComponentsBuilder. fromHttpRequest(HttpRequest request)Create a newUriComponentsobject from the URI associated with the given HttpRequest while also overlaying with values from the headers "Forwarded" (RFC 7239), or "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" if "Forwarded" is not found.static booleanWebUtils. isSameOrigin(HttpRequest request)Check if the request is a same-origin one, based onOrigin,Host,Forwarded,X-Forwarded-Proto,X-Forwarded-HostandX-Forwarded-Portheaders.static booleanWebUtils. isValidOrigin(HttpRequest request, Collection<String> allowedOrigins)Check the given request origin against a list of allowed origins.