Class LowLevelHttpRequest

  • Direct Known Subclasses:
    MockLowLevelHttpRequest

    public abstract class LowLevelHttpRequest
    extends Object
    Low-level HTTP request.

    This allows providing a different implementation of the HTTP request that is more compatible with the Java environment used.

    Implementation has no fields and therefore thread-safe, but sub-classes are not necessarily thread-safe.

    Since:
    1.0
    Author:
    Yaniv Inbar
    • Constructor Detail

      • LowLevelHttpRequest

        public LowLevelHttpRequest()
    • Method Detail

      • setContentLength

        public final void setContentLength​(long contentLength)
                                    throws IOException
        Sets the content length or less than zero if not known.

        Default value is -1.

        Throws:
        IOException - I/O exception
        Since:
        1.14
      • getContentLength

        public final long getContentLength()
        Returns the content length or less than zero if not known.
        Since:
        1.14
      • setContentEncoding

        public final void setContentEncoding​(String contentEncoding)
                                      throws IOException
        Sets the content encoding (for example "gzip") or null for none.
        Throws:
        IOException - I/O exception
        Since:
        1.14
      • getContentEncoding

        public final String getContentEncoding()
        Returns the content encoding (for example "gzip") or null for none.
        Since:
        1.14
      • setContentType

        public final void setContentType​(String contentType)
                                  throws IOException
        Sets the content type or null for none.
        Throws:
        IOException - I/O exception
        Since:
        1.14
      • getContentType

        public final String getContentType()
        Returns the content type or null for none.
        Since:
        1.14
      • setStreamingContent

        public final void setStreamingContent​(StreamingContent streamingContent)
                                       throws IOException
        Sets the streaming content or null for no content.
        Throws:
        IOException - I/O exception
        Since:
        1.14
      • getStreamingContent

        public final StreamingContent getStreamingContent()
        Returns the streaming content or null for no content.
        Since:
        1.14
      • setTimeout

        public void setTimeout​(int connectTimeout,
                               int readTimeout)
                        throws IOException
        Sets the connection and read timeouts.

        Default implementation does nothing, but subclasses should normally override.

        Parameters:
        connectTimeout - timeout in milliseconds to establish a connection or 0 for an infinite timeout
        readTimeout - Timeout in milliseconds to read data from an established connection or 0 for an infinite timeout
        Throws:
        IOException - I/O exception
        Since:
        1.4