org.opengis.cite.ogcapifeatures10.util

## Class ClientUtils

- java.lang.Object
- - org.opengis.cite.ogcapifeatures10.util.ClientUtils

-     public class ClientUtils
      extends Object

  Provides various utility methods for creating and configuring HTTP client components.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static com.sun.jersey.api.client.Client` | `buildClient()` Builds a client component for interacting with HTTP endpoints.
    `static com.sun.jersey.api.client.Client` | `buildClientWithProxy(String proxyHost, int proxyPort)` Constructs a client component that uses a specified web proxy.
    `static com.sun.jersey.api.client.ClientRequest` | `buildGetRequest(URI endpoint, Map<String,String> qryParams, javax.ws.rs.core.MediaType... mediaTypes)` Builds an HTTP request message that uses the GET method.
    `static Document` | `getResponseEntityAsDocument(com.sun.jersey.api.client.ClientResponse response, String targetURI)` Obtains the (XML) response entity as a DOM Document and resets the entity input stream for subsequent reads.
    `static Source` | `getResponseEntityAsSource(com.sun.jersey.api.client.ClientResponse response, String targetURI)` Obtains the (XML) response entity as a JAXP Source object and resets the entity input stream for subsequent reads.
    `static javax.ws.rs.core.MediaType` | `removeParameters(javax.ws.rs.core.MediaType mediaType)` Creates a copy of the given MediaType object but without any parameters.

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

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

- - ### Constructor Detail

    - #### ClientUtils

          public ClientUtils()

  - ### Method Detail

    - #### buildClient

          public static com.sun.jersey.api.client.Client buildClient()

      Builds a client component for interacting with HTTP endpoints. The client will automatically redirect to the URI declared in 3xx responses. The connection timeout is 10 s. Request and response messages may be logged to a JDK logger (in the namespace "com.sun.jersey.api.client").
      Returns:
        A Client component.

    - #### buildClientWithProxy

          public static com.sun.jersey.api.client.Client buildClientWithProxy(String proxyHost,
                                                                              int proxyPort)

      Constructs a client component that uses a specified web proxy. Proxy authentication is not supported. Configuring the client to use an intercepting proxy can be useful when debugging a test.
      Parameters:
        `proxyHost` - The host name or IP address of the proxy server.
        `proxyPort` - The port number of the proxy listener.
      Returns:
        A Client component that submits requests through a web proxy.

    - #### buildGetRequest

          public static com.sun.jersey.api.client.ClientRequest buildGetRequest(URI endpoint,
                                                                                Map<String,String> qryParams,
                                                                                javax.ws.rs.core.MediaType... mediaTypes)

      Builds an HTTP request message that uses the GET method.
      Parameters:
        `endpoint` - A URI indicating the target resource.
        `qryParams` - A Map containing query parameters (may be null);
        `mediaTypes` - A list of acceptable media types; if not specified, generic XML ("application/xml") is preferred.
      Returns:
        A ClientRequest object.

    - #### removeParameters

          public static javax.ws.rs.core.MediaType removeParameters(javax.ws.rs.core.MediaType mediaType)

      Creates a copy of the given MediaType object but without any parameters.
      Parameters:
        `mediaType` - A MediaType descriptor.
      Returns:
        A new (immutable) MediaType object having the same type and subtype.

    - #### getResponseEntityAsSource

          public static Source getResponseEntityAsSource(com.sun.jersey.api.client.ClientResponse response,
                                                         String targetURI)

      Obtains the (XML) response entity as a JAXP Source object and resets the entity input stream for subsequent reads.
      Parameters:
        `response` - A representation of an HTTP response message.
        `targetURI` - The target URI from which the entity was retrieved (may be null).
      Returns:
        A Source to read the entity from; its system identifier is set using the given targetURI value (this may be used to resolve any relative URIs found in the source).

    - #### getResponseEntityAsDocument

          public static Document getResponseEntityAsDocument(com.sun.jersey.api.client.ClientResponse response,
                                                             String targetURI)

      Obtains the (XML) response entity as a DOM Document and resets the entity input stream for subsequent reads.
      Parameters:
        `response` - A representation of an HTTP response message.
        `targetURI` - The target URI from which the entity was retrieved (may be null).
      Returns:
        A Document representing the entity; its base URI is set using the given targetURI value (this may be used to resolve any relative URIs found in the document).

Copyright © 2020 Open Geospatial Consortium. All rights reserved.