org.apache.hc.core5.http.message

## Class BasicClassicHttpRequest

- java.lang.Object
- - org.apache.hc.core5.http.message.HeaderGroup
  - - org.apache.hc.core5.http.message.BasicHttpRequest
    - - org.apache.hc.core5.http.message.BasicClassicHttpRequest

- All Implemented Interfaces:
    Serializable, ClassicHttpRequest, HttpEntityContainer, HttpMessage, HttpRequest, MessageHeaders

      public class BasicClassicHttpRequest
      extends BasicHttpRequest
      implements ClassicHttpRequest

  Basic implementation of `ClassicHttpRequest`.
  Since:
    5.0
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicClassicHttpRequest(Method method, HttpHost host, String path)` Creates request message with the given method, host and request path.
    `BasicClassicHttpRequest(Method method, String path)` Creates request message with the given method and request path.
    `BasicClassicHttpRequest(Method method, URI requestUri)` Creates request message with the given method, request URI.
    `BasicClassicHttpRequest(String method, HttpHost host, String path)` Creates request message with the given method, host and request path.
    `BasicClassicHttpRequest(String method, String path)` Creates request message with the given method and request path.
    `BasicClassicHttpRequest(String method, String scheme, URIAuthority authority, String path)` Creates request message with the given method, host and request path.
    `BasicClassicHttpRequest(String method, URI requestUri)` Creates request message with the given method, request URI.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HttpEntity` | `getEntity()` Obtains the message entity, if available.
    `void` | `setEntity(HttpEntity entity)` Sets an entity for this message.

    - ### 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.HttpRequest

      `getAuthority, getMethod, getPath, getRequestUri, getScheme, getUri, setAuthority, setPath, setScheme, setUri`

    - ### Methods inherited from interface org.apache.hc.core5.http.HttpMessage

      `addHeader, addHeader, getVersion, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setVersion`

    - ### Methods inherited from interface org.apache.hc.core5.http.MessageHeaders

      `containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator`

- - ### Constructor Detail

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(String method,
                                 String scheme,
                                 URIAuthority authority,
                                 String path)

      Creates request message with the given method, host and request path.
      Parameters:
        `method` - request method.
        `scheme` - request scheme.
        `authority` - request authority.
        `path` - request path.
      Since:
        5.1

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(String method,
                                 String path)

      Creates request message with the given method and request path.
      Parameters:
        `method` - request method.
        `path` - request path.

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(String method,
                                 HttpHost host,
                                 String path)

      Creates request message with the given method, host and request path.
      Parameters:
        `method` - request method.
        `host` - request host.
        `path` - request path.

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(String method,
                                 URI requestUri)

      Creates request message with the given method, request URI.
      Parameters:
        `method` - request method.
        `requestUri` - request URI.

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(Method method,
                                 String path)

      Creates request message with the given method and request path.
      Parameters:
        `method` - request method.
        `path` - request path.

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(Method method,
                                 HttpHost host,
                                 String path)

      Creates request message with the given method, host and request path.
      Parameters:
        `method` - request method.
        `host` - request host.
        `path` - request path.

    - #### BasicClassicHttpRequest

          public BasicClassicHttpRequest(Method method,
                                 URI requestUri)

      Creates request message with the given method, request URI.
      Parameters:
        `method` - request method.
        `requestUri` - request URI.

  - ### Method Detail

    - #### getEntity

          public HttpEntity getEntity()

      Description copied from interface: `HttpEntityContainer`
      Obtains the message entity, if available.
      Specified by:
        `getEntity` in interface `HttpEntityContainer`
      Returns:
        the message entity, or `null` if not available

    - #### setEntity

          public void setEntity(HttpEntity entity)

      Description copied from interface: `HttpEntityContainer`
      Sets an entity for this message.

      Please note that if an entity has already been set it is responsibility of the caller to ensure release of the resources that may be associated with that entity.

      Specified by:
        `setEntity` in interface `HttpEntityContainer`
      Parameters:
        `entity` - the entity to set of this message, or `null` to unset

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.