HATS 7.5.1 Web API Reference

Publicly accessible methods not documented here are for IBM internal use only and may change in a future release of the product.

com.ibm.hats.web.runtime
Class WebResponse

java.lang.Object
  extended by com.ibm.hats.web.runtime.WebResponse
All Implemented Interfaces:
IResponse

public class WebResponse
extends Object
implements IResponse

Class Name: WebResponse
Class Type:
Normal
Base Class:
None
Intf Class:
IResponse
Description:
Provides a generic response object by wrapping an HttpServletResponse object.


Constructor Summary
WebResponse(javax.servlet.http.HttpServletResponse theHttpServletResponse)
          Create a wrapper for the HttpServletResponse object.
 
Method Summary
 void addHeader(String name, String value)
          Adds a response header with the given name and value.
 String encodeRedirectURL(String theURL)
          Encodes the specified URL for sendRedirect.
 String encodeURL(String theURL)
          Encodes the specified URL.
 boolean equals(Object webResponse)
          Compares the HttpServletResponse object contained within the specified object with the internal HttpServletResponse object.
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Get the httpServletResponse object wrapped by this object.
 OutputStream getOutputStream()
          Returns a ServletOutputStream suitable for writing binary data in the response.
 int hashCode()
          Returns the hash code.
 void sendRedirect(String theURL)
          Sends a temporary redirect response to the client.
 void setContentLength(int i)
          Sets the length of the content body in the response In HTTP servlets.
 void setContentType(String mimeType)
          Sets the content type of the response being sent to the client.
 void setDateHeader(String name, long date)
          Sets a response header with the given name and date-value.
 void setHeader(String name, String value)
          Sets a response header with the given name and value.
 void setHttpServletResponse(javax.servlet.http.HttpServletResponse theHttpServletResponse)
          Set the httpServletResponse that this object is wrapping.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebResponse

public WebResponse(javax.servlet.http.HttpServletResponse theHttpServletResponse)
Create a wrapper for the HttpServletResponse object.

Parameters:
theHttpServletResponse - The httpServletResponse object that needs to be wrapped. This value cannot be null.
Throws:
IllegalArgumentExeption - This exception is thrown if the input value is null.
Method Detail

encodeURL

public String encodeURL(String theURL)
Encodes the specified URL.

Specified by:
encodeURL in interface IResponse
Parameters:
theURL - The URL to encode if necessary.
Returns:
Returns the encoded URL or the original input URL unchanged.
See Also:
HttpServletResponse.encodeURL(java.lang.String)

encodeRedirectURL

public String encodeRedirectURL(String theURL)
Encodes the specified URL for sendRedirect.

Specified by:
encodeRedirectURL in interface IResponse
Parameters:
theURL - The URL to encode if necessary.
Returns:
Returns the encoded URL or the original input URL unchanged.
See Also:
HttpServletResponse.encodeRedirectURL(java.lang.String)

sendRedirect

public void sendRedirect(String theURL)
                  throws IOException
Sends a temporary redirect response to the client.

Specified by:
sendRedirect in interface IResponse
Parameters:
theURL - The redirect location URL.
Throws:
IOException
See Also:
HttpServletResponse.sendRedirect(java.lang.String)

setDateHeader

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

Specified by:
setDateHeader in interface IResponse
Parameters:
name - The name of the header to set.
date - The additional date value.
See Also:
HttpServletResponse.setDateHeader(java.lang.String, long)

setHeader

public void setHeader(String name,
                      String value)
Sets a response header with the given name and value.

Specified by:
setHeader in interface IResponse
Parameters:
name - The name of the header.
value - The header value.
See Also:
HttpServletResponse.setHeader(java.lang.String, java.lang.String)

addHeader

public void addHeader(String name,
                      String value)
Adds a response header with the given name and value.

Specified by:
addHeader in interface IResponse
Parameters:
name - The name of the header.
value - The additional header value.
See Also:
HttpServletResponse.addHeader(java.lang.String, java.lang.String)

getHttpServletResponse

public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Get the httpServletResponse object wrapped by this object.

Returns:
Returns the httpServletResponse object currently being wrapped.

setHttpServletResponse

public void setHttpServletResponse(javax.servlet.http.HttpServletResponse theHttpServletResponse)
Set the httpServletResponse that this object is wrapping.

Parameters:
theHttpServletResponse - The httpServletResponse object to wrap.

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Returns a ServletOutputStream suitable for writing binary data in the response.

Specified by:
getOutputStream in interface IResponse
Returns:
A ServletOutputStream for writing binary data.
Throws:
IOException
See Also:
ServletResponse.getOutputStream()

setContentLength

public void setContentLength(int i)
Sets the length of the content body in the response In HTTP servlets.

Specified by:
setContentLength in interface IResponse
Parameters:
i - The lenght of the content body.
See Also:
ServletResponse.setContentLength(int)

setContentType

public void setContentType(String mimeType)
Sets the content type of the response being sent to the client.

Specified by:
setContentType in interface IResponse
Parameters:
mimeType - Specifies the content type for the response.
See Also:
ServletResponse.setContentType(java.lang.String)

hashCode

public int hashCode()
Returns the hash code.

Overrides:
hashCode in class Object
Returns:
The hash code for this object. Currently not implemented. Returns the hash code for the base object.
See Also:
Object.hashCode()

equals

public boolean equals(Object webResponse)
Compares the HttpServletResponse object contained within the specified object with the internal HttpServletResponse object.

Overrides:
equals in class Object
Parameters:
webResponse - The WebResponse object used for compare.
Returns:
Returns true if the two references are equal, false otherwise.
See Also:
Object.equals(java.lang.Object)

HATS 7.5.1 (201005110649)