Class EmbdServContHTTPService
java.lang.Object
de.aristaflow.adept2.base.service.AbstractADEPT2Service
de.aristaflow.adept2.base.service.AbstractAuthenticatedService
de.aristaflow.adept2.ui.htmlgui.httpservice.EmbdServContHTTPService
- All Implemented Interfaces:
ADEPT2Service,AuthenticatingService,LogService,ServiceThreadHandling,HTTPService
Simple HTTP service based on a
ServletService (an embedded servlet
container). This delegates to the AristaFlowHTTPService-servlet
implementingdoGet and doPost-methods.- Author:
- Kevin Goeser, Ulrich Kreher
-
Nested Class Summary
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
AbstractADEPT2Service.ActiveSessions -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AristaFlowHTTPServiceThe HTTP service (servlet) handling the requests.protected static final StringThe hierarchical context of the servlet.protected static final StringThe name used for the publishing the servlet, that is as servlet name.Fields inherited from class de.aristaflow.adept2.base.service.AbstractAuthenticatedService
CFG_EARLY_SERVICEAUTH_ORGPOSID, CFG_EARLY_SERVICEAUTH_ORGPOSNAME, CFG_EARLY_SERVICEAUTH_PASSWORD, CFG_EARLY_SERVICEAUTH_USERNAME, CFG_SERVICEAUTH_ORGPOSID, CFG_SERVICEAUTH_ORGPOSNAME, CFG_SERVICEAUTH_PASSWORD, CFG_SERVICEAUTH_USERNAMEFields inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices -
Constructor Summary
ConstructorsConstructorDescriptionEmbdServContHTTPService(Configuration configuration, Registry registry) Registers the HTTP-service-servlet at an embedded servlet container. -
Method Summary
Modifier and TypeMethodDescriptionvoidderegisterReplyHandler(SessionToken session, String sessionID) Deregisters a reply handler for the activity with the designatedsessionID.booleanisActive()Allows waiting reply handlers to retrieve the state of the HTTP-service.voidregisterReplyHandler(SessionToken session, String sessionID, HTTPReplyHandler replayHandler) Registers a reply handler for the activity with the designatedsessionID.voidshutdown(boolean emergency) Removes the HTTP-service-servlet from theServletService.voidstart()Adds the HTTP-service-servlet to theServletService.Methods inherited from class de.aristaflow.adept2.base.service.AbstractAuthenticatedService
_sessionActive, authenticateService, awaitActiveSessions, createChildSession, createSession, getAgent, getSecurityManager, getSessionFactory, getStartupRequired, getTopLevelAgent, getUserCredentials, globalSecurityManagerAvailable, init, isEarlyService, sessionHasAllCapabilities, sessionHasAllTopLevelCapabilities, sessionHasOneCapability, sessionHasOneTopLevelCapabilityMethods inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
_sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, signalShutdown, signalStart, unprivilegeThreadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown
-
Field Details
-
WEB_APP_NAME
The name used for the publishing the servlet, that is as servlet name.- See Also:
-
WEB_APP_CONTEXT
The hierarchical context of the servlet.- See Also:
-
httpService
The HTTP service (servlet) handling the requests.
-
-
Constructor Details
-
EmbdServContHTTPService
public EmbdServContHTTPService(Configuration configuration, Registry registry) throws ConfigurationException Registers the HTTP-service-servlet at an embedded servlet container.- Parameters:
configuration- The configuration providing the user credentials for this service.registry- The registry for accessing the servlet services.- Throws:
ConfigurationException- If there are problems parsing the user credentials from the configuration, aConfigurationExceptionwill be thrown.
-
-
Method Details
-
registerReplyHandler
public void registerReplyHandler(SessionToken session, String sessionID, HTTPReplyHandler replayHandler) throws MalformedURLException Description copied from interface:HTTPServiceRegisters a reply handler for the activity with the designatedsessionID. This creates an own URL for the reply handler. It will be called as soon as a HTTP-request (the reply for the activity) is received by this HTTP-service.- Specified by:
registerReplyHandlerin interfaceHTTPService- Parameters:
session- The session which is used to check for access rights on this method.sessionID- The session ID for the executed activity. It is used to create an appropriate URL.replayHandler- The handler for the HTTP-replies sent to this service.- Throws:
MalformedURLException- If the designated sessionID does not allow to create a valid URL, aMalformedURLExceptionwill be thrown.
-
deregisterReplyHandler
Description copied from interface:HTTPServiceDeregisters a reply handler for the activity with the designatedsessionID. A reply handler may be deregistered any time. In case a reply handling is currently running, it will be allowed to finish.- Specified by:
deregisterReplyHandlerin interfaceHTTPService- Parameters:
session- The session which is used to check for access rights on this method.sessionID- The session ID identifying the executed activity and therefore also the handler for the reply sent via HTTP.
-
start
Adds the HTTP-service-servlet to theServletService.- Specified by:
startin interfaceADEPT2Service- Overrides:
startin classAbstractADEPT2Service- Throws:
AbortServiceException- If the base URL (servlet URL having the URL-pattern appended) cannot be created, anAbortServiceExceptionwill be thrown.ServiceNotKnownException- If the servlet container cannot be retrieved from the registry, aServiceNotKnownExceptionwill be thrown.
-
shutdown
public void shutdown(boolean emergency) Removes the HTTP-service-servlet from theServletService.- Specified by:
shutdownin interfaceADEPT2Service- Overrides:
shutdownin classAbstractAuthenticatedService- Parameters:
emergency- Whether the shutdown will be an emergency shutdown.
-
isActive
public boolean isActive()Allows waiting reply handlers to retrieve the state of the HTTP-service. Please note that this method blocks when starting until the service is started.- Overrides:
isActivein classAbstractADEPT2Service- Returns:
- Whether this service is active, that is started and not shut down.
-