Class HttpClient


  • public final class HttpClient
    extends java.lang.Object
    HTTP client used for request/response communication.

    This HTTP client will try to communicate with one of the HTTP servers provided by target URL list.

    Since:
    7.1
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpClient​(Log log)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getAsInputStream()
      Requests the resource specified by the target URL list as an input stream.
      java.util.List<java.lang.String> getTargetUrlList()  
      java.lang.String post​(java.lang.String msg)
      Requests the resource specified by the target URL list.
      void setAuthenticationRequired​(boolean isRequired)
      Indicates if the authentication header containing the user's credentials should be sent.
      void setPassword​(java.lang.String pass)
      Defines the user's password.
      void setTargetUrlList​(java.util.List<java.lang.String> targetUrlList)
      Defines the list of HTTP server's target URLs to which resources will be requested.
      void setTimeout​(int timeout)
      Defines the timeout, in milliseconds.
      void setUserId​(java.lang.String userId)
      Defines the user's identification.
      void setXmlCharValidationEnabled​(boolean enabled)
      Defines if the response message should be validated against invalid XML characters.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HttpClient

        public HttpClient​(Log log)
    • Method Detail

      • setAuthenticationRequired

        public void setAuthenticationRequired​(boolean isRequired)
        Indicates if the authentication header containing the user's credentials should be sent.
        Parameters:
        isRequired - true if the authentication header should be sent, otherwise false
        See Also:
        setUserId(String), setPassword(String)
      • setPassword

        public void setPassword​(java.lang.String pass)
        Defines the user's password.
        Parameters:
        pass - user's password
      • setTargetUrlList

        public void setTargetUrlList​(java.util.List<java.lang.String> targetUrlList)
        Defines the list of HTTP server's target URLs to which resources will be requested.
        Parameters:
        targetUrlList - list of HTTP server's target URLs
      • getTargetUrlList

        public java.util.List<java.lang.String> getTargetUrlList()
      • setTimeout

        public void setTimeout​(int timeout)
        Defines the timeout, in milliseconds. This is used when communicating with the HTTP server. If the timeout expires before the connection can be established or before there is data available for read, a MxConnTimeoutException is raised. A timeout of zero is interpreted as infinite timeout.
        Parameters:
        timeout -
      • setUserId

        public void setUserId​(java.lang.String userId)
        Defines the user's identification.
        Parameters:
        userId - user's identification
      • setXmlCharValidationEnabled

        public void setXmlCharValidationEnabled​(boolean enabled)
        Defines if the response message should be validated against invalid XML characters. If enabled, all invalid characters will be removed from the request/response message.
        Parameters:
        enabled - true if the message should be validated against invalid XML characters, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object