Package de.xima.fc.mdl.response
Class ServletResponse
java.lang.Object
de.xima.fc.mdl.response.ServletResponse
- All Implemented Interfaces:
IServletResponse,Serializable
- Direct Known Subclasses:
WorkflowResponse
Default POJO implementation of
IServletResponse.- Author:
- XIMA MEDIA GmbH
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected byte[]protected Stringprotected Stringprotected booleanprotected intprotected longprotected Map<String,Serializable> protected EResponseTypeprotected String -
Constructor Summary
ConstructorsConstructorDescriptionServletResponse(IServletResponse response) Creates a new servlet response with all data copied from a given response.ServletResponse(EResponseType type) Creates a new servlet response without any content.ServletResponse(EResponseType type, long longValue) Creates a new servlet response with a single numerical response.ServletResponse(EResponseType type, String value) Creates a new servlet response with plain text response.ServletResponse(EResponseType type, String value, byte[] binValue) Creates a new servlet response with binary response.ServletResponse(EResponseType type, String value, byte[] binValue, boolean forceDownload) Creates a new servlet response with binary response. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHttpHeader(String name, String value) Adds an HTTP header with the given name.byte[]The binary data for the response.intlongApplies only whentypeis set toFORM_RECORDis set, this is the ID of the form record to which to redirect.getType()getValue()Whentypeis set to a binary response type (e.g.booleanDeprecated.Does not have any effect anymore.booleanvoidsetAppendFormSessionID(boolean appendFormSessionID) Deprecated.Does not have any effect anymore.voidsetBinValue(byte[] binValue) voidsetContentType(String contentType) voidsetEncoding(String encoding) voidsetForceDownload(boolean forceDownload) voidsetHttpHeader(Map<String, String> httpHeader) Removes all existing headers and sets a new map of HTTP headers to send with the response.voidsetHttpStatusCode(int httpStatusCode) voidsetLongValue(long longValue) voidsetSessionAttributes(Map<String, Serializable> sessionAttributes) voidsetType(EResponseType type) void
-
Field Details
-
value
-
longValue
protected long longValue -
contentType
-
sessionAttributes
-
httpHeader
-
encoding
-
binValue
protected byte[] binValue -
type
-
forceDownload
protected boolean forceDownload -
appendFormSessionId
protected boolean appendFormSessionId -
httpStatusCode
protected int httpStatusCode
-
-
Constructor Details
-
ServletResponse
Creates a new servlet response with all data copied from a given response. Can be used to modify a servlet response.- Parameters:
response- An existing servlet response from which to copy the data.
-
ServletResponse
Creates a new servlet response with binary response.- Parameters:
type- The value forIServletResponse.getType().value- The value forIServletResponse.getValue(), the name of the file.binValue- The value forIServletResponse.getBinValue(), the content of the file.forceDownload- The value forIServletResponse.isForceDownload().
-
ServletResponse
Creates a new servlet response with binary response.- Parameters:
type- The value forIServletResponse.getType().value- The value forIServletResponse.getValue(), the name of the file.binValue- The value forIServletResponse.getBinValue(), the content of the file.
-
ServletResponse
Creates a new servlet response with plain text response.- Parameters:
type- The value forIServletResponse.getType().value- The value forIServletResponse.getValue(), the content of the file or the redirect URL.
-
ServletResponse
Creates a new servlet response with a single numerical response.- Parameters:
type- The value forIServletResponse.getType().longValue- The value forIServletResponse.getLongValue(), e.g. the form record ID when the type isFORM_RECORD.
-
ServletResponse
Creates a new servlet response without any content.- Parameters:
type- The value forIServletResponse.getType().
-
-
Method Details
-
getValue
Description copied from interface:IServletResponseWhentypeis set to a binary response type (e.g.SHOW_FILE), the file name of the returned file.When
typeis set to a non-binary response (e.g.JSON), the plain-text content of the response.- Specified by:
getValuein interfaceIServletResponse- Returns:
- The plain-text content of the HTTP response.
-
setValue
- Parameters:
value- The new value forIServletResponse.getValue().
-
getType
- Specified by:
getTypein interfaceIServletResponse- Returns:
- The type of response, such as whether a plain text or binary file should be returned, or a redirect should be performed.
-
setType
- Parameters:
type- The new value forIServletResponse.getType().
-
getBinValue
public byte[] getBinValue()Description copied from interface:IServletResponse- Specified by:
getBinValuein interfaceIServletResponse- Returns:
- The binary content of the HTTP response.
-
setBinValue
public void setBinValue(byte[] binValue) - Parameters:
binValue- The new value forIServletResponse.getBinValue().
-
isForceDownload
public boolean isForceDownload()Description copied from interface:IServletResponse- Specified by:
isForceDownloadin interfaceIServletResponse- Returns:
- If
true, attempts to prevent browsers from showing the binary content inline. Iffalse, the browser may show the content inline, which is useful for PDF, image or plain text files. Please note that support for this differs between browsers.
-
setForceDownload
public void setForceDownload(boolean forceDownload) - Parameters:
forceDownload- The new value forIServletResponse.isForceDownload().
-
getEncoding
Description copied from interface:IServletResponse- Specified by:
getEncodingin interfaceIServletResponse- Returns:
- The encoding that is to be used for encoding the response.
-
setEncoding
- Parameters:
encoding- The new value forIServletResponse.getEncoding().
-
setAppendFormSessionID
Deprecated.Does not have any effect anymore.- Parameters:
appendFormSessionID- The new value that is returned byisAppendFormSessionID().
-
isAppendFormSessionID
Deprecated.Does not have any effect anymore.- Returns:
- Returns the boolean flag as set by
setAppendFormSessionID(boolean).
-
getLongValue
public long getLongValue()Description copied from interface:IServletResponseApplies only whentypeis set toFORM_RECORDis set, this is the ID of the form record to which to redirect.- Specified by:
getLongValuein interfaceIServletResponse- Returns:
- The long value content for the response.
-
setLongValue
public void setLongValue(long longValue) - Parameters:
longValue- The new value forIServletResponse.getLongValue().
-
getHttpStatusCode
public int getHttpStatusCode()- Specified by:
getHttpStatusCodein interfaceIServletResponse- Returns:
- The HTTP status code of the HTTP response.
-
setHttpStatusCode
public void setHttpStatusCode(int httpStatusCode) - Parameters:
httpStatusCode- The new value forIServletResponse.getHttpStatusCode().
-
getContentType
Description copied from interface:IServletResponseApplies only whentypeis set toSHOW_FILE:Must return the content type (=mime type) that is to be sent along with the binary data. When this is either
nullor blank, an attempt is made to guess the content type from the binary data. Please note that this may fail to determine the actual content type, you should always provide a content type.- Specified by:
getContentTypein interfaceIServletResponse- Returns:
- The content type of the binary data.
-
setContentType
- Parameters:
contentType- The new value forIServletResponse.getContentType().
-
getSessionAttributes
- Specified by:
getSessionAttributesin interfaceIServletResponse- Returns:
- A
Mapwith attributes that should be written to theHttpSession. Existing values in theHttpSessionare overwritten.
-
setSessionAttributes
- Parameters:
sessionAttributes- The new value forIServletResponse.getSessionAttributes().
-
getHttpHeader
- Specified by:
getHttpHeaderin interfaceIServletResponse- Returns:
- A
Mapof HTTP headers that should be sent along with the HTTP response.
-
setHttpHeader
Removes all existing headers and sets a new map of HTTP headers to send with the response.- Parameters:
httpHeader- The new value forIServletResponse.getHttpHeader().
-
addHttpHeader
Adds an HTTP header with the given name. When a value exists already for that name, it is overwritten.- Parameters:
name- Name of the header.value- Value of the header.
-