org.apache.cactus
Class WebResponse

java.lang.Object
  extended byorg.apache.cactus.WebResponse

public class WebResponse
extends java.lang.Object

Default web response implementation that provides a minimal API for asserting returned output stream from the server side. For more complex assertions, use an com.meterware.httpunit.WebResponse instead as parameter of your endXXX() methods.

Version:
$Id: WebResponse.java,v 1.15 2003/07/07 10:50:07 cmlenz Exp $
Author:
Vincent Massol

Constructor Summary
WebResponse(WebRequest theRequest, java.net.HttpURLConnection theConnection)
           
 
Method Summary
 java.net.HttpURLConnection getConnection()
           
 Cookie getCookie(java.lang.String theName)
          Return the first cookie found that has the specified name or null if not found.
 Cookie getCookieIgnoreCase(java.lang.String theName)
          Return the first cookie found that has the specified name or null if not found.
 Cookie[] getCookies()
           
 java.io.InputStream getInputStream()
           
 int getStatusCode()
          Returns the status code returned by the server.
 java.lang.String getText()
           
 java.lang.String[] getTextAsArray()
           
 WebRequest getWebRequest()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebResponse

public WebResponse(WebRequest theRequest,
                   java.net.HttpURLConnection theConnection)
Parameters:
theRequest - the request data that were used to open the connection to the server.
theConnection - the original HttpURLConnection used to call the URL
Method Detail

getConnection

public java.net.HttpURLConnection getConnection()
Returns:
the original HttpURLConnection used to call the URL

getWebRequest

public WebRequest getWebRequest()
Returns:
the request data the were used to open the connection to the server

getText

public java.lang.String getText()
Returns:
the text of the response (excluding headers) as a string.

getTextAsArray

public java.lang.String[] getTextAsArray()
Returns:
the text of the response (excluding headers) as an array of strings (each string is a separate line from the output stream).

getInputStream

public java.io.InputStream getInputStream()
Returns:
a buffered input stream for reading the response data.

getCookie

public Cookie getCookie(java.lang.String theName)
Return the first cookie found that has the specified name or null if not found.

Parameters:
theName - the cookie name to find
Returns:
the cookie or null if not found

getCookieIgnoreCase

public Cookie getCookieIgnoreCase(java.lang.String theName)
Return the first cookie found that has the specified name or null if not found. The name is case-insensitive.

Parameters:
theName - the cookie name to find (case-insensitive)
Returns:
the cookie or null if not found
Since:
1.5

getCookies

public Cookie[] getCookies()
Returns:
the cookies returned by the server

getStatusCode

public int getStatusCode()
Returns the status code returned by the server.

Returns:
The status code
Since:
1.5


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.