Class GXConnection

java.lang.Object
org.gcube.common.gxhttp.reference.GXConnection

@Deprecated(since="1.1.0", forRemoval=true) public class GXConnection extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
use GXRequest, which returns a GXResponse
A remote connection for a GXHTTPStringRequest. It sends the request through a GXRequest and presents the GXResponse as an HttpURLConnection.
Author:
Manuele Simi (ISTI-CNR), Luca Frosini (ISTI-CNR)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Deprecated, for removal: This API element is subject to removal in a future version.
    The HTTP methods.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The address of the remote service.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The application/json;charset=UTF-8 content type.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    System property holding the default connect timeout, in milliseconds (0 means infinite).
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Connect timeout used when "gxhttp.connectTimeout" is not set, in milliseconds.
    static final int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Read timeout used when "gxhttp.readTimeout" is not set, in milliseconds.
    protected static final org.slf4j.Logger
    Deprecated, for removal: This API element is subject to removal in a future version.
    The logger.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The parameter equals.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The parameter separator.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The parameter starter.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The path separator.
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    System property holding the default read timeout, in milliseconds (0 means infinite).
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The UTF-8 charset.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new connection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    The body of the request.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    addPath(String pathPart)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds a path part to the connection.
    static int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Gets the default connect timeout: "gxhttp.connectTimeout" when set, otherwise 30000.
    static int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Gets the default read timeout: "gxhttp.readTimeout" when set, otherwise 300000.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Resets the connection.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sends the request with the given method
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the agent for the connection.
    void
    setConnectTimeout(int connectTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the connect timeout of this connection.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the path parameters for the connection.
    void
    setProperty(String name, String value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds a property as header.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the query parameters for the connection.
    void
    setReadTimeout(int readTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the read timeout of this connection.

    Methods inherited from class java.lang.Object

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

    • APPLICATION_JSON_CHARSET_UTF_8

      public static final String APPLICATION_JSON_CHARSET_UTF_8
      Deprecated, for removal: This API element is subject to removal in a future version.
      The application/json;charset=UTF-8 content type.
      See Also:
    • PATH_SEPARATOR

      public static final String PATH_SEPARATOR
      Deprecated, for removal: This API element is subject to removal in a future version.
      The path separator.
      See Also:
    • PARAM_STARTER

      public static final String PARAM_STARTER
      Deprecated, for removal: This API element is subject to removal in a future version.
      The parameter starter.
      See Also:
    • PARAM_EQUALS

      public static final String PARAM_EQUALS
      Deprecated, for removal: This API element is subject to removal in a future version.
      The parameter equals.
      See Also:
    • PARAM_SEPARATOR

      public static final String PARAM_SEPARATOR
      Deprecated, for removal: This API element is subject to removal in a future version.
      The parameter separator.
      See Also:
    • UTF8

      public static final String UTF8
      Deprecated, for removal: This API element is subject to removal in a future version.
      The UTF-8 charset.
      See Also:
    • logger

      protected static final org.slf4j.Logger logger
      Deprecated, for removal: This API element is subject to removal in a future version.
      The logger.
    • CONNECT_TIMEOUT_PROPERTY

      public static final String CONNECT_TIMEOUT_PROPERTY
      Deprecated, for removal: This API element is subject to removal in a future version.
      System property holding the default connect timeout, in milliseconds (0 means infinite).
      See Also:
    • READ_TIMEOUT_PROPERTY

      public static final String READ_TIMEOUT_PROPERTY
      Deprecated, for removal: This API element is subject to removal in a future version.
      System property holding the default read timeout, in milliseconds (0 means infinite).
      See Also:
    • DEFAULT_CONNECT_TIMEOUT

      public static final int DEFAULT_CONNECT_TIMEOUT
      Deprecated, for removal: This API element is subject to removal in a future version.
      Connect timeout used when "gxhttp.connectTimeout" is not set, in milliseconds.
      See Also:
    • DEFAULT_READ_TIMEOUT

      public static final int DEFAULT_READ_TIMEOUT
      Deprecated, for removal: This API element is subject to removal in a future version.
      Read timeout used when "gxhttp.readTimeout" is not set, in milliseconds.
      See Also:
    • address

      protected final String address
      Deprecated, for removal: This API element is subject to removal in a future version.
      The address of the remote service.
  • Constructor Details

    • GXConnection

      public GXConnection(String address)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new connection.
      Parameters:
      address - the address of the remote service
  • Method Details

    • getDefaultConnectTimeout

      public static int getDefaultConnectTimeout()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the default connect timeout: "gxhttp.connectTimeout" when set, otherwise 30000.
      Returns:
      the timeout in milliseconds; 0 means infinite
    • getDefaultReadTimeout

      public static int getDefaultReadTimeout()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the default read timeout: "gxhttp.readTimeout" when set, otherwise 300000.
      Returns:
      the timeout in milliseconds; 0 means infinite
    • addPath

      protected void addPath(String pathPart) throws UnsupportedEncodingException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adds a path part to the connection.
      Parameters:
      pathPart - the path part to add
      Throws:
      UnsupportedEncodingException - never, kept for compatibility
    • send

      Deprecated, for removal: This API element is subject to removal in a future version.
      Sends the request with the given method
      Parameters:
      method - the HTTP method
      Returns:
      the connection
      Throws:
      GXResponseException - if the request was sent but no response status was received: the server may have processed it
      Exception - if an error occurs before the request reaches the server
    • setAgent

      protected void setAgent(String agent)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the agent for the connection.
      Parameters:
      agent - the agent
    • setPathParameters

      public void setPathParameters(String parameters)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the path parameters for the connection.
      Parameters:
      parameters - the parameters
    • setQueryParameters

      public void setQueryParameters(String parameters)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the query parameters for the connection.
      Parameters:
      parameters - the parameters
    • reset

      public void reset()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Resets the connection.
    • addBody

      public void addBody(String body)
      Deprecated, for removal: This API element is subject to removal in a future version.
      The body of the request.
      Parameters:
      body - the body
    • addBodyAsStream

      public void addBodyAsStream(InputStream bodyAsStream)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      bodyAsStream - the stream to set as input
    • setProperty

      public void setProperty(String name, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adds a property as header.
      Parameters:
      name - the name of the property
      value - the value of the property
    • setConnectTimeout

      public void setConnectTimeout(int connectTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the connect timeout of this connection.
      Parameters:
      connectTimeout - the timeout in milliseconds; 0 means infinite
    • setReadTimeout

      public void setReadTimeout(int readTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the read timeout of this connection.
      Parameters:
      readTimeout - the timeout in milliseconds; 0 means infinite