Package com.verisign.epp.interfaces
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.
-
-
Field Summary
-
Fields inherited from class com.verisign.epp.interfaces.EPPSession
clientId, codec, connection, extensionServices, inputStream, language, loginAdapter, message, mode, MODE_ASYNC, MODE_SYNC, msgID, newPassword, OP_ACK, OP_REQ, outputStream, password, pollOp, response, services, transId, version
-
-
Constructor Summary
Constructors Constructor Description EPPHttpSession()Contact anEPPHttpSessioninstance using the URL defined in the "EPP.ServerURL" configuration property.EPPHttpSession(java.lang.String aUrl)Construct anEPPHttpSessioninstance that points to the given URL.EPPHttpSession(java.lang.String aUrl, EPPSSLContext aSSLContext)Construct anEPPHttpSessioninstance that points to the given URL and anEPPSSLContext.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendConnection()End theEPPHttpSession.voidendSession()Ends a session by logging out from the server and closing the connection with the server.EPPGreetinggetGreeting()Gets the EPP Greeting received when making the connection.java.net.http.HttpClientgetHttpClient()Gets theHttpClientinstance.static java.net.http.HttpClient.VersiongetHttpVersion()Returns the HTTP version to use, with the default being HTTP/2 withHttpClient.Version.HTTP_2.java.lang.StringgetUrl()Gets the server URL to connect to.EPPGreetinghello()Sends a Hello Command to the EPP Server.voidinit()Helper method called by constructor to perform any initialization required for theEPPHttpSessionclass.booleanisModeSupported(int aMode)Does the session support the specified modeEPPSession.MODE_SYNCorEPPSession.MODE_ASYNC?EPPHttpSessiononly supportsEPPSession.MODE_SYNC.protected voidlogin()Sends the EPP login command over the HTTP connection to establish an EPP session.protected voidlogout()Sends the EPP logout command over the HTTP connection to gracefully end EPP session.EPPMessagepostMessage(EPPMessage aMessage)Send the message in an HTTP POST method.EPPResponseprocessDocument(EPPCommand aCommand, java.lang.Class aExpectedResponse)Process anEPPCommandinstance posting the command and processing the response.org.w3c.dom.DocumentrecDocument()A no-op for the EPPHttpSession implementation.voidsendDocument(org.w3c.dom.Document aDocument, EPPMessage aMessage)A no-op for the EPPHttpSession implementation.EPPResponsesendPoll()This method creates an instance ofEPPPollCmdand sets the given attributes and invokes the send method associated with the command.voidsetHttpClient(java.net.http.HttpClient aHttpClient)Sets theHttpClientinstance.voidsetUrl(java.lang.String aUrl)Sets the server URL to connect to.-
Methods inherited from class com.verisign.epp.interfaces.EPPSession
getClientCon, getClientID, getConnection, getInputStream, getLoginAdapter, getMode, getMsgID, getNewPassword, getOutputStream, getPassword, getPollOp, getResponse, getTransId, getVersion, init, init, initLoginAdapter, initSession, initSession, initStreams, login, processDocument, processGreeting, readResponse, sendMessage, sendPacket, setClientID, setExtensions, setInputStream, setLang, setLang, setLoginAdapter, setMode, setMsgID, setNewPassword, setOutputStream, setPassword, setPollOp, setServices, setTransId, setVersion, validateClientTransId
-
-
-
-
Constructor Detail
-
EPPHttpSession
public EPPHttpSession(java.lang.String aUrl) throws EPPCommandExceptionConstruct anEPPHttpSessioninstance that points to the given URL. An example ishttps://test.vgrs.com:8080/.- Parameters:
aUrl- URL to connect to- Throws:
EPPCommandException- Error initializing the session
-
EPPHttpSession
public EPPHttpSession(java.lang.String aUrl, EPPSSLContext aSSLContext) throws EPPCommandExceptionConstruct anEPPHttpSessioninstance that points to the given URL and anEPPSSLContext. An example ishttps://test.vgrs.com:8080/.- Parameters:
aUrl- URL to connect toaSSLContext- Optional specific SSL context to use. Set tonullif undefined.- Throws:
EPPCommandException- Error initializing the session
-
EPPHttpSession
public EPPHttpSession() throws EPPCommandExceptionContact anEPPHttpSessioninstance using the URL defined in the "EPP.ServerURL" configuration property.- Throws:
EPPCommandException- Error initializing theEPPHttpSession
-
-
Method Detail
-
init
public void init() throws EPPCommandExceptionHelper method called by constructor to perform any initialization required for theEPPHttpSessionclass.- Overrides:
initin classEPPSession- Throws:
EPPCommandException- if something goes wrong
-
getHttpClient
public java.net.http.HttpClient getHttpClient()
Gets theHttpClientinstance.- Returns:
- the
HttpClientinstance if set;nullotherwise.
-
setHttpClient
public void setHttpClient(java.net.http.HttpClient aHttpClient)
Sets theHttpClientinstance.- Parameters:
aHttpClient- TheHttpClientinstance. Setting tonullwill 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
EPPGreetingor anEPPResponse. - Throws:
EPPCommandException- Error posting theaXml
-
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:
helloin classEPPSession- Returns:
- EPP Greeting
- Throws:
EPPCommandException- Thrown if any exception occurs.
-
sendPoll
public EPPResponse sendPoll() throws EPPCommandException
This method creates an instance ofEPPPollCmdand sets the given attributes and invokes the send method associated with the command.- Overrides:
sendPollin classEPPSession- Returns:
- the response from the poll command
- Throws:
EPPCommandException- Error sending the poll command
-
endSession
public void endSession() throws EPPCommandExceptionEnds a session by logging out from the server and closing the connection with the server.- Overrides:
endSessionin classEPPSession- Throws:
EPPCommandException- Error ending session
-
endConnection
public void endConnection() throws EPPCommandExceptionEnd theEPPHttpSession.- Overrides:
endConnectionin classEPPSession- Throws:
EPPCommandException- Error ending theEPPHttpSession. todo Explicitly close the underlying HttpClient once using Java 21 and above.
-
login
protected void login() throws EPPCommandExceptionSends the EPP login command over the HTTP connection to establish an EPP session.- Overrides:
loginin classEPPSession- Throws:
EPPCommandException- Error sending the EPP login command
-
logout
protected void logout() throws EPPCommandExceptionSends the EPP logout command over the HTTP connection to gracefully end EPP session.- Overrides:
logoutin classEPPSession- Throws:
EPPCommandException- Error sending the EPP login command
-
processDocument
public EPPResponse processDocument(EPPCommand aCommand, java.lang.Class aExpectedResponse) throws EPPCommandException
Process anEPPCommandinstance posting the command and processing the response. The only mode supported isEPPSession.MODE_SYNC.- Overrides:
processDocumentin classEPPSession- Parameters:
aCommand- Command to post to the serveraExpectedResponse- Expected type ofEPPResponse. IfaExpectedResponseis non-nulland the response is not of the specified type, than anEPPCommandExceptionwill 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 anEPPResponsethan it was a server specified error.
-
sendDocument
public void sendDocument(org.w3c.dom.Document aDocument, EPPMessage aMessage) throws EPPCommandExceptionA no-op for the EPPHttpSession implementation.- Overrides:
sendDocumentin classEPPSession- Parameters:
aDocument- Document to sendaMessage- Message associated withnewDocthat is used for packet logging logic. Set tonullif unavailable.- Throws:
EPPCommandException- Error processing the command
-
recDocument
public org.w3c.dom.Document recDocument() throws EPPCommandExceptionA no-op for the EPPHttpSession implementation.- Overrides:
recDocumentin classEPPSession- Returns:
- Document received
- Throws:
EPPCommandException- Error receiving the document
-
getHttpVersion
public static java.net.http.HttpClient.Version getHttpVersion() throws EPPEnvExceptionReturns the HTTP version to use, with the default being HTTP/2 withHttpClient.Version.HTTP_2.- Returns:
HTTPClient.Versionvalue- Throws:
EPPEnvException- The "EPP.ServerName" property does not exist.
-
getUrl
public java.lang.String getUrl()
Gets the server URL to connect to.- Returns:
- Gets the server URL to connection to if set;
nullotherwise.
-
setUrl
public void setUrl(java.lang.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 modeEPPSession.MODE_SYNCorEPPSession.MODE_ASYNC?EPPHttpSessiononly supportsEPPSession.MODE_SYNC.- Overrides:
isModeSupportedin classEPPSession- Parameters:
aMode-EPPSession.MODE_SYNCorEPPSession.MODE_ASYNC- Returns:
trueif supported;falseotherwise.
-
getGreeting
public EPPGreeting getGreeting()
Gets the EPP Greeting received when making the connection.- Returns:
- The EPP Greeting if set;
nullotherwise.
-
-