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
public class EmbdServContHTTPService extends AbstractAuthenticatedService implements HTTPService
Simple HTTP service based on aServletService(an embedded servlet container). This delegates to theAristaFlowHTTPService-servlet implementingdoGetanddoPost-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
Fields Modifier and Type Field Description protected AristaFlowHTTPServicehttpServiceThe HTTP service (servlet) handling the requests.protected static StringWEB_APP_CONTEXTThe hierarchical context of the servlet.protected static StringWEB_APP_NAMEThe 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_USERNAME
-
Fields inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices
-
-
Constructor Summary
Constructors Constructor Description EmbdServContHTTPService(org.apache.commons.configuration2.Configuration configuration, Registry registry)Registers the HTTP-service-servlet at an embedded servlet container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidderegisterReplyHandler(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, sessionHasCapability, sessionHasOneCapability, sessionHasOneTopLevelCapability
-
Methods 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, unprivilegeThread
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown
-
-
-
-
Field Detail
-
WEB_APP_NAME
protected static final String WEB_APP_NAME
The name used for the publishing the servlet, that is as servlet name.- See Also:
- Constant Field Values
-
WEB_APP_CONTEXT
protected static final String WEB_APP_CONTEXT
The hierarchical context of the servlet.- See Also:
- Constant Field Values
-
httpService
protected final AristaFlowHTTPService httpService
The HTTP service (servlet) handling the requests.
-
-
Constructor Detail
-
EmbdServContHTTPService
public EmbdServContHTTPService(org.apache.commons.configuration2.Configuration configuration, Registry registry) throws ConfigurationExceptionRegisters 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 Detail
-
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
public void deregisterReplyHandler(SessionToken session, String sessionID)
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
public void start() throws AbortServiceExceptionAdds 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.
-
-