Class WebUtil

java.lang.Object
cl.netswitch.lib.util.WebUtil

public final class WebUtil extends Object
Provides static utility methods used to configure Web Services.
  • Method Details

    • initWebServicePort

      public static void initWebServicePort(Object webPort, String endpoint, int connectTimeout, int requestTimeout, File trustStore) throws Exception
      Initializes properties of a Web Service Port. This method must be called before webPort is used for the first time. The supplied webPort object must implement the BindingProvider interface.

      Argument trustStore provides the path to a JKS file containing the certificates of trusted Certificate Authorities (CA). If trustStore is null, the standard Java "cacerts" file is used instead.

      Parameters:
      webPort - the Web Service Port to be initialized.
      endpoint - the endpoint address of the Web Service Port.
      connectTimeout - max time to wait for connect (millisecs).
      requestTimeout - max time to wait for request (millisecs).
      trustStore - the file with trusted certificates (can be null).
      Throws:
      NullPointerException - if an argument is null.
      IllegalArgumentException - if webPort is invalid.
      Exception - if another error occurs during the initialization.
    • initHttpsConnection

      public static void initHttpsConnection(HttpURLConnection httpConn, File trustStore) throws Exception
      Initializes the security properties of a HttpsURLConnection. This method must be called before httpConn is used for the first time. Nothing is done if the supplied httpConn does not implement HttpsURLConnection.

      Argument trustStore provides the path to a JKS file containing the certificates of trusted Certificate Authorities (CA). If trustStore is null, the standard Java "cacerts" file is used instead.

      Parameters:
      httpConn - the HttpsURLConnection to be initialized.
      trustStore - the file with trusted certificates (can be null).
      Throws:
      NullPointerException - if httpConn is null.
      Exception - if another error occurs during the initialization.