com.plumtree.uiinfrastructure.activityspace
Class WebData

java.lang.Object
  extended by com.plumtree.uiinfrastructure.activityspace.WebData
All Implemented Interfaces:
IWebData

public class WebData
extends java.lang.Object
implements IWebData

This object wraps HTMLPages and binary data for output to the browser. There will be methods for setting HTTP Headers for the browser. This implementation of the IWebData interface is intended for use by the Interpreter.

Author:
Don Hayler, DaniilK

Constructor Summary
WebData(IXPResponse _response, java.lang.String _strImageBaseURL, int _nSecurityMode, boolean _isSecure, BrowserType _ptBrowserType)
          Creates a new WebData object.
 
Method Summary
 void AddCookie(XPCookie c)
          Call this method to add a cookie to the response.
 void ClearAllData()
          This method is used to clear all of the underlying data from this object to ensure that no memory is "leaked" if a Display Page mistakenly maintains a reference to this object.
 void ClearOutputData()
          This clears the data to be output (text or binary) so that this object can be used again.
 void FlushData()
          This optional method flushes all current data in the HTMLPage to the browser.
 boolean HasSentData()
          This method tells you whether or not the data on this object has already been sent using the OutputData() method.
 boolean IsBinaryData()
          This method tells you whether or not the data on this object is binary.
 boolean IsDataSet()
          This method tells you whether or not the data on this object is already set using either of the SetData() methods.
 boolean IsHTMLData()
          This method tells you whether or not the data on this object is HTML text.
 void OutputData()
          This method outputs the data to the browser.
 boolean RequireNonEmptyBody(boolean bRequireNonEmptyBody)
          This method determines if WebData object will throw an exception in case of sending an empty body of not.
 void SendRedirect(java.lang.String _strLocation)
          Sends a true 302 redirect immediatly.
 void SetContentLanguage(java.lang.String _sLocale)
          JF- Helper method to set the content language header from the locale.
 void SetData(byte[] arrBodyBinary)
          This method sets array of bytes as the data to be sent to the browser.
 void SetData(HTMLElement element)
          This method sets the HTMLElement as the data to be sent to the browser.
 void SetData(java.lang.String strData)
          This method sets string as the data to be sent to the browser.
 void SetDataSent()
          This method marks the data as being sent so that this page cannot be redisplayed.
 void SetDateHeader(java.lang.String strHeaderName, XPDateTime xpDate)
          Sets a response date header with the given name and date-value.
 void SetHeader(java.lang.String strHeaderName, java.lang.String strHeaderValue)
          This method sets a specified header on the response.
 void SetIsHTMLText(boolean _bIsHTMLText)
          This method specifies whether the text data for this WebData object is HTML or not.
 void setResponse(IXPResponse _response)
           
 void SetStatus(int iStatus)
          This method sets a status of the response.,
 void SetSuppressAutomaticHeaders(boolean bSuppress)
          This method turns on or off automatic HTTP headers (such as the automatic expires header set to now).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebData

public WebData(IXPResponse _response,
               java.lang.String _strImageBaseURL,
               int _nSecurityMode,
               boolean _isSecure,
               BrowserType _ptBrowserType)
Creates a new WebData object. This should only be created by the Interpreter.

Parameters:
_response - IXPResponse assigned to the member variable m_xpResponse
_strImageBaseURL - String assigned to the member variable m_strImageBaseURL
_nSecurityMode - int assigned to the member variable _nSecurityMode
_isSecure - boolean assigned to the member variable m_bIsSecure
_ptBrowserType - BrowserType assigned to the member variable m_ptBrowserType
Method Detail

setResponse

public void setResponse(IXPResponse _response)

RequireNonEmptyBody

public boolean RequireNonEmptyBody(boolean bRequireNonEmptyBody)
This method determines if WebData object will throw an exception in case of sending an empty body of not.

Specified by:
RequireNonEmptyBody in interface IWebData
Parameters:
bRequireNonEmptyBody - - TRUE if you want WebData object to throw an exception in case of sending an emptry body, FALSE otherwise.
Returns:
previous value of the flag

SetContentLanguage

public void SetContentLanguage(java.lang.String _sLocale)
JF- Helper method to set the content language header from the locale.

Specified by:
SetContentLanguage in interface IWebData
Parameters:
_sLocale - (e.g.: en-US)

AddCookie

public void AddCookie(XPCookie c)
Call this method to add a cookie to the response.

Specified by:
AddCookie in interface IWebData
Parameters:
XPCookie - Pass an XPCookie

ClearAllData

public void ClearAllData()
This method is used to clear all of the underlying data from this object to ensure that no memory is "leaked" if a Display Page mistakenly maintains a reference to this object.


