Class HTTPClientConnector

  • All Implemented Interfaces:
    ConnectorInterface, VersionInfoInterface

    public class HTTPClientConnector
    extends Connector
    HTTPCLientConnector provides a client side HTTP connection where the user can use it in Iterator, Lookup and AddOnly mode. A parser may be specified in which case the contents sent/received on the HTTP connection is parsed. If no parser is specified then all data is conveyed through the entry object. All HTTP headers from the server is entered as is prefixing their names with "http.". The "body" attribute contains the result from the server and also provides the data to be submitted to the server if no parser is specified.
    • Field Detail

      • CONNECTOR_MODES

        public static final java.lang.String[] CONNECTOR_MODES
        Supported modes
      • VERSION_INFO

        public static final java.lang.String VERSION_INFO
        Version info
        See Also:
        Constant Field Values
      • PARAM_TIMEOUT

        public static final java.lang.String PARAM_TIMEOUT
        Parameter Name: "timeout"
        See Also:
        Constant Field Values
    • Constructor Detail

      • HTTPClientConnector

        public HTTPClientConnector()
        Constructor
    • Method Detail

      • terminate

        public void terminate()
                       throws java.lang.Exception
        This function is called when the connector is no longer needed by the user (AssemblyLine or script).
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • initialize

        public void initialize​(java.lang.Object o)
                        throws java.lang.Exception
        This function is called once after the connector configuration file has been provided by the caller.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        o - User provided parameter
        Throws:
        java.lang.Exception - if the initialization of this connector fails.
      • selectEntries

        public void selectEntries()
                           throws java.lang.Exception
        This function is called when the connector operates in Iterator mode inside an AssemblyLine.
        Specified by:
        selectEntries in interface ConnectorInterface
        Overrides:
        selectEntries in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • getNextEntry

        public Entry getNextEntry()
                           throws java.lang.Exception
        This function is called to retrieve the next Entry from the connector. When there are no more entries to retrieve the function should return a null value indicating a logical end of file. If the connector has no parser this will never happen since we always make a HTTP connection every time getNextEntry is called.
        Specified by:
        getNextEntry in interface ConnectorInterface
        Overrides:
        getNextEntry in class Connector
        Returns:
        - the next Entry, or null if no more data
        Throws:
        java.lang.Exception - if an error occurs.
        See Also:
        ConnectorInterface.selectEntries()
      • putEntry

        public void putEntry​(Entry entry)
                      throws java.lang.Exception
        The putEntry function is called during AddOnly or Update operations.
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        entry - The entry data to add
        Throws:
        java.lang.Exception - if an error occurs.
      • queryReply

        public Entry queryReply​(Entry entry)
                         throws java.lang.Exception
        Performs a query/reply operations.
        Specified by:
        queryReply in interface ConnectorInterface
        Overrides:
        queryReply in class Connector
        Parameters:
        entry - The data used in outgoing call
        Returns:
        The entry returned by the HTTP server
        Throws:
        java.lang.Exception - if an error occurs.
      • findEntry

        public Entry findEntry​(SearchCriteria search)
                        throws java.lang.Exception
        The findEntry function is called during Lookup operations.
        Specified by:
        findEntry in interface ConnectorInterface
        Overrides:
        findEntry in class Connector
        Parameters:
        search - The search criteria used to locate the entry to be modified
        Returns:
        The entry found, or null if no or multiple entries found
        Throws:
        java.lang.Exception - if an error occurs.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Returns:
        version information
      • getClientCertificateAlias

        public java.lang.String getClientCertificateAlias()
      • setClientCertificateAlias

        public void setClientCertificateAlias​(java.lang.String clientCertificateAlias)
        Sets the Client Certificate that should be used when connection. Equivalent to setClientCertificateAlias(clientCertificateAlias, null, null, null)
        Parameters:
        clientCertificateAlias - - Name of the alias in the default keystore.
      • setClientCertificateAlias

        public void setClientCertificateAlias​(java.lang.String clientCertificateAlias,
                                              java.lang.String keyStorePath,
                                              java.lang.String keyStorePass,
                                              java.lang.String keyStoreType)
        Sets the Client Certificate that should be used when connection. If the alias is null, resets behavior to default Java behavior. If the alias is an empty string, do not send any certificate at all.
        Parameters:
        clientCertificateAlias - - Name of the alias in the key store.
        keyStorePath - - Path to key store. null means to use the javax.net.ssl.keyStore.
        keyStorePass - - Password for key store. null means javax.net.ssl.keyStorePassword.
        keyStoreType - - The key store type. null means javax.net.ssl.keyStoreType or default.