Sun Adapter for HTTP API

com.stc.connector.otd.httpserveradapter.webservice
Class WebResponse

java.lang.Object
  extended by com.stc.connector.otd.httpserveradapter.webservice.WebResponse
All Implemented Interfaces:
com.stc.connector.persistence.bpel.PersistableData

public class WebResponse
extends java.lang.Object
implements com.stc.connector.persistence.bpel.PersistableData

This interface represents an Web HTTP response.

Version:
$Revision: 1.7 $

Field Summary
static java.lang.String CONTENT_TYPE_TEXT
           
static java.lang.String CONTENT_TYPE_URLENCODED
           
 
Constructor Summary
WebResponse()
          Constructor.
WebResponse(HttpServletResponse response)
          Constructor.
 
Method Summary
 byte[] getByteArray()
          Returns the contents of the response as a byte array.
 int getContentLength()
          Returns the length of the content body in the response In HTTP servlets.
 java.lang.String getContentType()
          Returns the content type of the response being sent to the client.
 Cookie getCookie()
          Returns the cookie in the specified index.
 int getErrorStatusCode()
          Returns the error status code to be sent to the client.
 java.lang.String getErrorStatusMsg()
          Returns the error status message to be sent to the client.
 WebHeaderList getHeaderInfo()
          Returns a WebHeaderList representing the headers of this response.
 java.lang.String getRedirectLocation()
          Returns the redirect location.
 int getStatus()
          Returns the status code for this response.
 java.lang.String getText()
          Returns the contents of the response as a string.
 void persist(com.stc.connector.persistence.bpel.DataOutput dos)
          Persists (serialize) this message.
 void restore(com.stc.connector.persistence.bpel.DataInput dis)
          Restore (deserialize) this message.
 void setByteArray(byte[] c)
          Sets the contents of the response as a byte array.
 void setContentLength(int len)
          Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.
 void setContentType(java.lang.String type)
          Sets the content type of the response being sent to the client.
 void setCookie(Cookie c)
          Adds the specified cookie to the response.
 void setErrorStatusCode(int sc)
          Sets the error status code to be sent to the client.
 void setErrorStatusMsg(java.lang.String msg)
          Sets the error status message to be sent to the client.
 void setHeaderInfo(WebHeaderList h)
          Sets the WebHeaderList representing headers of this response.
 void setRedirectLocation(java.lang.String loc)
          Sets the redirect location.
 void setStatus(int sc)
          Sets the status code for this response.
 void setText(java.lang.String c)
          Sets the contents of the response as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE_TEXT

public static final java.lang.String CONTENT_TYPE_TEXT
See Also:
Constant Field Values

CONTENT_TYPE_URLENCODED

public static final java.lang.String CONTENT_TYPE_URLENCODED
See Also:
Constant Field Values
Constructor Detail

WebResponse

public WebResponse()
Constructor.


WebResponse

public WebResponse(HttpServletResponse response)
Constructor.

Method Detail

setCookie

public void setCookie(Cookie c)
Adds the specified cookie to the response.

Parameters:
c - Cookie to set

getCookie

public Cookie getCookie()
Returns the cookie in the specified index.

Returns:
Cookie to return

getHeaderInfo

public WebHeaderList getHeaderInfo()
Returns a WebHeaderList representing the headers of this response.

Returns:
WebHeaderList of the headers of this response.

setHeaderInfo

public void setHeaderInfo(WebHeaderList h)
Sets the WebHeaderList representing headers of this response.

Parameters:
h - WebHeaderList of the headers of this response.

getRedirectLocation

public java.lang.String getRedirectLocation()
Returns the redirect location.

Returns:
redirect location

setRedirectLocation

public void setRedirectLocation(java.lang.String loc)
Sets the redirect location.

Parameters:
loc - redirect location

getErrorStatusCode

public int getErrorStatusCode()
Returns the error status code to be sent to the client.

Returns:
Error status code.

setErrorStatusCode

public void setErrorStatusCode(int sc)
Sets the error status code to be sent to the client.

Parameters:
sc - Error status code.

getErrorStatusMsg

public java.lang.String getErrorStatusMsg()
Returns the error status message to be sent to the client.

Returns:
Error status message.

setErrorStatusMsg

public void setErrorStatusMsg(java.lang.String msg)
Sets the error status message to be sent to the client.

Parameters:
msg - Error status message.

getStatus

public int getStatus()
Returns the status code for this response.

Returns:
Status code

setStatus

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

Parameters:
sc - Status code to set

getContentLength

public int getContentLength()
Returns the length of the content body in the response In HTTP servlets.

Returns:
len an integer specifying the length of the content being returned to the client

setContentLength

public void setContentLength(int len)
Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header.

Parameters:
len - an integer specifying the length of the content being returned to the client; sets the Content-Length header

getContentType

public java.lang.String getContentType()
Returns the content type of the response being sent to the client. The content type may include the type of character encoding used, for example, text/html; charset=ISO-8859-4.

Returns:
a String specifying the MIME type of the content

setContentType

public void setContentType(java.lang.String type)
Sets the content type of the response being sent to the client. The content type may include the type of character encoding used, for example, text/html; charset=ISO-8859-4. If obtaining a PrintWriter, this method should be called first.

Parameters:
type - a String specifying the MIME type of the content

getByteArray

public byte[] getByteArray()
Returns the contents of the response as a byte array.

Returns:
Contents of the response as a byte array.

setByteArray

public void setByteArray(byte[] c)
Sets the contents of the response as a byte array.

Parameters:
c - Byte array to set contents to

setText

public void setText(java.lang.String c)
Sets the contents of the response as a string.

Parameters:
c - Contents of the response as a String; null if not available

getText

public java.lang.String getText()
Returns the contents of the response as a string.

Returns:
Contents of the response as a string; null if not available

persist

public void persist(com.stc.connector.persistence.bpel.DataOutput dos)
             throws java.lang.Exception
Persists (serialize) this message.

Specified by:
persist in interface com.stc.connector.persistence.bpel.PersistableData
Parameters:
dos - The DataOutputStream to which the Java Bean message is persisted.
Throws:
java.lang.Exception - upon error.

restore

public void restore(com.stc.connector.persistence.bpel.DataInput dis)
             throws java.lang.Exception
Restore (deserialize) this message.

Specified by:
restore in interface com.stc.connector.persistence.bpel.PersistableData
Parameters:
dis - The DataInputStream from which the Java Bean message is restored.
Throws:
java.lang.Exception - upon error.

Sun Adapter for HTTP API

Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.