com.plumtree.openfoundation.web
Class XPResponse

java.lang.Object
  extended by com.plumtree.openfoundation.web.XPResponse
All Implemented Interfaces:
IXPResponse

public class XPResponse
extends java.lang.Object
implements IXPResponse

An XPResponse is an implementation of IXPResponse and provides Similar functionality equivalent to HttpServletResponse.


Constructor Summary
XPResponse(HttpServletResponse response)
          Creates a XPResponse Object from a given HttpServletResponse.
 
Method Summary
 void AddCookie(XPCookie cookie)
          Adds the specified cookie to the response.
 void AddHeader(java.lang.String name, java.lang.String _value)
          Adds a response header with the given name and value.
 void Clear()
          Clears any data that exists in the buffer as well as the status code and headers.
 void ClearUnderlyingObject()
          This method clears all the instance variables to avoid memory leak.
 java.lang.String EncodeRedirectURL(java.lang.String url)
          Deprecated. This method is deprecated because Redirect() method already encodes url
 void Flush()
          This method writes all data to the client.
 java.lang.String GetCharacterEncoding()
          Returns the name of the charset used for the MIME body sent in this response If no charset has been assigned, it is implicitly set to ISO-8859-1 (Latin-1).
 XPOutputStream GetOutputStream()
          This method returns an output stream for writing binary data to the client.
 HttpServletResponse GetUnderlyingObject()
          Returns underlying HttpServletResponse object.
 void Redirect(java.lang.String url)
          Sends a temporary redirect response to the client using the specified redirect location URL.
 void SetContentType(java.lang.String type)
          Sets the content type of the response being sent to the client.
 void SetDateHeader(java.lang.String name, long date)
          Sets a response header with the given name and date-value.
 void SetStatus(int sc)
          Sets the status code for this response.
 void SetStatus(int sc, java.lang.String msg)
          Sets the status code and message for this response.
 void Write(char c)
          This method writes a character to the client.
 void Write(char[] s)
          This method writes an array of characters to the client.
 void Write(java.lang.Object o)
          This method writes an object to the client.
 void Write(java.lang.String s)
          This method writes a string to the client.
 void WriteLine(char c)
          This method writes a character followed by an end of line to the client.
 void WriteLine(char[] s)
          This method writes an array of characters followed by an end of line to the client.
 void WriteLine(java.lang.Object o)
          This method writes an object followed by an end of line to the client.
 void WriteLine(java.lang.String s)
          This method writes a string followed by an end of line to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPResponse

public XPResponse(HttpServletResponse response)
Creates a XPResponse Object from a given HttpServletResponse.

Parameters:
response - HttpServletResponse Object to be wrapped.
Method Detail

Flush

public void Flush()
This method writes all data to the client. This automatically writes the status code and headers.

Specified by:
Flush in interface IXPResponse

GetOutputStream

public XPOutputStream GetOutputStream()
This method returns an output stream for writing binary data to the client.

Specified by:
GetOutputStream in interface IXPResponse
Returns:
OutputStream wrapped in XPOutputStream object

GetCharacterEncoding

public java.lang.String GetCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response If no charset has been assigned, it is implicitly set to ISO-8859-1 (Latin-1).

Specified by:
GetCharacterEncoding in interface IXPResponse
Returns:
String representing the character encoding.

Clear

public void Clear()
Clears any data that exists in the buffer as well as the status code and headers.

Specified by:
Clear in interface IXPResponse

SetContentType

public void SetContentType(java.lang.String type)
Sets the content type of the response being sent to the client.

Specified by:
SetContentType in interface IXPResponse
Parameters:
type - - content type to be sent.

SetDateHeader

public void SetDateHeader(java.lang.String name,
                          long date)
Sets a response header with the given name and date-value.

Specified by:
SetDateHeader in interface IXPResponse
Parameters:
name - - a String containing name of the Date header.
date - - a long containing date in milliseconds since EPOCH. Use XPDateTime.GetTimeInMilliseconds() to produce a commensurate value.

AddCookie

public void AddCookie(XPCookie cookie)
Adds the specified cookie to the response.

Specified by:
AddCookie in interface IXPResponse
Parameters:
cookie - the XPCookie object to add to the response.

EncodeRedirectURL

public java.lang.String EncodeRedirectURL(java.lang.String url)
Deprecated. This method is deprecated because Redirect() method already encodes url

Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged.

Specified by:
EncodeRedirectURL in interface IXPResponse
Parameters:
url - url string to be encoded.
Returns:
encoded url string.

AddHeader

public void AddHeader(java.lang.String name,
                      java.lang.String _value)
Adds a response header with the given name and value.

Specified by:
AddHeader in interface IXPResponse
Parameters:
name - - name of the header to be set
_value - - value of the header to be set

Redirect

public void Redirect(java.lang.String url)
Sends a temporary redirect response to the client using the specified redirect location URL.

Specified by:
Redirect in interface IXPResponse
Parameters:
url - - the redirect location url

SetStatus

public void SetStatus(int sc)
Sets the status code for this response.

Specified by:
SetStatus in interface IXPResponse
Parameters:
sc - - the status code.

SetStatus

public void SetStatus(int sc,
                      java.lang.String msg)
Sets the status code and message for this response.

Specified by:
SetStatus in interface IXPResponse
Parameters:
sc - - the status code.
msg - - the status msg.

Write

public void Write(char c)
This method writes a character to the client. Either the Write methods or the GetOutputStream() method may be used to output data, but not both.

Specified by:
Write in interface IXPResponse
Parameters:
c - - the character to be written.

Write

public void Write(java.lang.Object o)
This method writes an object to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
Write in interface IXPResponse
Parameters:
o - - the object to be written.

Write

public void Write(java.lang.String s)
This method writes a string to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
Write in interface IXPResponse
Parameters:
s - - the String to be written.

Write

public void Write(char[] s)
This method writes an array of characters to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
Write in interface IXPResponse
Parameters:
s - - the arry of characters to be written.

WriteLine

public void WriteLine(char c)
This method writes a character followed by an end of line to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
WriteLine in interface IXPResponse
Parameters:
c - - the character to be written.

WriteLine

public void WriteLine(java.lang.Object o)
This method writes an object followed by an end of line to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
WriteLine in interface IXPResponse
Parameters:
o - - the object to be written.

WriteLine

public void WriteLine(java.lang.String s)
This method writes a string followed by an end of line to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
WriteLine in interface IXPResponse
Parameters:
s - - the String to be written.

WriteLine

public void WriteLine(char[] s)
This method writes an array of characters followed by an end of line to the client. Either the Write* methods or the GetOutputStream() method may be used to output data, but not both. Calling the Write* methods can be significantly slower than just calling GetOutputStream() once and writing lot's of data to that XPOutputStream.

Specified by:
WriteLine in interface IXPResponse
Parameters:
s - - the arry of characters to be written.

GetUnderlyingObject

public HttpServletResponse GetUnderlyingObject()
Returns underlying HttpServletResponse object.

Returns:
HttpServletResponse object.

ClearUnderlyingObject

public void ClearUnderlyingObject()
This method clears all the instance variables to avoid memory leak.

Specified by:
ClearUnderlyingObject in interface IXPResponse


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.