Class ResponseBean

  • All Implemented Interfaces:
    java.io.Serializable

    public class ResponseBean
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ResponseBean​(ResponseTrans res)
      Creates a new ResponseBean object.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void abort()
      Rollback the current database transaction and abort execution.
      void addDateHeader​(java.lang.String name, java.util.Date value)
      Proxy to HttpServletResponse.addDateHeader()
      void addHeader​(java.lang.String name, java.lang.String value)
      Proxy to HttpServletResponse.addHeader()
      void commit()
      Commit changes made during the course of the current transaction and start a new one
      void debug​(java.lang.String... messages)
      add an HTML formatted debug message to the end of the page.
      void dependsOn​(java.lang.String what)
      Add an item to this response's dependencies.
      void digest()
      Digest this response's dependencies to conditionally create a HTTP not-modified response
      void encode​(java.lang.Object obj)
      Write an object to the response buffer by converting it to a string and then HTML-encoding it.
      void encodeForm​(java.lang.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.
      void encodeXml​(java.lang.Object obj)
      Write an object to the response buffer by converting it to a string and then XML-encoding it.
      void format​(java.lang.Object obj)
      Write an object to the response buffer by converting it to a string and then HTML-formatting it.
      void forward​(java.lang.String url)
      Internally forward the request to a different URL
      java.lang.String getBuffer()
      Returns the current response buffer as string.
      boolean getCache()
      Return the current cachability setting for this response
      java.lang.String getCharset()
      Get the current charset/encoding name for the response
      java.lang.String getContentType()
      Get the current content type name for the response
      java.util.Map getData()
      Get the data map for the response
      java.lang.String getError()
      Get the current error message for the response, if any
      java.lang.String getETag()
      Get the ETag for this response
      java.lang.Throwable getException()
      Get the uncaught exception for the response, if any
      java.util.Map getHandlers()
      Get the macro handlers map for the response
      java.lang.String getJavaStack()
      Get the Java stack trace of an uncaught exception.
      java.util.Date getLastModified()
      Get the last modified date for this response
      java.lang.String getMessage()
      Get the current message for the response, if set
      java.util.Map getMeta()
      Get the meta map for the response
      java.lang.String getRealm()
      Get the HTTP authentication realm for the response
      java.lang.String getScriptStack()
      Return the Javascript stack trace of an uncought exception.
      javax.servlet.http.HttpServletResponse getServletResponse()
      Returns the ServletResponse instance for this Response.
      java.lang.Object[] getSkinpath()
      Get the skin search path for the response
      int getStatus()
      Get the HTTP status code for this response
      java.lang.String pop()
      Pop a string buffer from the response object containing all the writes since the last pushBuffer
      java.lang.StringBuffer popBuffer()
      Pops the current response buffer without converting it to a string
      java.lang.String popStringBuffer()
      Deprecated. 
      void push()
      Push a string buffer on the response object.
      java.lang.StringBuffer pushBuffer()
      Push a string buffer on the response object.
      java.lang.StringBuffer pushBuffer​(java.lang.StringBuffer buffer)
      Push a string buffer on the response object.
      void pushStringBuffer()
      Deprecated. 
      void redirect​(java.lang.String url)
      Redirect the request to a different URL
      void reset()
      Reset the response object, clearing all content previously written to it
      void resetBuffer()
      Reset the response buffer, clearing all content previously written to it
      void rollback()
      Rollback the current transaction and start a new one.
      void setCache​(boolean cache)
      Set true cachability setting for this response
      void setCharset​(java.lang.String charset)
      Set the charset/encoding name for the response
      void setContentType​(java.lang.String contentType)
      Set the content type for the response
      void setCookie​(java.lang.String key, java.lang.String value)
      Set a HTTP cookie with the name and value that is discarded when the HTTP client is closed
      void setCookie​(java.lang.String key, java.lang.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​(java.lang.String key, java.lang.String value, int days, java.lang.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​(java.lang.String key, java.lang.String value, int days, java.lang.String path, java.lang.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 setDateHeader​(java.lang.String name, java.util.Date value)
      Proxy to HttpServletResponse.setDateHeader()
      void setETag​(java.lang.String etag)
      Set the HTTP Etag for this response
      void setHeader​(java.lang.String name, java.lang.String value)
      Proxy to HttpServletResponse.setHeader()
      void setLastModified​(java.util.Date date)
      Set the last modified date for this response
      void setMessage​(java.lang.String message)
      Set the message property for the response
      void setRealm​(java.lang.String realm)
      Set the HTTP authentication realm for the response
      void setSkinpath​(java.lang.Object[] arr)
      Set the skin search path for the response
      void setStatus​(int status)
      Set the HTTP status code for this response
      void stop()
      Immediately stop processing the current request
      java.lang.String toString()
      Return a string representation for this object
      void unsetCookie​(java.lang.String key)
      Unset a previously set HTTP cookie, causing it to be discarded immedialtely by the HTTP client.
      void write​(java.lang.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 writeln()
      Write a platform dependent newline sequence to response buffer.
      void writeln​(java.lang.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 Detail

      • ResponseBean

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

      • encode

        public void encode​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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
      • 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​(java.lang.String key,
                              java.lang.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​(java.lang.String key,
                              java.lang.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​(java.lang.String key,
                              java.lang.String value,
                              int days,
                              java.lang.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​(java.lang.String key,
                              java.lang.String value,
                              int days,
                              java.lang.String path,
                              java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String... messages)
        add an HTML formatted debug message to the end of the page.
        Parameters:
        message - the message
      • toString

        public java.lang.String toString()
        Return a string representation for this object
        Overrides:
        toString in class java.lang.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 java.lang.String getCharset()
        Get the current charset/encoding name for the response
        Returns:
        The charset name
      • setCharset

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public java.lang.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 java.util.Date getLastModified()
        Get the last modified date for this response
        Returns:
        the last modified date
      • setLastModified

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

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

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

        public void dependsOn​(java.lang.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 java.lang.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 java.lang.String popStringBuffer()
        Deprecated.
        Old version for pop() kept for compatibility
        Returns:
        ...
      • pushBuffer

        public java.lang.StringBuffer pushBuffer​(java.lang.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 java.lang.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 java.lang.StringBuffer popBuffer()
        Pops the current response buffer without converting it to a string
        Returns:
        the stringBuffer
      • getBuffer

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

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

        public void rollback()
                      throws java.lang.Exception
        Rollback the current transaction and start a new one.
        Throws:
        java.lang.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