Class LowLevelHttpRequest

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String contentEncoding
      Content encoding (for example "gzip") or null for none.
      private long contentLength
      Content length or less than zero if not known.
      private java.lang.String contentType
      Content type or null for none.
      private StreamingContent streamingContent
      Streaming content or null for no content.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void addHeader​(java.lang.String name, java.lang.String value)
      Adds a header to the HTTP request.
      abstract LowLevelHttpResponse execute()
      Executes the request and returns a low-level HTTP response object.
      java.lang.String getContentEncoding()
      Returns the content encoding (for example "gzip") or null for none.
      long getContentLength()
      Returns the content length or less than zero if not known.
      java.lang.String getContentType()
      Returns the content type or null for none.
      StreamingContent getStreamingContent()
      Returns the streaming content or null for no content.
      void setContentEncoding​(java.lang.String contentEncoding)
      Sets the content encoding (for example "gzip") or null for none.
      void setContentLength​(long contentLength)
      Sets the content length or less than zero if not known.
      void setContentType​(java.lang.String contentType)
      Sets the content type or null for none.
      void setStreamingContent​(StreamingContent streamingContent)
      Sets the streaming content or null for no content.
      void setTimeout​(int connectTimeout, int readTimeout)
      Sets the connection and read timeouts.
      void setWriteTimeout​(int writeTimeout)
      Sets the write timeout for POST/PUT requests.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • contentLength

        private long contentLength
        Content length or less than zero if not known.
      • contentEncoding

        private java.lang.String contentEncoding
        Content encoding (for example "gzip") or null for none.
      • contentType

        private java.lang.String contentType
        Content type or null for none.
      • streamingContent

        private StreamingContent streamingContent
        Streaming content or null for no content.
    • Constructor Detail

      • LowLevelHttpRequest

        public LowLevelHttpRequest()
    • Method Detail

      • addHeader

        public abstract void addHeader​(java.lang.String name,
                                       java.lang.String value)
                                throws java.io.IOException
        Adds a header to the HTTP request.

        Note that multiple headers of the same name need to be supported, in which case addHeader(java.lang.String, java.lang.String) will be called for each instance of the header.

        Parameters:
        name - header name
        value - header value
        Throws:
        java.io.IOException
      • setContentLength

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

        Default value is -1.

        Throws:
        java.io.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​(java.lang.String contentEncoding)
                                      throws java.io.IOException
        Sets the content encoding (for example "gzip") or null for none.
        Throws:
        java.io.IOException - I/O exception
        Since:
        1.14
      • getContentEncoding

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

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

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

        public final void setStreamingContent​(StreamingContent streamingContent)
                                       throws java.io.IOException
        Sets the streaming content or null for no content.
        Throws:
        java.io.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 java.io.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:
        java.io.IOException - I/O exception
        Since:
        1.4
      • setWriteTimeout

        public void setWriteTimeout​(int writeTimeout)
                             throws java.io.IOException
        Sets the write timeout for POST/PUT requests.

        Default implementation does nothing, but subclasses should normally override.

        Parameters:
        writeTimeout - timeout in milliseconds to establish a connection or 0 for an infinite timeout
        Throws:
        java.io.IOException - I/O exception
        Since:
        1.27
      • execute

        public abstract LowLevelHttpResponse execute()
                                              throws java.io.IOException
        Executes the request and returns a low-level HTTP response object.
        Throws:
        java.io.IOException