Class EPPHttpSession

java.lang.Object
com.verisign.epp.interfaces.EPPSession
com.verisign.epp.interfaces.EPPHttpSession
Direct Known Subclasses:
EPPPooledGenericHttpSession

public class EPPHttpSession extends EPPSession
EPPHttpSession provides behavior for communicating with an EPP Server using the HTTP protocol as the transport.
  • Constructor Details

    • EPPHttpSession

      public EPPHttpSession(String aUrl) throws EPPCommandException
      Construct an EPPHttpSession instance that points to the given URL. An example is https://test.vgrs.com:8080/.
      Parameters:
      aUrl - URL to connect to
      Throws:
      EPPCommandException - Error initializing the session
    • EPPHttpSession

      public EPPHttpSession(String aUrl, EPPSSLContext aSSLContext) throws EPPCommandException
      Construct an EPPHttpSession instance that points to the given URL and an EPPSSLContext. An example is https://test.vgrs.com:8080/.
      Parameters:
      aUrl - URL to connect to
      aSSLContext - Optional specific SSL context to use. Set to null if undefined.
      Throws:
      EPPCommandException - Error initializing the session
    • EPPHttpSession

      public EPPHttpSession() throws EPPCommandException
      Contact an EPPHttpSession instance using the URL defined in the "EPP.ServerURL" configuration property.
      Throws:
      EPPCommandException - Error initializing the EPPHttpSession
  • Method Details

    • init

      public void init() throws EPPCommandException
      Helper method called by constructor to perform any initialization required for the EPPHttpSession class.
      Overrides:
      init in class EPPSession
      Throws:
      EPPCommandException - if something goes wrong
    • getHttpClient

      public HttpClient getHttpClient()
      Gets the HttpClient instance.
      Returns:
      the HttpClient instance if set; null otherwise.
    • setHttpClient

      public void setHttpClient(HttpClient aHttpClient)
      Sets the HttpClient instance.
      Parameters:
      aHttpClient - The HttpClient instance. Setting to null will not apply.
    • postMessage

      public EPPMessage postMessage(EPPMessage aMessage) throws EPPCommandException
      Send the message in an HTTP POST method.
      Parameters:
      aMessage - Message to send
      Returns:
      The EPP message returned, which could be an EPPGreeting or an EPPResponse.
      Throws:
      EPPCommandException - Error posting the aXml
    • hello

      public EPPGreeting hello() throws EPPCommandException
      Sends a Hello Command to the EPP Server. The EPP Greeting from the EPP Server will be returned.
      Overrides:
      hello in class EPPSession
      Returns:
      EPP Greeting
      Throws:
      EPPCommandException - Thrown if any exception occurs.
    • sendPoll

      public EPPResponse sendPoll() throws EPPCommandException
      This method creates an instance of EPPPollCmd and sets the given attributes and invokes the send method associated with the command.
      Overrides:
      sendPoll in class EPPSession
      Returns:
      the response from the poll command
      Throws:
      EPPCommandException - Error sending the poll command
    • endSession

      public void endSession() throws EPPCommandException
      Ends a session by logging out from the server and closing the connection with the server.
      Overrides:
      endSession in class EPPSession
      Throws:
      EPPCommandException - Error ending session
    • endConnection

      public void endConnection() throws EPPCommandException
      End the EPPHttpSession.
      Overrides:
      endConnection in class EPPSession
      Throws:
      EPPCommandException - Error ending the EPPHttpSession. todo Explicitly close the underlying HttpClient once using Java 21 and above.
    • login

      protected void login() throws EPPCommandException
      Sends the EPP login command over the HTTP connection to establish an EPP session.
      Overrides:
      login in class EPPSession
      Throws:
      EPPCommandException - Error sending the EPP login command
    • logout

      protected void logout() throws EPPCommandException
      Sends the EPP logout command over the HTTP connection to gracefully end EPP session.
      Overrides:
      logout in class EPPSession
      Throws:
      EPPCommandException - Error sending the EPP login command
    • processDocument

      public EPPResponse processDocument(EPPCommand aCommand, Class aExpectedResponse) throws EPPCommandException
      Process an EPPCommand instance posting the command and processing the response. The only mode supported is EPPSession.MODE_SYNC.
      Overrides:
      processDocument in class EPPSession
      Parameters:
      aCommand - Command to post to the server
      aExpectedResponse - Expected type of EPPResponse. If aExpectedResponse is non-null and the response is not of the specified type, than an EPPCommandException will be thrown.
      Returns:
      Response associated with passed in command
      Throws:
      EPPCommandException - error processing the command. This can include an error specified from the server or encountered while attempting to process the command. If the exception contains an EPPResponse than it was a server specified error.
    • sendDocument

      public void sendDocument(Document aDocument, EPPMessage aMessage) throws EPPCommandException
      A no-op for the EPPHttpSession implementation.
      Overrides:
      sendDocument in class EPPSession
      Parameters:
      aDocument - Document to send
      aMessage - Message associated with newDoc that is used for packet logging logic. Set to null if unavailable.
      Throws:
      EPPCommandException - Error processing the command
    • recDocument

      public Document recDocument() throws EPPCommandException
      A no-op for the EPPHttpSession implementation.
      Overrides:
      recDocument in class EPPSession
      Returns:
      Document received
      Throws:
      EPPCommandException - Error receiving the document
    • getHttpVersion

      public static HttpClient.Version getHttpVersion() throws EPPEnvException
      Returns the HTTP version to use, with the default being HTTP/2 with HttpClient.Version.HTTP_2.
      Returns:
      HTTPClient.Version value
      Throws:
      EPPEnvException - The "EPP.ServerName" property does not exist.
    • getUrl

      public String getUrl()
      Gets the server URL to connect to.
      Returns:
      Gets the server URL to connection to if set; null otherwise.
    • setUrl

      public void setUrl(String aUrl)
      Sets the server URL to connect to.
      Parameters:
      aUrl - Server URL to
    • isModeSupported

      public boolean isModeSupported(int aMode)
      Does the session support the specified mode EPPSession.MODE_SYNC or EPPSession.MODE_ASYNC? EPPHttpSession only supports EPPSession.MODE_SYNC.
      Overrides:
      isModeSupported in class EPPSession
      Parameters:
      aMode - EPPSession.MODE_SYNC or EPPSession.MODE_ASYNC
      Returns:
      true if supported; false otherwise.
    • getGreeting

      public EPPGreeting getGreeting()
      Gets the EPP Greeting received when making the connection.
      Returns:
      The EPP Greeting if set; null otherwise.