Interface HTTPReplyHandler
- All Known Implementing Classes:
AbstractHTMLContext,RemoteHTMLContext,SwtHtmlContext
public interface HTTPReplyHandler
HTML-activities are provided a single HTTP-service which accepts data sent
back to an activity and assigns it to a registered activity. Such an activity
needs to implement this
A reply handler is registered at the HTTP-service which in turn sets the base URL.
HTTPReplyHandler in order to receive
the data and provide a valid HTTP-response sent back to the HTTP-client. The
URL of the HTTP-service is provided in order to allow the activity to extend
it by further information needed by the activity. A reply handler is registered at the HTTP-service which in turn sets the base URL.
-
Method Summary
Modifier and TypeMethodDescriptiongetResponse(HTMLContext.HTTPReply reply) Provides the reply handler with the parameters retrieved by the HTTP-request.voidsetBaseURL(URL baseURL, String resName) Sets the base URL on which the reply handler is reachable via HTTP and the corresponding resource name, i.
-
Method Details
-
setBaseURL
Sets 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.- 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).
-
getResponse
Provides the reply handler with the parameters retrieved by the HTTP-request. A response is expected which is sent to the client. This can be an acknowledge message, an error message or even the complete HTML-document again in case of missing values.
This methods blocks and therefore may throw anInterruptedExceptionto indicate an exceptional situation which will not be responded to by this handler.- Parameters:
reply- The parameters sent by the HTTP-client to the URL of this handler. This must not be null! The caller is responsible for closing.- Returns:
- The response to the parameters which is sent back to the HTTP-client. This is never
null. The caller is responsible for closing. - Throws:
InterruptedException- If the waiting thread is interrupted and should no longer wait for a response, anInterruptedExceptionwill be thrown.
-