Class ResponseBean

java.lang.Object
helma.framework.ResponseBean
All Implemented Interfaces:
Serializable

public class ResponseBean extends Object implements Serializable
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new ResponseBean object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Rollback the current database transaction and abort execution.
    void
    addDateHeader(String name, Date value)
    Proxy to HttpServletResponse.addDateHeader()
    void
    addHeader(String name, String value)
    Proxy to HttpServletResponse.addHeader()
    void
    Commit changes made during the course of the current transaction and start a new one
    void
    debug(String... messages)
    add HTML formatted debug messages to the end of the page.
    void
    Add an item to this response's dependencies.
    void
    Digest this response's dependencies to conditionally create a HTTP not-modified response
    void
    Write an object to the response buffer by converting it to a string and then HTML-encoding it.
    void
    Write an object to the response buffer by converting it to a string and then encoding it for form/text area content use.
    void
    Write an object to the response buffer by converting it to a string and then XML-encoding it.
    void
    Write an object to the response buffer by converting it to a string and then HTML-formatting it.
    void
    Internally forward the request to a different URL
    Returns the current response buffer as string.
    boolean
    Return the current cachability setting for this response
    Get the current charset/encoding name for the response
    Get the current content type name for the response
    Get the data map for the response
    Get the current error message for the response, if any
    Get the ETag for this response
    Get the uncaught exception for the response, if any
    Get the macro handlers map for the response
    Get the Java stack trace of an uncaught exception.
    Get the last modified date for this response
    Get the current message for the response, if set
    Get the meta map for the response
    Get the HTTP authentication realm for the response
    Return the Javascript stack trace of an uncought exception.
    javax.servlet.http.HttpServletResponse
    Returns the ServletResponse instance for this Response.
    Get the skin search path for the response
    int
    Get the HTTP status code for this response
    pop()
    Pop a string buffer from the response object containing all the writes since the last pushBuffer
    Pops the current response buffer without converting it to a string
    Deprecated. 
    void
    Push a string buffer on the response object.
    Push a string buffer on the response object.
    Push a string buffer on the response object.
    void
    Deprecated. 
    void
    Redirect the request to a different URL
    void
    Reset the response object, clearing all content previously written to it
    void
    Reset the response buffer, clearing all content previously written to it
    void
    Rollback the current transaction and start a new one.
    void
    setCache(boolean cache)
    Set true cachability setting for this response
    void
    setCharset(String charset)
    Set the charset/encoding name for the response
    void
    setContentType(String contentType)
    Set the content type for the response
    void
    setCookie(String key, String value)
    Set a HTTP cookie with the name and value that is discarded when the HTTP client is closed
    void
    setCookie(String key, String value, int days)
    Set a HTTP cookie with the name and value that is stored by the HTTP client for the given number of days.
    void
    setCookie(String key, String value, int days, String path)
    Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days.
    void
    setCookie(String key, String value, int days, String path, String domain)
    Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days.
    void
    setCookie(String key, String value, int days, String path, String domain, boolean isHttpOnly)
    Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days.
    void
    setCookie(String key, String value, int days, String path, String domain, boolean isHttpOnly, boolean isSecure)
    Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days.
    void
    setDateHeader(String name, Date value)
    Proxy to HttpServletResponse.setDateHeader()
    void
    Set the HTTP Etag for this response
    void
    setHeader(String name, String value)
    Proxy to HttpServletResponse.setHeader()
    void
    Set the last modified date for this response
    void
    setMessage(String message)
    Set the message property for the response
    void
    Set the HTTP authentication realm for the response
    void
    Set the skin search path for the response
    void
    setStatus(int status)
    Set the HTTP status code for this response
    void
    Immediately stop processing the current request
    Return a string representation for this object
    void
    Unset a previously set HTTP cookie, causing it to be discarded immedialtely by the HTTP client.
    void
    write(String... str)
    Directly write a string to the response buffer without any transformation.
    void
    writeBinary(byte[] bytes)
    Directly write a byte array to the response buffer without any transformation.
    void
    Write a platform dependent newline sequence to response buffer.
    void
    writeln(String... str)
    Write string to response buffer and append a platform dependent newline sequence.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ResponseBean

      public ResponseBean(ResponseTrans res)
      Creates a new ResponseBean object.
      Parameters:
      res - the wrapped ResponseTrans
  • Method Details

    • encode

      public void encode(Object obj)
      Write an object to the response buffer by converting it to a string and then HTML-encoding it.
      Parameters:
      obj - the object to write to the response buffer
    • encodeXml

      public void encodeXml(Object obj)
      Write an object to the response buffer by converting it to a string and then XML-encoding it.
      Parameters:
      obj - the object to write to the response buffer
    • encodeForm

      public void encodeForm(Object obj)
      Write an object to the response buffer by converting it to a string and then encoding it for form/text area content use.
      Parameters:
      obj - the object to write to the response buffer
    • format

      public void format(Object obj)
      Write an object to the response buffer by converting it to a string and then HTML-formatting it.
      Parameters:
      obj - the object to write to the response buffer
    • redirect

      public void redirect(String url) throws RedirectException
      Redirect the request to a different URL
      Parameters:
      url - the URL to redirect to
      Throws:
      RedirectException - to immediately terminate the request
    • forward

      public void forward(String url) throws RedirectException
      Internally forward the request to a different URL
      Parameters:
      url - the URL to forward to
      Throws:
      RedirectException - to immediately terminate the request
    • stop

      public void stop() throws RedirectException
      Immediately stop processing the current request
      Throws:
      RedirectException - to immediately terminate the request
    • reset

      public void reset()
      Reset the response object, clearing all content previously written to it
    • resetBuffer

      public void resetBuffer()
      Reset the response buffer, clearing all content previously written to it
    • getServletResponse

      public javax.servlet.http.HttpServletResponse getServletResponse()
      Returns the ServletResponse instance for this Response. Returns null for internal and XML-RPC requests.
      Returns:
      the servlet response
    • setCookie

      public void setCookie(String key, String value)
      Set a HTTP cookie with the name and value that is discarded when the HTTP client is closed
      Parameters:
      key - the cookie name
      value - the cookie value
    • setCookie

      public void setCookie(String key, String value, int days)
      Set a HTTP cookie with the name and value that is stored by the HTTP client for the given number of days. A days value of 0 means the cookie should be immediately discarded.
      Parameters:
      key - the cookie name
      value - the cookie value
      days - number of days the cookie should be stored
    • setCookie

      public void setCookie(String key, String value, int days, String path)
      Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days. A days value of 0 means the cookie should be immediately discarded.
      Parameters:
      key - the cookie name
      value - the cookie value
      days - number of days the cookie should be stored
      path - the URL path to apply the cookie to
    • setCookie

      public void setCookie(String key, String value, int days, String path, String domain, boolean isHttpOnly)
      Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days. A days value of 0 means the cookie should be immediately discarded.
      Parameters:
      key - the cookie name
      value - the cookie value
      days - number of days the cookie should be stored
      path - the URL path to apply the cookie to
      domain - domain
      isHttpOnly - marks the cookie as HttpOnly
    • setCookie

      public void setCookie(String key, String value, int days, String path, String domain, boolean isHttpOnly, boolean isSecure)
      Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days. A days value of 0 means the cookie should be immediately discarded.
      Parameters:
      key - the cookie name
      value - the cookie value
      days - number of days the cookie should be stored
      path - the URL path to apply the cookie to
      domain - domain
      isHttpOnly - marks the cookie as HttpOnly
      isSecure - limits the cookie to secure protocols
    • setCookie

      public void setCookie(String key, String value, int days, String path, String domain)
      Set a HTTP cookie with the name and value that is only applied to the URLs matching the given path and is stored by the HTTP client for the given number of days. A days value of 0 means the cookie should be immediately discarded.
      Parameters:
      key - the cookie name
      value - the cookie value
      days - number of days the cookie should be stored
      path - the URL path to apply the cookie to
      domain - domain
    • unsetCookie

      public void unsetCookie(String key)
      Unset a previously set HTTP cookie, causing it to be discarded immedialtely by the HTTP client.
      Parameters:
      key - the name of the cookie to be discarded
    • write

      public void write(String... str)
      Directly write a string to the response buffer without any transformation.
      Parameters:
      str - the string to write to the response buffer
    • writeln

      public void writeln(String... str)
      Write string to response buffer and append a platform dependent newline sequence.
      Parameters:
      str - the string to write to the response buffer
    • writeln

      public void writeln()
      Write a platform dependent newline sequence to response buffer.
    • writeBinary

      public void writeBinary(byte[] bytes)
      Directly write a byte array to the response buffer without any transformation.
      Parameters:
      bytes - the string to write to the response buffer
    • debug

      public void debug(String... messages)
      add HTML formatted debug messages to the end of the page.
      Parameters:
      messages - the list of messages
    • toString

      public String toString()
      Return a string representation for this object
      Overrides:
      toString in class Object
      Returns:
      string representation
    • getCache

      public boolean getCache()
      Return the current cachability setting for this response
      Returns:
      true if the response may be cached by the HTTP client, false otherwise
    • setCache

      public void setCache(boolean cache)
      Set true cachability setting for this response
      Parameters:
      cache - true if the response may be cached by the HTTP client, false otherwise
    • getCharset

      public String getCharset()
      Get the current charset/encoding name for the response
      Returns:
      The charset name
    • setCharset

      public void setCharset(String charset)
      Set the charset/encoding name for the response
      Parameters:
      charset - The charset name
    • getContentType

      public String getContentType()
      Get the current content type name for the response
      Returns:
      the content type
    • setContentType

      public void setContentType(String contentType)
      Set the content type for the response
      Parameters:
      contentType - The charset name
    • addHeader

      public void addHeader(String name, String value)
      Proxy to HttpServletResponse.addHeader()
      Parameters:
      name - the header name
      value - the header value
    • addDateHeader

      public void addDateHeader(String name, Date value)
      Proxy to HttpServletResponse.addDateHeader()
      Parameters:
      name - the header name
      value - the header value
    • setHeader

      public void setHeader(String name, String value)
      Proxy to HttpServletResponse.setHeader()
      Parameters:
      name - the header name
      value - the header value
    • setDateHeader

      public void setDateHeader(String name, Date value)
      Proxy to HttpServletResponse.setDateHeader()
      Parameters:
      name - the header name
      value - the header value
    • getData

      public Map getData()
      Get the data map for the response
      Returns:
      the data object
    • getHandlers

      public Map getHandlers()
      Get the macro handlers map for the response
      Returns:
      the macro handlers map
    • getMeta

      public Map getMeta()
      Get the meta map for the response
      Returns:
      the meta map
    • getError

      public String getError()
      Get the current error message for the response, if any
      Returns:
      the error message
    • getException

      public Throwable getException()
      Get the uncaught exception for the response, if any
      Returns:
      the uncaught exception
    • getScriptStack

      public String getScriptStack()
      Return the Javascript stack trace of an uncought exception.
      Returns:
      the script stack trace of any uncaught exception or null.
    • getJavaStack

      public String getJavaStack()
      Get the Java stack trace of an uncaught exception.
      Returns:
      the java stack trace of an uncaught exception or null.
    • getMessage

      public String getMessage()
      Get the current message for the response, if set
      Returns:
      the message
    • setMessage

      public void setMessage(String message)
      Set the message property for the response
      Parameters:
      message - the message property
    • getRealm

      public String getRealm()
      Get the HTTP authentication realm for the response
      Returns:
      the HTTP authentication realm
    • setRealm

      public void setRealm(String realm)
      Set the HTTP authentication realm for the response
      Parameters:
      realm - the HTTP authentication realm
    • setSkinpath

      public void setSkinpath(Object[] arr)
      Set the skin search path for the response
      Parameters:
      arr - an array containing files or nodes containing skins
    • getSkinpath

      public Object[] getSkinpath()
      Get the skin search path for the response
      Returns:
      The array of files or nodes used to search for skins
    • getStatus

      public int getStatus()
      Get the HTTP status code for this response
      Returns:
      the HTTP status code
    • setStatus

      public void setStatus(int status)
      Set the HTTP status code for this response
      Parameters:
      status - the HTTP status code
    • getLastModified

      public Date getLastModified()
      Get the last modified date for this response
      Returns:
      the last modified date
    • setLastModified

      public void setLastModified(Date date)
      Set the last modified date for this response
      Parameters:
      date - the last modified date
    • getETag

      public String getETag()
      Get the ETag for this response
      Returns:
      the HTTP etag
    • setETag

      public void setETag(String etag)
      Set the HTTP Etag for this response
      Parameters:
      etag - the HTTP ETag
    • dependsOn

      public void dependsOn(String what)
      Add an item to this response's dependencies. If no dependency has changed between requests, an HTTP not-modified response will be generated.
      Parameters:
      what - a string item this response depends on
    • digest

      public void digest()
      Digest this response's dependencies to conditionally create a HTTP not-modified response
    • push

      public void push()
      Push a string buffer on the response object. All further writes will be redirected to this buffer.
    • pop

      public String pop()
      Pop a string buffer from the response object containing all the writes since the last pushBuffer
      Returns:
      ...
    • pushStringBuffer

      @Deprecated public void pushStringBuffer()
      Deprecated.
      Old version for push() kept for compatibility
    • popStringBuffer

      @Deprecated public String popStringBuffer()
      Deprecated.
      Old version for pop() kept for compatibility
      Returns:
      ...
    • pushBuffer

      public StringBuffer pushBuffer(StringBuffer buffer)
      Push a string buffer on the response object. All further writes will be redirected to this buffer.
      Parameters:
      buffer - the string buffer
      Returns:
      the new stringBuffer
    • pushBuffer

      public StringBuffer pushBuffer()
      Push a string buffer on the response object. All further writes will be redirected to this buffer.
      Returns:
      the new stringBuffer
    • popBuffer

      public StringBuffer popBuffer()
      Pops the current response buffer without converting it to a string
      Returns:
      the stringBuffer
    • getBuffer

      public String getBuffer()
      Returns the current response buffer as string.
      Returns:
      the response buffer as string
    • commit

      public void commit() throws Exception
      Commit changes made during the course of the current transaction and start a new one
      Throws:
      Exception - thrown if commit fails
    • rollback

      public void rollback() throws Exception
      Rollback the current transaction and start a new one.
      Throws:
      Exception - thrown if rollback fails
    • abort

      public void abort() throws AbortException
      Rollback the current database transaction and abort execution. This has the same effect as calling rollback() and then stop().
      Throws:
      AbortException - thrown to exit the the current execution