Package net.webpdf.wsclient.session.rest
Class AbstractRestSession<T_REST_DOCUMENT extends RestDocument>
- java.lang.Object
-
- net.webpdf.wsclient.session.AbstractSession
-
- net.webpdf.wsclient.session.rest.AbstractRestSession<T_REST_DOCUMENT>
-
- Type Parameters:
T_REST_DOCUMENT- TheRestDocumenttype used by thisRestSession.
- All Implemented Interfaces:
AutoCloseable,RestSession<T_REST_DOCUMENT>,Session
- Direct Known Subclasses:
RestWebServiceSession
public abstract class AbstractRestSession<T_REST_DOCUMENT extends RestDocument> extends AbstractSession implements RestSession<T_REST_DOCUMENT>
An instance of
AbstractRestSessionestablishes and manages aWebServiceProtocol.RESTconnection with a webPDF server.Information: A
RestSessionprovides simplified access to the uploadedRestDocuments via aDocumentManager.
-
-
Constructor Summary
Constructors Constructor Description AbstractRestSession(@NotNull SessionContext serverContext, @NotNull AuthProvider authProvider)Creates a newAbstractRestSessioninstance providing connection information, authorization objects and aDocumentManagerfor a webPDF server-clientRestSession.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Close theRestSession.protected abstract @NotNull AdministrationManager<T_REST_DOCUMENT>createAdministrationManager()Creates a newAdministrationManagermatching thisRestSession.protected abstract @NotNull DocumentManager<T_REST_DOCUMENT>createDocumentManager()Creates a newDocumentManagermatching thisRestSession.@NotNull AdministrationManager<T_REST_DOCUMENT>getAdministrationManager()Returns the activeAdministrationManagerof thisRestSession.@Nullable AuthUserCertificatesgetCertificates()Returns theAuthUserCertificatesof the currently logged-in user of thisRestSession.@NotNull DocumentManager<T_REST_DOCUMENT>getDocumentManager()Returns the activeDocumentManagerof thisRestSession.@NotNull org.apache.hc.client5.http.impl.classic.CloseableHttpClientgetHttpClient()Returns theCloseableHttpClientconnected to the webPDF server via thisRestSession.@Nullable AuthUserCredentialsgetUser()Returns theAuthUserCredentialslogged in via thisRestSession.@Nullable AuthUserCertificatesupdateCertificates(String keystoreName, KeyStorePassword keyStorePassword)Updates theKeyStorePasswords for specific keystore and returns theAuthUserCertificatesfor the currently logged-in user afterward.-
Methods inherited from class net.webpdf.wsclient.session.AbstractSession
getAuthProvider, getSessionContext, getURI, getURI, getWebServiceProtocol
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.webpdf.wsclient.session.rest.RestSession
createWebServiceInstance, uploadDocument, uploadDocument
-
Methods inherited from interface net.webpdf.wsclient.session.Session
getAuthProvider, getSessionContext, getURI, getURI, getWebServiceProtocol
-
-
-
-
Constructor Detail
-
AbstractRestSession
public AbstractRestSession(@NotNull @NotNull SessionContext serverContext, @NotNull @NotNull AuthProvider authProvider) throws ResultExceptionCreates a new
AbstractRestSessioninstance providing connection information, authorization objects and aDocumentManagerfor a webPDF server-clientRestSession.Be Aware: Neither
SessionContext, norAuthProviderare required to serve multipleSessions at a time. It is expected to create a newSessionContextandAuthProviderperSessionyou create.- Parameters:
serverContext- TheSessionContextinitializing theSessionContextSettingsof thisRestSession.authProvider- TheAuthProviderfor authentication/authorization of thisRestSession.- Throws:
ResultException- Shall be thrown, in case establishing theRestSessionfailed.
-
-
Method Detail
-
getHttpClient
@NotNull public @NotNull org.apache.hc.client5.http.impl.classic.CloseableHttpClient getHttpClient()
Returns theCloseableHttpClientconnected to the webPDF server via thisRestSession.- Specified by:
getHttpClientin interfaceRestSession<T_REST_DOCUMENT extends RestDocument>- Returns:
- The
CloseableHttpClientconnected to the webPDF server via thisRestSession.
-
getDocumentManager
@NotNull public @NotNull DocumentManager<T_REST_DOCUMENT> getDocumentManager()
Returns the activeDocumentManagerof thisRestSession.- Specified by:
getDocumentManagerin interfaceRestSession<T_REST_DOCUMENT extends RestDocument>- Returns:
- The active
DocumentManagerof thisRestSession.
-
getAdministrationManager
@NotNull public @NotNull AdministrationManager<T_REST_DOCUMENT> getAdministrationManager()
Returns the activeAdministrationManagerof thisRestSession.- Specified by:
getAdministrationManagerin interfaceRestSession<T_REST_DOCUMENT extends RestDocument>- Returns:
- The active
AdministrationManagerof thisRestSession.
-
getUser
@Nullable public @Nullable AuthUserCredentials getUser()
Returns theAuthUserCredentialslogged in via thisRestSession.- Specified by:
getUserin interfaceRestSession<T_REST_DOCUMENT extends RestDocument>- Returns:
- The
AuthUserCredentialslogged in via thisRestSession.
-
getCertificates
@Nullable public @Nullable AuthUserCertificates getCertificates()
Returns theAuthUserCertificatesof the currently logged-in user of thisRestSession.- Specified by:
getCertificatesin interfaceRestSession<T_REST_DOCUMENT extends RestDocument>- Returns:
- The
AuthUserCertificatesof the currently logged-in user of thisRestSession.
-
updateCertificates
@Nullable public @Nullable AuthUserCertificates updateCertificates(String keystoreName, KeyStorePassword keyStorePassword) throws ResultException
Updates theKeyStorePasswords for specific keystore and returns theAuthUserCertificatesfor the currently logged-in user afterward.- Specified by:
updateCertificatesin interfaceRestSession<T_REST_DOCUMENT extends RestDocument>- Parameters:
keystoreName- The name of the keystore to be updated.keyStorePassword- TheKeyStorePasswordto unlock the certificates with.- Returns:
- The
AuthUserCertificatesof the logged-in user in thisRestSession. - Throws:
ResultException- Shall be thrown, if the request failed.
-
close
public void close() throws ResultExceptionClose theRestSession.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSession- Throws:
ResultException- Shall be thrown, if closing theRestSessionfailed.
-
createDocumentManager
@NotNull protected abstract @NotNull DocumentManager<T_REST_DOCUMENT> createDocumentManager()
Creates a newDocumentManagermatching thisRestSession.- Returns:
- The created
DocumentManager.
-
createAdministrationManager
@NotNull protected abstract @NotNull AdministrationManager<T_REST_DOCUMENT> createAdministrationManager()
Creates a newAdministrationManagermatching thisRestSession.- Returns:
- The created
AdministrationManager.
-
-