org.cybergarage.http

## Class HTTP

- java.lang.Object
- - org.cybergarage.http.HTTP

-     public class HTTP
      extends Object

  Utility class providing HTTP protocol constants and helper methods.

  This class contains commonly used HTTP protocol constants including:

  - HTTP methods (GET, POST, HEAD, etc.)
  - HTTP headers (Content-Type, Host, etc.)
  - HTTP status codes and versions
  - UPnP-specific constants

  Also provides utility methods for URL manipulation and validation.

  Version:
    1.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BOOTID_UPNP_ORG`
    `static String` | `CACHE_CONTROL`
    `static String` | `CALLBACK`
    `static String` | `CHARSET`
    `static String` | `CHUNKED`
    `static String` | `CLOSE`
    `static String` | `CONNECTION`
    `static String` | `CONTENT_LANGUAGE`
    `static String` | `CONTENT_LENGTH`
    `static String` | `CONTENT_RANGE`
    `static String` | `CONTENT_RANGE_BYTES`
    `static String` | `CONTENT_TYPE`
    `static byte` | `CR`
    `static String` | `CRLF`
    `static String` | `DATE`
    `static int` | `DEFAULT_CHUNK_SIZE`
    `static int` | `DEFAULT_PORT`
    `static int` | `DEFAULT_TIMEOUT`
    `static String` | `EXT`
    `static String` | `GET`
    `static String` | `HEAD`
    `static String` | `HEADER_LINE_DELIM`
    `static String` | `HOST`
    `static String` | `KEEP_ALIVE`
    `static byte` | `LF`
    `static String` | `LOCATION`
    `static String` | `M_SEARCH`
    `static String` | `MAN`
    `static String` | `MAX_AGE`
    `static String` | `MX`
    `static String` | `MYNAME`
    `static String` | `NO_CACHE`
    `static String` | `NOTIFY`
    `static String` | `NT`
    `static String` | `NTS`
    `static String` | `POST`
    `static String` | `RANGE`
    `static String` | `REQEST_LINE_DELIM`
    `static String` | `SEQ`
    `static String` | `SERVER`
    `static String` | `SID`
    `static String` | `SOAP_ACTION`
    `static String` | `ST`
    `static String` | `STATUS_LINE_DELIM`
    `static String` | `SUBSCRIBE`
    `static String` | `TAB`
    `static String` | `TIMEOUT`
    `static String` | `TRANSFER_ENCODING`
    `static String` | `UNSUBSCRIBE`
    `static String` | `USN`
    `static String` | `VERSION`
    `static String` | `VERSION_10`
    `static String` | `VERSION_11`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTTP()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getAbsoluteURL(String baseURLStr, String relURlStr)` Creates an absolute URL by combining base URL with relative URL.
    `static int` | `getChunkSize()` Gets the current default chunk size for HTTP operations.
    `static String` | `getHost(String urlStr)` Extracts the host name from a URL string.
    `static int` | `getPort(String urlStr)` Extracts the port number from a URL string.
    `static String` | `getRequestHostURL(String host, int port)` Creates a request host URL from host and port.
    `static boolean` | `isAbsoluteURL(String urlStr)` Checks if a string represents an absolute URL.
    `static void` | `setChunkSize(int size)` Sets the default chunk size for HTTP operations.
    `static String` | `toRelativeURL(String urlStr)` Converts a URL to a relative URL path with query parameters.
    `static String` | `toRelativeURL(String urlStr, boolean withParam)` Converts a URL to a relative URL path.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BOOTID_UPNP_ORG

          public static final String BOOTID_UPNP_ORG

      See Also:
        Constant Field Values

    - #### CACHE_CONTROL

          public static final String CACHE_CONTROL

      See Also:
        Constant Field Values

    - #### CALLBACK

          public static final String CALLBACK

      See Also:
        Constant Field Values

    - #### CHARSET

          public static final String CHARSET

      See Also:
        Constant Field Values

    - #### CHUNKED

          public static final String CHUNKED

      See Also:
        Constant Field Values

    - #### CLOSE

          public static final String CLOSE

      See Also:
        Constant Field Values

    - #### CONNECTION

          public static final String CONNECTION

      See Also:
        Constant Field Values

    - #### CONTENT_LANGUAGE

          public static final String CONTENT_LANGUAGE

      See Also:
        Constant Field Values

    - #### CONTENT_LENGTH

          public static final String CONTENT_LENGTH

      See Also:
        Constant Field Values

    - #### CONTENT_RANGE

          public static final String CONTENT_RANGE

      See Also:
        Constant Field Values

    - #### CONTENT_RANGE_BYTES

          public static final String CONTENT_RANGE_BYTES

      See Also:
        Constant Field Values

    - #### CONTENT_TYPE

          public static final String CONTENT_TYPE

      See Also:
        Constant Field Values

    - #### CR

          public static final byte CR

      See Also:
        Constant Field Values

    - #### CRLF

          public static final String CRLF

      See Also:
        Constant Field Values

    - #### DATE

          public static final String DATE

      See Also:
        Constant Field Values

    - #### DEFAULT_CHUNK_SIZE

          public static final int DEFAULT_CHUNK_SIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_PORT

          public static final int DEFAULT_PORT

      See Also:
        Constant Field Values

    - #### DEFAULT_TIMEOUT

          public static final int DEFAULT_TIMEOUT

      See Also:
        Constant Field Values

    - #### EXT

          public static final String EXT

      See Also:
        Constant Field Values

    - #### GET

          public static final String GET

      See Also:
        Constant Field Values

    - #### HEAD

          public static final String HEAD

      See Also:
        Constant Field Values

    - #### HEADER_LINE_DELIM

          public static final String HEADER_LINE_DELIM

      See Also:
        Constant Field Values

    - #### HOST

          public static final String HOST

      See Also:
        Constant Field Values

    - #### KEEP_ALIVE

          public static final String KEEP_ALIVE

      See Also:
        Constant Field Values

    - #### LF

          public static final byte LF

      See Also:
        Constant Field Values

    - #### LOCATION

          public static final String LOCATION

      See Also:
        Constant Field Values

    - #### M_SEARCH

          public static final String M_SEARCH

      See Also:
        Constant Field Values

    - #### MAN

          public static final String MAN

      See Also:
        Constant Field Values

    - #### MAX_AGE

          public static final String MAX_AGE

      See Also:
        Constant Field Values

    - #### MX

          public static final String MX

      See Also:
        Constant Field Values

    - #### MYNAME

          public static final String MYNAME

      See Also:
        Constant Field Values

    - #### NO_CACHE

          public static final String NO_CACHE

      See Also:
        Constant Field Values

    - #### NOTIFY

          public static final String NOTIFY

      See Also:
        Constant Field Values

    - #### NT

          public static final String NT

      See Also:
        Constant Field Values

    - #### NTS

          public static final String NTS

      See Also:
        Constant Field Values

    - #### POST

          public static final String POST

      See Also:
        Constant Field Values

    - #### RANGE

          public static final String RANGE

      See Also:
        Constant Field Values

    - #### REQEST_LINE_DELIM

          public static final String REQEST_LINE_DELIM

      See Also:
        Constant Field Values

    - #### SEQ

          public static final String SEQ

      See Also:
        Constant Field Values

    - #### SERVER

          public static final String SERVER

      See Also:
        Constant Field Values

    - #### SID

          public static final String SID

      See Also:
        Constant Field Values

    - #### SOAP_ACTION

          public static final String SOAP_ACTION

      See Also:
        Constant Field Values

    - #### ST

          public static final String ST

      See Also:
        Constant Field Values

    - #### STATUS_LINE_DELIM

          public static final String STATUS_LINE_DELIM

      See Also:
        Constant Field Values

    - #### SUBSCRIBE

          public static final String SUBSCRIBE

      See Also:
        Constant Field Values

    - #### TAB

          public static final String TAB

      See Also:
        Constant Field Values

    - #### TIMEOUT

          public static final String TIMEOUT

      See Also:
        Constant Field Values

    - #### TRANSFER_ENCODING

          public static final String TRANSFER_ENCODING

      See Also:
        Constant Field Values

    - #### UNSUBSCRIBE

          public static final String UNSUBSCRIBE

      See Also:
        Constant Field Values

    - #### USN

          public static final String USN

      See Also:
        Constant Field Values

    - #### VERSION

          public static final String VERSION

      See Also:
        Constant Field Values

    - #### VERSION_10

          public static final String VERSION_10

      See Also:
        Constant Field Values

    - #### VERSION_11

          public static final String VERSION_11

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HTTP

          public HTTP()

  - ### Method Detail

    - #### getAbsoluteURL

          public static final String getAbsoluteURL(String baseURLStr,
                                                    String relURlStr)

      Creates an absolute URL by combining base URL with relative URL.
      Parameters:
        `baseURLStr` - base URL string
        `relURlStr` - relative URL to combine with base
      Returns:
        absolute URL string, or empty string if combination fails

    - #### getChunkSize

          public static final int getChunkSize()

      Gets the current default chunk size for HTTP operations.
      Returns:
        chunk size in bytes

    - #### getHost

          public static final String getHost(String urlStr)

      Extracts the host name from a URL string.
      Parameters:
        `urlStr` - URL string to extract host from
      Returns:
        host name, or empty string if URL is invalid

    - #### getPort

          public static final int getPort(String urlStr)

      Extracts the port number from a URL string. Returns default HTTP port (80) if no port is specified.
      Parameters:
        `urlStr` - URL string to extract port from
      Returns:
        port number, or default port (80) if URL is invalid or no port specified

    - #### getRequestHostURL

          public static final String getRequestHostURL(String host,
                                                       int port)

      Creates a request host URL from host and port.
      Parameters:
        `host` - host name or IP address
        `port` - port number
      Returns:
        URL string in format "http://host:port"

    - #### isAbsoluteURL

          public static final boolean isAbsoluteURL(String urlStr)

      Checks if a string represents an absolute URL.
      Parameters:
        `urlStr` - string to check
      Returns:
        true if the string is a valid absolute URL, false otherwise

    - #### setChunkSize

          public static final void setChunkSize(int size)

      Sets the default chunk size for HTTP operations.
      Parameters:
        `size` - chunk size in bytes

    - #### toRelativeURL

          public static final String toRelativeURL(String urlStr)

      Converts a URL to a relative URL path with query parameters.
      Parameters:
        `urlStr` - URL string to convert
      Returns:
        relative URL path with query parameters

    - #### toRelativeURL

          public static final String toRelativeURL(String urlStr,
                                                   boolean withParam)

      Converts a URL to a relative URL path.
      Parameters:
        `urlStr` - URL string to convert
        `withParam` - whether to include query parameters in result
      Returns:
        relative URL path, optionally with query parameters