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<Serializable,Serializable>
getFrqSessionAttributesMap()
Map<String,Serializable>
getSessionAttributesMap()
String
getSessionId()
void
putFrqSessionValue(Serializable key, Serializable value)
Adds a key-value pair to the currentFRQSession
, seeFRQSession#put
.default void
putFrqSessionValues(Map<String,Serializable> values)
Adds the given key-value pairs to the current FRQ session, seeFRQSession#put
.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
removeFrqSessionValue(Serializable key)
Removes a key and the associated value from the current HTTP session, seeConcurrentHashMap.remove(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.default IServletResponse
requestResponseBinaryFile(File data, String mimeType, EContentDisposition disposition, String fileName)
Request an HTTP response with the binary data from the given file.IServletResponse
requestResponseFormRecord(long id)
Request an HTTP response that redirects to the form record with the givenID
.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.
-
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
.
-
getFrqSessionAttributesMap
Map<Serializable,Serializable> getFrqSessionAttributesMap()
- Returns:
- A read-only map with the current
FRQSession
parameters.
-
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 currentFRQSession
, seeFRQSession#put
.- 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, seeFRQSession#put
.- 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, 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.
-
removeFrqSessionValue
void removeFrqSessionValue(Serializable key)
Removes a key and the associated value from the current HTTP session, seeConcurrentHashMap.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 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)
-
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., 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.
- 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 givenID
. For more control over response headers etc., userequestResponse(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., 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.
-
-