Package net.shibboleth.shared.httpclient
Class RequestConnectionClose
java.lang.Object
net.shibboleth.shared.httpclient.RequestConnectionClose
- All Implemented Interfaces:
org.apache.hc.core5.http.HttpRequestInterceptor
public class RequestConnectionClose
extends Object
implements org.apache.hc.core5.http.HttpRequestInterceptor
Adds a
Connection: close to all HTTP/1.1 requests.
This interceptor essentially disables connection keep-alive support and, by virtue of the server closing the
connection, prevents a HttpClientConnectionManager from holding open and
reusing connections. If you'd like to allow the HttpClientConnectionManager
to hold open connections for a while and potentially reuse them, consider using
HttpClientBuilder.setEvictIdleConnections(boolean) and
HttpClientBuilder.setConnectionMaxIdleTime(java.time.Duration) to limit the amount of time
the connections are held open.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprocess(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.EntityDetails entity, org.apache.hc.core5.http.protocol.HttpContext context)
-
Field Details
-
LOG
@Nonnull static final org.slf4j.Logger LOGLogger.
-
-
Constructor Details
-
RequestConnectionClose
public RequestConnectionClose()
-
-
Method Details
-
process
public void process(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.EntityDetails entity, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.HttpException, IOException - Specified by:
processin interfaceorg.apache.hc.core5.http.HttpRequestInterceptor- Throws:
org.apache.hc.core5.http.HttpExceptionIOException
-