Interface IWorkflowHttpHandler


  • public interface IWorkflowHttpHandler
    A handler for interacting with the current HTTP request within the context of a workflow execution. It can be used, for example, to initiate redirects or read/write session parameters. If no HTTP request is currently active, this will be a dummy instance that takes no action and returns dummy data.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • addHeader

        void addHeader​(String headerName,
                       String headerValue)
        Adds the given header to the servlet response. This method can be used before a call to one of the requestResponse... methods, and the header will still be added.

        When no response was requested, these headers will NOT take effect and will NOT affect the default response from the system.

        Parameters:
        headerName - Name of the header to add.
        headerValue - Value of the header to add.
      • addHeaders

        default void addHeaders​(Map<String,​String> headers)
        Adds the given header to the servlet response. This method can be used before a call to one of the requestResponse... methods, and the headers will still be added.

        When no response was requested, these headers will NOT take effect and will NOT affect the default response from the system.

        Parameters:
        headers - Headers to add to the existing headers.
      • clearHeaders

        void clearHeaders()
        Removes all headers from the servlet response. This method can be used before a call to one of the requestResponse... methods, and the headers will still be removed.

        When no response was requested, these headers will NOT take effect and will NOT affect the default response from the system.

      • getBaseUrl

        String getBaseUrl()
        Returns:
        The base URL where the FORMCYCLE application is running, such as http://localhost:8080/formcycle.
      • getContextPath

        String getContextPath()
        Returns:
        The context path where the FORMCYCLE application is running, such as /formcycle.
      • getSessionAttributesMap

        Map<String,​Serializable> getSessionAttributesMap()
        Returns:
        A read-only map with the current session parameters, as returned by HttpSession.getAttribute(String).
      • getSessionId

        String getSessionId()
        Returns:
        The ID of the currently active HTTP session, if one is active.
      • putFrqSessionValue

        void putFrqSessionValue​(Serializable key,
                                Serializable value)
        Adds a key-value pair to the current FRQSession, see FRQSession#put(Serializable, Serializable).
        Parameters:
        key - Key with which to associate the given value.
        value - Value to associate with the given key.
      • putFrqSessionValues

        default void putFrqSessionValues​(Map<String,​Serializable> values)
        Adds the given key-value pairs to the current FRQ session, see FRQSession#put(Serializable, Serializable).
        Parameters:
        values - Key-value pairs to add to the FRQ session.
      • putSessionValue

        void putSessionValue​(String key,
                             Serializable value)
        Adds a key-value pair to the current HTTP session, see HttpSession.setAttribute(String, Object).
        Parameters:
        key - Key with which to associate the given value.
        value - Value to associate with the given key.
      • putSessionValues

        default void putSessionValues​(Map<String,​Serializable> values)
        Adds the given key-value pairs to the current HTTP session, see HttpSession.setAttribute(String, Object).
        Parameters:
        values - Key-value pairs to add to the HTTP session.
      • removeFrqSessionValue

        void removeFrqSessionValue​(Serializable key)
        Removes a key and the associated value from the current HTTP session, see ConcurrentHashMap.remove(Object).
        Parameters:
        key - Key of the FRQ session value to remove.
      • removeHeader

        void removeHeader​(String headerName)
        Removes the given header from the servlet response. This method can be used before a call to one of the requestResponse... methods, and the header will still be removed.

        When no response was requested, these headers will NOT take effect and will NOT affect the default response from the system.

        Parameters:
        headerName - Name of the header to remove.
      • removeSessionValue

        void removeSessionValue​(String key)
        Removes a key and the associated value from the current HTTP session, see HttpSession.removeValue(String).
        Parameters:
        key - Key of the session value to remove.
      • requestResponse

        void requestResponse​(IServletResponse response)
        Requests that the given response is sent in response to the current HTTP request. In general, no guarantees are made that this response is actually sent back to the client. However, assuming that (a) the HTTP response has not been committed yet, and (b) that no code requests a different response after the call to this method, this response will be sent.
        Parameters:
        response - The response that should be used for the current HTTP request.
      • requestResponseBinaryFile

        IServletResponse requestResponseBinaryFile​(byte[] data,
                                                   String mimeType,
                                                   EContentDisposition disposition,
                                                   String fileName)
        Request an HTTP response with the given binary data. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        data - Binary data with which to respond.
        mimeType - MIME type of the content represented by the given binary data.
        disposition - The content disposition header, either inline or attachment.
        fileName - The file name to include in the HTTP response.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseBinaryFile

        default IServletResponse requestResponseBinaryFile​(File data,
                                                           String mimeType,
                                                           EContentDisposition disposition,
                                                           String fileName)
                                                    throws IOException
        Request an HTTP response with the binary data from the given file. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        data - Binary data with which to respond.
        mimeType - MIME type of the content represented by the given binary data.
        disposition - The content disposition header, either inline or attachment.
        fileName - The file name to include in the HTTP response.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        Throws:
        IOException - When the data of the given file could not be read.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseFormRecord

        IServletResponse requestResponseFormRecord​(long id)
        Request an HTTP response that redirects to the form record with the given ID. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        id - The ID of the form record to which to redirect.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        Since:
        7.1.0
        See Also:
        requestResponse(IServletResponse)
      • requestResponseHtml

        IServletResponse requestResponseHtml​(int statusCode,
                                             String htmlBodyContent)
        Request an HTML response with a given status code and response body. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        statusCode - Status code to use for the response, usually 200.
        htmlBodyContent - Content for the HTML body.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseJson

        IServletResponse requestResponseJson​(Object json)
        Request an HTTP response with the given JSON content. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        json - The JSON data with which to respond. If this is a string, it is interpreted as a serialized JSON string. If this is JSONObject or JSONArray, that object or array is serialized and sent. Otherwise, this is assumed to be a POJO that can be serialized via JSON.toJSONString().
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseRedirect

        IServletResponse requestResponseRedirect​(String targetUrl)
        Request an HTTP response that redirects to the given URL. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        targetUrl - The URL to which to redirect.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseRedirect

        default IServletResponse requestResponseRedirect​(URI targetUrl)
        Request an HTTP response that redirects to the given URL. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        targetUrl - The URL to which to redirect.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseRedirect

        default IServletResponse requestResponseRedirect​(URL targetUrl)
        Request an HTTP response that redirects to the given URL. For more control over response headers etc., use requestResponse(IServletResponse).
        Parameters:
        targetUrl - The URL to which to redirect.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        See Also:
        requestResponse(IServletResponse)
      • requestResponseTemplate

        default IServletResponse requestResponseTemplate​(Textbaustein template)
                                                  throws MissingEntityException
        Requests an HTTP response for the given (HTML) template.
        Parameters:
        template - Template with which to respond. Must be persisted in the database (not a transient entity, see AbstractEntity.isPersisted().
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        Throws:
        MissingEntityException - When no template with the given UUID exists.
      • requestResponseTemplate

        IServletResponse requestResponseTemplate​(UUID templateUuid)
                                          throws MissingEntityException
        Requests an HTTP response for the given (HTML) template.
        Parameters:
        templateUuid - UUID of the template.
        Returns:
        The servlet response that was created and queued. Normally you do not have to make use of this return value.
        Throws:
        MissingEntityException - When no template with the given UUID exists.