Class NoExpectContinueHttpClient
- All Implemented Interfaces:
Closeable, AutoCloseable, org.geotools.http.HTTPBehavior, org.geotools.http.HTTPClient, org.geotools.http.HTTPConnectionPooling, org.geotools.http.HTTPProxy
MultithreadedHttpClient that doesn't send an Expect: 100-continue header with POST requests.
MultithreadedHttpClient enables the Expect: 100-continue handshake for all requests. With it, the
Apache HttpClient sends a POST request without its body first and waits for a 100 Continue response before
sending the body, or sends the body anyway after a timeout of 3 seconds. Some servers (for example the PDOK WFS
services at service.pdok.nl) only send the 100 Continue response after receiving the body, so every
POST request (WFS GetFeature, and DescribeFeatureType for WFS 1.1.0) takes at least 3 seconds. The handshake only
avoids sending a large body that the server rejects based on the headers alone, which doesn't matter for the small
XML request bodies GeoTools sends.
Also fixes setConnectTimeout(int): MultithreadedHttpClient (GeoTools 35.2) only replaces its
connection config field, which the connection manager has already copied in the constructor, so the connect timeout
always stays at the initial 30 seconds.
MultithreadedHttpClient doesn't allow changing its request configuration or accessing its connection
manager, so this uses reflection. If that fails because of a changed GeoTools implementation, the constructor throws
an exception, so this is caught by the unit test when upgrading GeoTools.
-
Field Summary
Fields inherited from class org.geotools.http.AbstractHttpClient
connectTimeout, extraParams, password, readTimeout, tryGzip, user -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetConnectTimeout(int connectTimeout) Sets the connect timeout in seconds, also for new connections of the connection manager.Methods inherited from class org.geotools.http.commons.MultithreadedHttpClient
close, get, get, getConnectTimeout, getMaxConnections, getReadTimeout, post, post, setMaxConnections, setPassword, setReadTimeout, setUserMethods inherited from class org.geotools.http.AbstractHttpClient
appendURL, createFileResponse, encodeURL, getExtraParams, getPassword, getUser, isFile, isTryGzip, setExtraParams, setTryGzip
-
Constructor Details
-
NoExpectContinueHttpClient
public NoExpectContinueHttpClient()
-
-
Method Details
-
setConnectTimeout
public void setConnectTimeout(int connectTimeout) Sets the connect timeout in seconds, also for new connections of the connection manager.- Specified by:
setConnectTimeoutin interfaceorg.geotools.http.HTTPClient- Overrides:
setConnectTimeoutin classorg.geotools.http.commons.MultithreadedHttpClient
-