Package com.verisign.epp.interfaces
Class EPPHttpSession
java.lang.Object
com.verisign.epp.interfaces.EPPSession
com.verisign.epp.interfaces.EPPHttpSession
- Direct Known Subclasses:
EPPPooledGenericHttpSession
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
ConstructorsConstructorDescriptionContact anEPPHttpSessioninstance using the URL defined in the "EPP.ServerURL" configuration property.EPPHttpSession(String aUrl) Construct anEPPHttpSessioninstance that points to the given URL.EPPHttpSession(String aUrl, EPPSSLContext aSSLContext) Construct anEPPHttpSessioninstance that points to the given URL and anEPPSSLContext. -
Method Summary
Modifier and TypeMethodDescriptionvoidEnd theEPPHttpSession.voidEnds a session by logging out from the server and closing the connection with the server.Gets the EPP Greeting received when making the connection.Gets theHttpClientinstance.static HttpClient.VersionReturns the HTTP version to use, with the default being HTTP/2 withHttpClient.Version.HTTP_2.getUrl()Gets the server URL to connect to.hello()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.postMessage(EPPMessage aMessage) Send the message in an HTTP POST method.processDocument(EPPCommand aCommand, Class aExpectedResponse) Process anEPPCommandinstance posting the command and processing the response.A no-op for the EPPHttpSession implementation.voidsendDocument(Document aDocument, EPPMessage aMessage) A no-op for the EPPHttpSession implementation.sendPoll()This method creates an instance ofEPPPollCmdand sets the given attributes and invokes the send method associated with the command.voidsetHttpClient(HttpClient aHttpClient) Sets theHttpClientinstance.voidSets the server URL to connect to.Methods inherited from class com.verisign.epp.interfaces.EPPSession
addExtensionService, addService, getClientCon, getClientID, getConnection, getExtensionServices, getInputStream, getLoginAdapter, getMode, getMsgID, getNewPassword, getOutputStream, getPassword, getPollOp, getResponse, getServices, getTransId, getVersion, init, init, initLoginAdapter, initSession, initSession, initStreams, login, processDocument, processGreeting, readResponse, sendMessage, sendPacket, setClientID, setExtensions, setExtensionServices, setInputStream, setLang, setLang, setLoginAdapter, setMode, setMsgID, setNewPassword, setOutputStream, setPassword, setPollOp, setServices, setServices, setTransId, setVersion, validateClientTransId
-
Constructor Details
-
EPPHttpSession
Construct 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
Construct 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
Contact anEPPHttpSessioninstance using the URL defined in the "EPP.ServerURL" configuration property.- Throws:
EPPCommandException- Error initializing theEPPHttpSession
-
-
Method Details
-
init
Helper method called by constructor to perform any initialization required for theEPPHttpSessionclass.- Overrides:
initin classEPPSession- Throws:
EPPCommandException- if something goes wrong
-
getHttpClient
Gets theHttpClientinstance.- Returns:
- the
HttpClientinstance if set;nullotherwise.
-
setHttpClient
Sets theHttpClientinstance.- Parameters:
aHttpClient- TheHttpClientinstance. Setting tonullwill not apply.
-
postMessage
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
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
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
Ends a session by logging out from the server and closing the connection with the server.- Overrides:
endSessionin classEPPSession- Throws:
EPPCommandException- Error ending session
-
endConnection
End theEPPHttpSession.- Overrides:
endConnectionin classEPPSession- Throws:
EPPCommandException- Error ending theEPPHttpSession. todo Explicitly close the underlying HttpClient once using Java 21 and above.
-
login
Sends 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
Sends 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, 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
A 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
A no-op for the EPPHttpSession implementation.- Overrides:
recDocumentin classEPPSession- Returns:
- Document received
- Throws:
EPPCommandException- Error receiving the document
-
getHttpVersion
Returns 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
Gets the server URL to connect to.- Returns:
- Gets the server URL to connection to if set;
nullotherwise.
-
setUrl
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
Gets the EPP Greeting received when making the connection.- Returns:
- The EPP Greeting if set;
nullotherwise.
-