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 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 Detail

      • setBaseURL

        @Deprecated
        void setBaseURL​(URL baseURL)
        Deprecated.
        Sets the base URL on which the reply handler is reachable via HTTP. 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.
      • setBaseURL

        default void setBaseURL​(URL baseURL,
                                String resName)
        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

        HTMLContext.Response getResponse​(HTMLContext.HTTPReply reply)
                                  throws InterruptedException
        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 an InterruptedException to 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, an InterruptedException will be thrown.