Class SimpleHttpRequest

  • All Implemented Interfaces:
    java.io.Serializable, Configurable, org.apache.hc.core5.http.HttpMessage, org.apache.hc.core5.http.HttpRequest, org.apache.hc.core5.http.MessageHeaders

    public final class SimpleHttpRequest
    extends ConfigurableHttpRequest
    HTTP request that can enclose a body represented as a simple text string or an array of bytes.

    IMPORTANT: SimpleHttpRequests are intended for simple scenarios where entities inclosed in requests are known to be small. It is generally recommended to use AsyncRequestBuilder and streaming AsyncEntityProducers.

    Since:
    5.0
    See Also:
    SimpleBody, AsyncRequestBuilder, AsyncEntityProducer, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleHttpRequest​(java.lang.String method, java.lang.String path)  
      SimpleHttpRequest​(java.lang.String method, java.lang.String scheme, org.apache.hc.core5.net.URIAuthority authority, java.lang.String path)  
      SimpleHttpRequest​(java.lang.String method, java.net.URI requestUri)  
      SimpleHttpRequest​(java.lang.String method, org.apache.hc.core5.http.HttpHost host, java.lang.String path)  
      SimpleHttpRequest​(org.apache.hc.core5.http.Method method, java.net.URI requestUri)  
      SimpleHttpRequest​(org.apache.hc.core5.http.Method method, org.apache.hc.core5.http.HttpHost host, java.lang.String path)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static SimpleHttpRequest copy​(org.apache.hc.core5.http.HttpRequest original)
      Deprecated.
      static SimpleHttpRequest create​(java.lang.String method, java.lang.String uri)  
      static SimpleHttpRequest create​(java.lang.String method, java.lang.String scheme, org.apache.hc.core5.net.URIAuthority authority, java.lang.String path)  
      static SimpleHttpRequest create​(java.lang.String method, java.net.URI uri)  
      static SimpleHttpRequest create​(org.apache.hc.core5.http.Method method, java.net.URI uri)  
      static SimpleHttpRequest create​(org.apache.hc.core5.http.Method method, org.apache.hc.core5.http.HttpHost host, java.lang.String path)  
      SimpleBody getBody()  
      byte[] getBodyBytes()  
      java.lang.String getBodyText()  
      org.apache.hc.core5.http.ContentType getContentType()  
      void setBody​(byte[] bodyBytes, org.apache.hc.core5.http.ContentType contentType)  
      void setBody​(java.lang.String bodyText, org.apache.hc.core5.http.ContentType contentType)  
      void setBody​(SimpleBody body)  
      • Methods inherited from class org.apache.hc.core5.http.message.BasicHttpRequest

        addHeader, getAuthority, getMethod, getPath, getRequestUri, getScheme, getUri, getVersion, setAbsoluteRequestUri, setAuthority, setHeader, setPath, setScheme, setUri, setVersion, toString
      • Methods inherited from class org.apache.hc.core5.http.message.HeaderGroup

        addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeaders
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.hc.core5.http.HttpMessage

        addHeader, removeHeader, removeHeaders, setHeader, setHeaders
      • Methods inherited from interface org.apache.hc.core5.http.MessageHeaders

        containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
    • Constructor Detail

      • SimpleHttpRequest

        public SimpleHttpRequest​(java.lang.String method,
                                 java.lang.String path)
      • SimpleHttpRequest

        public SimpleHttpRequest​(java.lang.String method,
                                 org.apache.hc.core5.http.HttpHost host,
                                 java.lang.String path)
      • SimpleHttpRequest

        public SimpleHttpRequest​(java.lang.String method,
                                 java.net.URI requestUri)
      • SimpleHttpRequest

        public SimpleHttpRequest​(org.apache.hc.core5.http.Method method,
                                 java.net.URI requestUri)
        Since:
        5.1
      • SimpleHttpRequest

        public SimpleHttpRequest​(org.apache.hc.core5.http.Method method,
                                 org.apache.hc.core5.http.HttpHost host,
                                 java.lang.String path)
        Since:
        5.1
      • SimpleHttpRequest

        public SimpleHttpRequest​(java.lang.String method,
                                 java.lang.String scheme,
                                 org.apache.hc.core5.net.URIAuthority authority,
                                 java.lang.String path)
        Since:
        5.1
    • Method Detail

      • create

        public static SimpleHttpRequest create​(java.lang.String method,
                                               java.lang.String uri)
        Since:
        5.1
      • create

        public static SimpleHttpRequest create​(java.lang.String method,
                                               java.net.URI uri)
        Since:
        5.1
      • create

        public static SimpleHttpRequest create​(org.apache.hc.core5.http.Method method,
                                               java.net.URI uri)
        Since:
        5.1
      • create

        public static SimpleHttpRequest create​(org.apache.hc.core5.http.Method method,
                                               org.apache.hc.core5.http.HttpHost host,
                                               java.lang.String path)
        Since:
        5.1
      • create

        public static SimpleHttpRequest create​(java.lang.String method,
                                               java.lang.String scheme,
                                               org.apache.hc.core5.net.URIAuthority authority,
                                               java.lang.String path)
        Since:
        5.1
      • setBody

        public void setBody​(SimpleBody body)
      • setBody

        public void setBody​(byte[] bodyBytes,
                            org.apache.hc.core5.http.ContentType contentType)
      • setBody

        public void setBody​(java.lang.String bodyText,
                            org.apache.hc.core5.http.ContentType contentType)
      • getContentType

        public org.apache.hc.core5.http.ContentType getContentType()
      • getBodyText

        public java.lang.String getBodyText()
      • getBodyBytes

        public byte[] getBodyBytes()