Class HttpServerExpectationFilter
- java.lang.Object
-
- org.apache.hc.core5.http.io.support.HttpServerExpectationFilter
-
- All Implemented Interfaces:
HttpFilterHandler
@Contract(threading=STATELESS) public class HttpServerExpectationFilter extends java.lang.Object implements HttpFilterHandler
HttpServerExpectationFilter add support for the Expect-Continue handshake to the request processing pipeline.- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description HttpServerExpectationFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HttpEntity
generateResponseContent(HttpResponse expectationFailed)
Generates response content entity for the final HTTP response with an error status representing the cause of expectation failure.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.
-
-
-
Method Detail
-
verify
protected boolean verify(ClassicHttpRequest request, HttpContext context) throws HttpException
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
protected HttpEntity generateResponseContent(HttpResponse expectationFailed) throws HttpException
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, java.io.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
java.io.IOException
-
-