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
public class ServletResponse extends Object implements IServletResponse
Modelklasse für Daten welche innerhalb eines Servlet-Response behandelt werden können- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
appendFormSessionId
protected byte[]
binValue
protected String
contentType
protected String
encoding
protected boolean
forceDownload
protected Map<String,String>
httpHeader
protected int
httpStatusCode
protected long
longValue
protected Map<String,Serializable>
sessionAttributes
protected EResponseType
type
protected String
value
-
Constructor Summary
Constructors Constructor Description ServletResponse(IServletResponse response)
ServletResponse(EResponseType type)
ServletResponse(EResponseType type, long longValue)
ServletResponse(EResponseType type, String value)
ServletResponse(EResponseType type, String value, byte[] binValue)
ServletResponse(EResponseType type, String value, byte[] binValue, boolean forceDownload)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHttpHeader(String name, String value)
Adds an HTTP header with the given name.byte[]
getBinValue()
The binary data for the response.String
getContentType()
Applies only whenIServletResponse.getType()
is set toEResponseType.SHOW_FILE
:String
getEncoding()
Applies only whenIServletResponse.getType()
is set toEResponseType.TEMPLATE
,EResponseType.TEMPLATE_SYSTEM
, orEResponseType.HTML
.Map<String,String>
getHttpHeader()
int
getHttpStatusCode()
long
getLongValue()
Returns an long value.Map<String,Serializable>
getSessionAttributes()
EResponseType
getType()
String
getValue()
The plain-text data of the response, used only whenIServletResponse.getType()
is not set to a binary response type or redirect.boolean
isAppendFormSessionID()
boolean
isForceDownload()
Applies only whenIServletResponse.getType()
is set toEResponseType.SHOW_FILE
.void
setAppendFormSessionID(boolean appendFormSessionID)
void
setBinValue(byte[] binValue)
Setter des byteValuevoid
setContentType(String contentType)
void
setEncoding(String encoding)
void
setForceDownload(boolean forceDownload)
void
setHttpHeader(Map<String,String> httpHeader)
void
setHttpStatusCode(int httpStatusCode)
void
setLongValue(long longValue)
void
setSessionAttributes(Map<String,Serializable> sessionAttributes)
void
setType(EResponseType type)
void
setValue(String value)
-
-
-
Field Detail
-
value
protected String value
-
longValue
protected long longValue
-
contentType
protected String contentType
-
sessionAttributes
protected Map<String,Serializable> sessionAttributes
-
encoding
protected String encoding
-
binValue
protected byte[] binValue
-
type
protected EResponseType type
-
forceDownload
protected boolean forceDownload
-
appendFormSessionId
protected boolean appendFormSessionId
-
httpStatusCode
protected int httpStatusCode
-
-
Constructor Detail
-
ServletResponse
public ServletResponse(IServletResponse response)
-
ServletResponse
public ServletResponse(EResponseType type, String value, byte[] binValue, boolean forceDownload)
-
ServletResponse
public ServletResponse(EResponseType type, String value, byte[] binValue)
-
ServletResponse
public ServletResponse(EResponseType type, String value)
-
ServletResponse
public ServletResponse(EResponseType type, long longValue)
-
ServletResponse
public ServletResponse(EResponseType type)
-
-
Method Detail
-
getValue
public String getValue()
Description copied from interface:IServletResponse
The plain-text data of the response, used only whenIServletResponse.getType()
is not set to a binary response type or redirect.- Specified by:
getValue
in interfaceIServletResponse
- Returns:
- The plain-text content of the HTTP response.
-
setValue
public void setValue(String value)
-
getType
public EResponseType getType()
- Specified by:
getType
in 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
public void setType(EResponseType type)
-
getBinValue
public byte[] getBinValue()
Description copied from interface:IServletResponse
The binary data for the response. Applies only whenIServletResponse.getType()
is set toEResponseType.SHOW_FILE
.- Specified by:
getBinValue
in interfaceIServletResponse
- Returns:
- The binary content of the HTTP response.
-
setBinValue
public void setBinValue(byte[] binValue)
Setter des byteValue- Parameters:
binValue
-Byte
-Array der zu setzende binValue
-
isForceDownload
public boolean isForceDownload()
Description copied from interface:IServletResponse
Applies only whenIServletResponse.getType()
is set toEResponseType.SHOW_FILE
.- Specified by:
isForceDownload
in 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)
-
getEncoding
public String getEncoding()
Description copied from interface:IServletResponse
Applies only whenIServletResponse.getType()
is set toEResponseType.TEMPLATE
,EResponseType.TEMPLATE_SYSTEM
, orEResponseType.HTML
.- Specified by:
getEncoding
in interfaceIServletResponse
- Returns:
- The encoding that is to be used for encoding the response.
-
setEncoding
public void setEncoding(String encoding)
-
setAppendFormSessionID
public void setAppendFormSessionID(boolean appendFormSessionID)
-
isAppendFormSessionID
public boolean isAppendFormSessionID()
-
getLongValue
public long getLongValue()
Description copied from interface:IServletResponse
Returns an long value. IfEResponseType.FORM_RECORD
is set, this is the id of the record.- Specified by:
getLongValue
in interfaceIServletResponse
- Returns:
- an long value
-
setLongValue
public void setLongValue(long longValue)
-
getHttpStatusCode
public int getHttpStatusCode()
- Specified by:
getHttpStatusCode
in interfaceIServletResponse
- Returns:
- The HTTP status code of the HTTP response.
-
setHttpStatusCode
public void setHttpStatusCode(int httpStatusCode)
-
getContentType
public String getContentType()
Description copied from interface:IServletResponse
Applies only whenIServletResponse.getType()
is set toEResponseType.SHOW_FILE
:Must return the content type (=mime type) that is to be sent along with the binary data. When this is either
null
or 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:
getContentType
in interfaceIServletResponse
- Returns:
- The content type of the binary data.
-
setContentType
public void setContentType(String contentType)
-
getSessionAttributes
public Map<String,Serializable> getSessionAttributes()
- Specified by:
getSessionAttributes
in interfaceIServletResponse
- Returns:
- A
Map
with attributes that should be written to theHttpSession
. Existing values in theHttpSession
are overwritten.
-
setSessionAttributes
public void setSessionAttributes(Map<String,Serializable> sessionAttributes)
-
getHttpHeader
public Map<String,String> getHttpHeader()
- Specified by:
getHttpHeader
in interfaceIServletResponse
- Returns:
- A
Map
of HTTP headers that should be sent along with the HTTP response.
-
setHttpHeader
public void setHttpHeader(Map<String,String> httpHeader)
- Parameters:
httpHeader
- the httpHeader to set
-
-