Class HttpConnection

  • All Implemented Interfaces:
    AutoCloseable, Connection

    public class HttpConnection
    extends Object
    implements Connection
    This class is the HTTP implementation of the connection contract. Refrain from using it directly, as backwards compatibility isn't guaranteed, use the ConnectionBuilder class instead.
    • Constructor Detail

      • HttpConnection

        public HttpConnection()
    • Method Detail

      • setClient

        public void setClient​(HttpClient client)
      • getUrl

        public String getUrl()
      • setUrl

        public void setUrl​(String url)
      • setUser

        public void setUser​(String user)
      • setPassword

        public void setPassword​(String password)
      • getSsoUrl

        public String getSsoUrl()
      • setSsoUrl

        public void setSsoUrl​(String ssoUrl)
      • getSsoTokenName

        public String getSsoTokenName()
      • setSsoTokenName

        public void setSsoTokenName​(String ssoTokenName)
      • setKerberos

        public void setKerberos​(boolean kerberos)
      • getSsoRevokeUrl

        public String getSsoRevokeUrl()
      • setSsoRevokeUrl

        public void setSsoRevokeUrl​(String ssoRevokeUrl)
      • setSsoToken

        public void setSsoToken​(String ssoToken)
      • isLink

        public boolean isLink​(Object object)
        Description copied from interface: Connection
        Indicates if the given object is a link. An object is a link if it has an `href` attribute.
        Specified by:
        isLink in interface Connection
        Parameters:
        object - the object to check
        Returns:
        true iff the object is a link
      • followLink

        public <TYPE> TYPE followLink​(TYPE object)
        Description copied from interface: Connection
        Follows the `href` attribute of the given object, retrieves the target object and returns it.
        Specified by:
        followLink in interface Connection
        Type Parameters:
        TYPE - the type of the target of the link
        Parameters:
        object - the object containing the `href` attribute
        Returns:
        the object retrieved from the `href`
      • close

        public void close​(boolean logout)
                   throws Exception
        Description copied from interface: Connection
        Releases the resources used by this connection.
        Specified by:
        close in interface Connection
        Parameters:
        logout - A boolean, which specify if token should be revoked, and so user should be logged out.
        Throws:
        Exception
      • validate

        public boolean validate()
        Description copied from interface: Connection
        Validate the connection by making a trivial request and checking that the result is not null
        Specified by:
        validate in interface Connection
        Returns:
        true if the connection is valid, false otherwise
      • send

        public org.apache.http.HttpResponse send​(org.apache.http.client.methods.HttpUriRequest request)
      • authenticate

        public String authenticate()
        Description copied from interface: Connection
        Return token which can be used for authentication instead of credentials. It will be created, if it not exists, yet. By default the token will be revoked when the connection is closed, unless the `logout` parameter of the `close` method is `false`.
        Specified by:
        authenticate in interface Connection