Package de.aristaflow.adept2.ui.htmlgui
Class RemoteHTMLContext
java.lang.Object
de.aristaflow.adept2.ui.htmlgui.AbstractHTMLContext
de.aristaflow.adept2.ui.htmlgui.RemoteHTMLContext
- All Implemented Interfaces:
GUIContext,HTMLContext,HTTPReplyHandler,URLContext,Closeable,Serializable,AutoCloseable
A simple
HTMLContext that does not create any browsers or alike
but just provides the interaction between webserver and
ExecutableComponent. Additionally, this context can be
serialised to allow for accessing the GUI (HTML) remotely. Since the event
handling of a normal HTMLContext prevents serialisation, only
the URL is serialised (by replacing this context with a
URLContext). This URL can then be called remotely while
the interaction between webserver and ExecutableComponent is
further handled by this context (instance).
Note that as stated above this context is not really serialisable. When
serialising it is replaced by a URLContext which implies that
only a URLContext can be deserialised.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.aristaflow.adept2.ui.htmlgui.AbstractHTMLContext
AbstractHTMLContext.HtmlContextCleanupTaskNested classes/interfaces inherited from interface de.aristaflow.adept2.ui.htmlgui.HTMLContext
HTMLContext.Attachment, HTMLContext.CloseIgnoringAttachment, HTMLContext.HTTPReply, HTMLContext.Response -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Cleanup<RuntimeException>The clean-up for closing the context and all related resources.protected final SessionTokenThe session token for deregistering at theHTTPService.protected TransferredURLContextThe context for transferring thisHTMLContextfor remote usage.Fields inherited from class de.aristaflow.adept2.ui.htmlgui.AbstractHTMLContext
baseURL, cleanup, DEFAULT_FINAL_RESPONSE, finalResponse, httpService, initialContentString, logger, relRes, replies, replyHandlerTerminated, responses, sessionID, thread -
Constructor Summary
ConstructorsConstructorDescriptionRemoteHTMLContext(Thread thread, SessionToken session, HTTPService httpService, String sessionId, ActivityInstance activityInstance, EBPInstanceReference activity, ExecutionContext executionContext) Creates a newHTMLContextfor handling the interaction between webserver andExecutableComponentand also to provide theURLto a client allowing to call theURLremotely. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the GUI for this context.getURL()Gets the URL of the (remote)HTMLContextwhich provides the GUI.voidsetBaseURL(URL baseURL, String resName) Sets the base URL on which the reply handler is reachable via HTTP and the corresponding resource name, i.protected ObjectCreates a newURLContextto replace thisRemoteHTMLContextwhen transferring to a client.Methods inherited from class de.aristaflow.adept2.ui.htmlgui.AbstractHTMLContext
checkForValidExecutorThread, close, getRelativeLink, getRelativeLink, getResponse, setFinalResponse, setFinalResponse, setInitialContent, setResponse, waitForHTTPReply
-
Field Details
-
session
The session token for deregistering at theHTTPService. This should be retrieved from the client service instead of reusing the registering token. -
urlContext
The context for transferring thisHTMLContextfor remote usage. Note that this will not have a URL untilsetBaseURL(URL, String)has been called. -
contextCleanup
The clean-up for closing the context and all related resources.
-
-
Constructor Details
-
RemoteHTMLContext
public RemoteHTMLContext(Thread thread, SessionToken session, HTTPService httpService, String sessionId, ActivityInstance activityInstance, EBPInstanceReference activity, ExecutionContext executionContext) Creates a newHTMLContextfor handling the interaction between webserver andExecutableComponentand also to provide theURLto a client allowing to call theURLremotely.- Parameters:
thread- The thread which executes the component using this context (locally).
We must not keep a strong reference to this thread! Otherwise memory leaks may occur.session- The session token used for deregistering at theHTTPService.httpService- TheHTTPServiceto deregister this context.sessionId- The session ID used for deregistering at theHTTPService.activityInstance- The activity instance this GUI context has been created for.activity- TheEBPInstanceReferenceidentifying the process instance node this GUI context has been created for.executionContext- The execution context of the activity for which this GUI context has been created for.
-
-
Method Details
-
close
public void close()Description copied from interface:GUIContextCloses the GUI for this context. This method has to be called by the runtime manager whenever an application has terminated (finished, failed, aborted, killed,...).
It must be possible to call this method more than once, even if the GUIContext has already shut down. This especially applies to the disposal of SWT-widgets, that is, it is allowed to call this method after the disposal of the corresponding widgets.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceGUIContext- Specified by:
closein interfaceHTMLContext
-
getURL
Description copied from interface:URLContextGets the URL of the (remote)HTMLContextwhich provides the GUI.- Specified by:
getURLin interfaceURLContext- Returns:
- The URL of the (remote)
HTMLContextwhich provides the GUI.
-
setBaseURL
Description copied from interface:HTTPReplyHandlerSets the base URL on which the reply handler is reachable via HTTP and the corresponding resource name, i. e. the last element of the URL path (before query parameters). Further parameters can be arbitrarily added by the activity, as long as the resulting URL is valid.- Specified by:
setBaseURLin interfaceHTTPReplyHandler- Overrides:
setBaseURLin classAbstractHTMLContext- Parameters:
baseURL- The URL on which this reply handler is reachable via HTTP.resName- The resource name from the URL, i. e. the last element of its path (before query parameters), e. g.index.html(without leading slash).
-
writeReplace
Creates a newURLContextto replace thisRemoteHTMLContextwhen transferring to a client. A client only requires theURLbut not the logic for handling HTTP-requests this context provides.- Returns:
- A new
URLContextto replace thisRemoteHTMLContextwhen transferring to a client.
-