Class HttpServerExpectationFilter
java.lang.Object
org.apache.hc.core5.http.io.support.HttpServerExpectationFilter
- All Implemented Interfaces:
HttpFilterHandler
@Contract(threading=STATELESS)
public class HttpServerExpectationFilter
extends Object
implements HttpFilterHandler
HttpServerExpectationFilter add support for the Expect-Continue handshake
to the request processing pipeline.
- Since:
- 5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpEntity
generateResponseContent
(HttpResponse expectationFailed) Generates response content entity for the final HTTP response with an error status representing the cause of expectation failure.final void
handle
(ClassicHttpRequest request, HttpFilterChain.ResponseTrigger responseTrigger, HttpContext context, HttpFilterChain chain) Processes the incoming HTTP request and if processing has been completed submits a final response to the client.protected boolean
verify
(ClassicHttpRequest request, HttpContext context) Verifies the HTTP request and decides whether it meets server expectations and the request processing can continue.
-
Constructor Details
-
HttpServerExpectationFilter
public HttpServerExpectationFilter()
-
-
Method Details
-
verify
Verifies the HTTP request and decides whether it meets server expectations and the request processing can continue.- Parameters:
request
- the incoming HTTP request.context
- the actual execution context.- Returns:
true
if the request meets expectations orfalse
otherwise.- Throws:
HttpException
-
generateResponseContent
Generates response content entity for the final HTTP response with an error status representing the cause of expectation failure.- Parameters:
expectationFailed
- the final HTTP response.- Returns:
- the content entity for the final HTTP response with an error status representing the cause of expectation failure.
- Throws:
HttpException
-
handle
public final void handle(ClassicHttpRequest request, HttpFilterChain.ResponseTrigger responseTrigger, HttpContext context, HttpFilterChain chain) throws HttpException, IOException Description copied from interface:HttpFilterHandler
Processes the incoming HTTP request and if processing has been completed submits a final response to the client. The handler must not use the response trigger after passing control to the next filter with theHttpFilterChain.proceed(ClassicHttpRequest, HttpFilterChain.ResponseTrigger, HttpContext)
method.- Specified by:
handle
in interfaceHttpFilterHandler
- Parameters:
request
- the actual request.responseTrigger
- the response trigger.context
- the actual execution context.chain
- the next element in the request processing chain.- Throws:
HttpException
IOException
-