org.apache.cactus
class WebResponse

java.lang.Object
  |
  +--org.apache.cactus.WebResponse
Known Advisors:
LogAspect

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.2 2002/04/21 12:45:44 vmassol Exp $
Author:
Vincent Massol

Constructor Summary
WebResponse(WebRequest theRequest, HttpURLConnection theConnection)
           
 
Method Summary
 HttpURLConnection getConnection()
           
 Cookie getCookie(String theName)
          Return the first cookie found that has the specified name or null if not found.
          Affected by: LogAspect
 Cookie[] getCookies()
           
 InputStream getInputStream()
           
 String getText()
           
 String[] getTextAsArray()
           
 WebRequest getWebRequest()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebResponse

public WebResponse(WebRequest theRequest,
                   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 HttpURLConnection getConnection()
Returns:
the original HttpURLConnection used to call the URL

getCookie

public Cookie getCookie(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
Affected by:
around() in LogAspect.

getCookies

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

getInputStream

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

getText

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

getTextAsArray

public 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).

getWebRequest

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


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