ClearOutputData

public void ClearOutputData()
This clears the data to be output (text or binary) so that this object can be used again. Some of this data can still be transmitted if it has already been written to the response by the time this method is called.


FlushData

public void FlushData()
Description copied from interface: IWebData
This optional method flushes all current data in the HTMLPage to the browser. This should only be called when the banner has been fully added to the HTMLPage. This method requires SetData to have been called first. This means that the HTMLHead element must be completed and that all HTMLObjects (like tables) that are currently in the HTMLBody element need to be complete. Data will not be able to be added to them after flushing. Data will be able to be added to the HTMLBody only. This is not currently implemented.

Specified by:
FlushData in interface IWebData
See Also:
This method flushes all current data in the HTMLPage to the browser. This should only be called when the banner has been fully added to the HTMLPage. This method requires SetData to have been called first. This means that the HTMLHead element must be completed and that all HTMLObjects (like tables) that are currently in the HTMLBody element need to be complete. Data will not be able to be added to them after flushing. Data will be able to be added to the HTMLBody only.

IsBinaryData

public boolean IsBinaryData()
This method tells you whether or not the data on this object is binary. If it is binary, you can't add text data after the binary data.

Returns:
boolean true implies binary data

IsHTMLData

public boolean IsHTMLData()
This method tells you whether or not the data on this object is HTML text.

Returns:
boolean true implies HTML text data

IsDataSet

public boolean IsDataSet()
This method tells you whether or not the data on this object is already set using either of the SetData() methods.

Returns:
boolean true implies data set

HasSentData

public boolean HasSentData()
This method tells you whether or not the data on this object has already been sent using the OutputData() method.

Returns:
boolean true implies data sent

SetDataSent

public void SetDataSent()
This method marks the data as being sent so that this page cannot be redisplayed.


OutputData

public void OutputData()
This method outputs the data to the browser. This should only be called by the Interpreter after data has been set on this object by the IDisplayPage.


SendRedirect

public void SendRedirect(java.lang.String _strLocation)
Sends a true 302 redirect immediatly.

Specified by:
SendRedirect in interface IWebData
Parameters:
_strLocation - Where to go

SetData

public void SetData(HTMLElement element)
Description copied from interface: IWebData
This method sets the HTMLElement as the data to be sent to the browser. The element should be an HTMLPage element in most cases - the only time that the element will not be an HTMLPage is when you want to display partial page content. Only one SetData method should be called.

Specified by:
SetData in interface IWebData

SetData

public void SetData(java.lang.String strData)
Description copied from interface: IWebData
This method sets string as the data to be sent to the browser. Only one SetData method should be called.

Specified by:
SetData in interface IWebData
Parameters:
String - text to output to the browser
See Also:
This method sets the string for output to the browser. Only one SetData method should be called.

SetData

public void SetData(byte[] arrBodyBinary)
Description copied from interface: IWebData
This method sets array of bytes as the data to be sent to the browser. Only one SetData method should be called.

Specified by:
SetData in interface IWebData
Parameters:
HTMLPage - page to output to the browser
See Also:
This method sets the HTMLPage for output to the browser. Only one SetData method should be called.

SetIsHTMLText

public void SetIsHTMLText(boolean _bIsHTMLText)
Description copied from interface: IWebData
This method specifies whether the text data for this WebData object is HTML or not. This method is not relevant for binary data. Text data is assumed to be HTML by default.

Specified by:
SetIsHTMLText in interface IWebData

SetHeader

public void SetHeader(java.lang.String strHeaderName,
                      java.lang.String strHeaderValue)
Description copied from interface: IWebData
This method sets a specified header on the response.

Specified by:
SetHeader in interface IWebData
Parameters:
String - header name
String - header value
See Also:
This method sets a HTTP header to a specified value

SetDateHeader

public void SetDateHeader(java.lang.String strHeaderName,
                          XPDateTime xpDate)
Description copied from interface: IWebData
Sets a response date header with the given name and date-value.

Specified by:
SetDateHeader in interface IWebData
See Also:
IWebData.SetDateHeader(String, XPDateTime)

SetStatus

public void SetStatus(int iStatus)
Description copied from interface: IWebData
This method sets a status of the response.,

Specified by:
SetStatus in interface IWebData
Parameters:
iStatus -

SetSuppressAutomaticHeaders

public void SetSuppressAutomaticHeaders(boolean bSuppress)
This method turns on or off automatic HTTP headers (such as the automatic expires header set to now). Default is to add automatic HTTP headers.

Parameters:
boolean - true implies suppress automatic headers false implies show automatic headers



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