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
Default POJO implementation of IServletResponse.
Author:
XIMA MEDIA GmbH
See Also:
  • Field Details

    • value

      protected String value
    • longValue

      protected long longValue
    • contentType

      protected String contentType
    • sessionAttributes

      protected Map<String,Serializable> sessionAttributes
    • httpHeader

      protected Map<String,String> httpHeader
    • 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 Details

  • Method Details

    • getValue

      public String getValue()
      Description copied from interface: IServletResponse
      When type is set to a binary response type (e.g. SHOW_FILE), the file name of the returned file.

      When type is set to a non-binary response (e.g. JSON), the plain-text content of the response.

      When type is set to REDIRECT, the URL to which to redirect.

      Specified by:
      getValue in interface IServletResponse
      Returns:
      The plain-text content of the HTTP response.
    • setValue

      public void setValue(String value)
      Parameters:
      value - The new value for IServletResponse.getValue().
    • getType

      public EResponseType getType()
      Specified by:
      getType in interface IServletResponse
      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)
      Parameters:
      type - The new value for IServletResponse.getType().
    • getBinValue

      public byte[] getBinValue()
      Description copied from interface: IServletResponse
      The binary data for the response. Applies only when type is set to SHOW_FILE.
      Specified by:
      getBinValue in interface IServletResponse
      Returns:
      The binary content of the HTTP response.
    • setBinValue

      public void setBinValue(byte[] binValue)
      Parameters:
      binValue - The new value for IServletResponse.getBinValue().
    • isForceDownload

      public boolean isForceDownload()
      Description copied from interface: IServletResponse
      Applies only when type is set to SHOW_FILE.
      Specified by:
      isForceDownload in interface IServletResponse
      Returns:
      If true, attempts to prevent browsers from showing the binary content inline. If false, 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 for IServletResponse.isForceDownload().
    • getEncoding

      public String getEncoding()
      Description copied from interface: IServletResponse
      Applies only when type is set to TEMPLATE, TEMPLATE_SYSTEM, or HTML.
      Specified by:
      getEncoding in interface IServletResponse
      Returns:
      The encoding that is to be used for encoding the response.
    • setEncoding

      public void setEncoding(String encoding)
      Parameters:
      encoding - The new value for IServletResponse.getEncoding().
    • setAppendFormSessionID

      @Deprecated public void setAppendFormSessionID(boolean appendFormSessionID)
      Deprecated.
      Does not have any effect anymore.
      Parameters:
      appendFormSessionID - The new value that is returned by isAppendFormSessionID().
    • isAppendFormSessionID

      @Deprecated public boolean 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: IServletResponse
      Applies only when type is set to FORM_RECORD is set, this is the ID of the form record to which to redirect.
      Specified by:
      getLongValue in interface IServletResponse
      Returns:
      The long value content for the response.
    • setLongValue

      public void setLongValue(long longValue)
      Parameters:
      longValue - The new value for IServletResponse.getLongValue().
    • getHttpStatusCode

      public int getHttpStatusCode()
      Specified by:
      getHttpStatusCode in interface IServletResponse
      Returns:
      The HTTP status code of the HTTP response.
    • setHttpStatusCode

      public void setHttpStatusCode(int httpStatusCode)
      Parameters:
      httpStatusCode - The new value for IServletResponse.getHttpStatusCode().
    • getContentType

      public String getContentType()
      Description copied from interface: IServletResponse
      Applies only when type is set to 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 interface IServletResponse
      Returns:
      The content type of the binary data.
    • setContentType

      public void setContentType(String contentType)
      Parameters:
      contentType - The new value for IServletResponse.getContentType().
    • getSessionAttributes

      public Map<String,Serializable> getSessionAttributes()
      Specified by:
      getSessionAttributes in interface IServletResponse
      Returns:
      A Map with attributes that should be written to the HttpSession. Existing values in the HttpSession are overwritten.
    • setSessionAttributes

      public void setSessionAttributes(Map<String,Serializable> sessionAttributes)
      Parameters:
      sessionAttributes - The new value for IServletResponse.getSessionAttributes().
    • getHttpHeader

      public Map<String,String> getHttpHeader()
      Specified by:
      getHttpHeader in interface IServletResponse
      Returns:
      A Map of HTTP headers that should be sent along with the HTTP response.
    • setHttpHeader

      public void setHttpHeader(Map<String,String> httpHeader)
      Removes all existing headers and sets a new map of HTTP headers to send with the response.
      Parameters:
      httpHeader - The new value for IServletResponse.getHttpHeader().
    • addHttpHeader

      public void addHttpHeader(String name, String value)
      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.