Class NoExpectContinueHttpClient

java.lang.Object
org.geotools.http.AbstractHttpClient
org.geotools.http.commons.MultithreadedHttpClient
org.tailormap.api.geotools.http.NoExpectContinueHttpClient
All Implemented Interfaces:
Closeable, AutoCloseable, org.geotools.http.HTTPBehavior, org.geotools.http.HTTPClient, org.geotools.http.HTTPConnectionPooling, org.geotools.http.HTTPProxy

public class NoExpectContinueHttpClient extends org.geotools.http.commons.MultithreadedHttpClient
GeoTools 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setConnectTimeout(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, setUser

    Methods inherited from class org.geotools.http.AbstractHttpClient

    appendURL, createFileResponse, encodeURL, getExtraParams, getPassword, getUser, isFile, isTryGzip, setExtraParams, setTryGzip

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      setConnectTimeout in interface org.geotools.http.HTTPClient
      Overrides:
      setConnectTimeout in class org.geotools.http.commons.MultithreadedHttpClient