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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addHeader(String headerName, String headerValue)
Adds the given header to the servlet response.default void
addHeaders(Map<String,String> headers)
Adds the given header to the servlet response.void
clearHeaders()
Removes all headers from the servlet response.String
getBaseUrl()
String
getContextPath()
Map<String,Serializable>
getSessionAttributesMap()
String
getSessionId()
void
putSessionValue(String key, Serializable value)
Adds a key-value pair to the current HTTP session, seeHttpSession.setAttribute(String, Object)
.default void
putSessionValues(Map<String,Serializable> values)
Adds the given key-value pairs to the current HTTP session, seeHttpSession.setAttribute(String, Object)
.void
removeHeader(String headerName)
Removes the given header from the servlet response.void
removeSessionValue(String key)
Removes a key and the associated value from the current HTTP session, seeHttpSession.removeValue(String)
.void
requestResponse(IServletResponse response)
Requests that the given response is sent in response to the current HTTP request.IServletResponse
requestResponseBinaryFile(byte[] data, String mimeType, EContentDisposition disposition, String fileName)
Request an HTTP response with the given binary data.IServletResponse
requestResponseHtml(int statusCode, String htmlBodyContent)
Request an HTML response with a given status code and response body.IServletResponse
requestResponseJson(Object json)
Request an HTTP response with the given JSON content.IServletResponse
requestResponseRedirect(String targetUrl)
Request an HTTP response that redirects to the given URL.default IServletResponse
requestResponseRedirect(URI targetUrl)
Request an HTTP response that redirects to the given URL.default IServletResponse
requestResponseRedirect(URL targetUrl)
Request an HTTP response that redirects to the given URL.default IServletResponse
requestResponseTemplate(Textbaustein template)
Requests an HTTP response for the given (HTML) template.IServletResponse
requestResponseTemplate(ETextbausteinMsgCode messageCode)
IServletResponse
requestResponseTemplate(UUID templateUuid)
Requests an HTTP response for the given (HTML) template.
-
-
-
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 therequestResponse...
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 therequestResponse...
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 therequestResponse...
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.
- Parameters:
headerName
- Name of the header to remove.
-
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.
-
putSessionValue
void putSessionValue(String key, Serializable value)
Adds a key-value pair to the current HTTP session, seeHttpSession.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, seeHttpSession.setAttribute(String, Object)
.- Parameters:
values
- Key-value pairs to add to the HTTP session.
-
removeHeader
void removeHeader(String headerName)
Removes the given header from the servlet response. This method can be used before a call to one of therequestResponse...
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, seeHttpSession.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., userequestResponse(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, eitherinline
orattachment
.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)
-
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., userequestResponse(IServletResponse)
.- Parameters:
statusCode
- Status code to use for the response, usually200
.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., userequestResponse(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 isJSONObject
orJSONArray
, that object or array is serialized and sent. Otherwise, this is assumed to be a POJO that can be serialized viaJSON.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., userequestResponse(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., userequestResponse(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., userequestResponse(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
IServletResponse requestResponseTemplate(ETextbausteinMsgCode messageCode) throws MissingEntityException
- Parameters:
messageCode
- Template with which to respond. Must refer to a persistedTextbaustein
in the database.- 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 message code exists.
-
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, seeAbstractEntity.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.
-
-