|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.htmlunit.MockWebConnection
public class MockWebConnection
A fake WebConnection designed to mock out the actual HTTP connections.
| Constructor Summary | |
|---|---|
MockWebConnection()
|
|
| Method Summary | |
|---|---|
java.util.Map<java.lang.String,java.lang.String> |
getLastAdditionalHeaders()
Returns the additional headers that were used in the in the last call to getResponse(WebRequestSettings). |
HttpMethod |
getLastMethod()
Returns the method that was used in the last call to submitRequest(). |
java.util.List<org.apache.commons.httpclient.NameValuePair> |
getLastParameters()
Returns the parameters that were used in the last call to submitRequest(). |
WebRequestSettings |
getLastWebRequestSettings()
Returns the WebRequestSettings that was used in the in the last call
to getResponse(WebRequestSettings). |
int |
getRequestCount()
Returns the number of requests made to this mock web connection. |
WebResponse |
getResponse(WebRequestSettings settings)
Submits a request and retrieves a response. |
void |
setDefaultResponse(byte[] content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType)
Sets the response that will be returned when a URL is requested that does not have a specific content set for it. |
void |
setDefaultResponse(java.lang.String content)
Sets the response that will be returned when a URL is requested that does not have a specific content set for it. |
void |
setDefaultResponse(java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType)
Sets the response that will be returned when a URL is requested that does not have a specific content set for it. |
void |
setDefaultResponse(java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
Sets the response that will be returned when the specified URL is requested. |
void |
setDefaultResponse(java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.lang.String charset,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
Sets the response that will be returned when the specified URL is requested. |
void |
setDefaultResponse(java.lang.String content,
java.lang.String contentType)
Sets the response that will be returned when a URL is requested that does not have a specific content set for it. |
void |
setDefaultResponse(java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
Sets the response that will be returned when a URL is requested that does not have a specific content set for it. |
void |
setResponse(java.net.URL url,
byte[] content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
Sets the response that will be returned when the specified URL is requested. |
void |
setResponse(java.net.URL url,
java.lang.String content)
Convenient method that is the same as calling setResponse(URL,String,int,String,String,List) with a status
of "200 OK", a content type of "text/html" and no additional headers. |
void |
setResponse(java.net.URL url,
java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
Sets the response that will be returned when the specified URL is requested. |
void |
setResponse(java.net.URL url,
java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.lang.String charset,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
Sets the response that will be returned when the specified URL is requested. |
void |
setResponse(java.net.URL url,
java.lang.String content,
java.lang.String contentType)
Convenient method that is the same as calling setResponse(URL,String,int,String,String,List) with a status
of "200 OK" and no additional headers. |
void |
setResponse(java.net.URL url,
java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
Convenient method that is the same as calling setResponse(URL,String,int,String,String,String,List) with a status
of "200 OK" and no additional headers. |
void |
setResponseAsGenericHtml(java.net.URL url,
java.lang.String title)
Specify a generic HTML page that will be returned when the given URL is specified. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockWebConnection()
| Method Detail |
|---|
public WebResponse getResponse(WebRequestSettings settings)
throws java.io.IOException
getResponse in interface WebConnectionsettings - Settings to make the request with
java.io.IOException - if an IO error occurspublic HttpMethod getLastMethod()
public java.util.List<org.apache.commons.httpclient.NameValuePair> getLastParameters()
public void setResponse(java.net.URL url,
java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
url - the URL that will return the given responsecontent - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to returnresponseHeaders - the response headers to return
public void setResponse(java.net.URL url,
java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.lang.String charset,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
url - the URL that will return the given responsecontent - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to returncharset - the name of a supported charsetresponseHeaders - the response headers to return
public void setResponse(java.net.URL url,
byte[] content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
url - the URL that will return the given responsecontent - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to returnresponseHeaders - the response headers to return
public void setResponse(java.net.URL url,
java.lang.String content)
setResponse(URL,String,int,String,String,List) with a status
of "200 OK", a content type of "text/html" and no additional headers.
url - the URL that will return the given responsecontent - the content to return
public void setResponse(java.net.URL url,
java.lang.String content,
java.lang.String contentType)
setResponse(URL,String,int,String,String,List) with a status
of "200 OK" and no additional headers.
url - the URL that will return the given responsecontent - the content to returncontentType - the content type to return
public void setResponse(java.net.URL url,
java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
setResponse(URL,String,int,String,String,String,List) with a status
of "200 OK" and no additional headers.
url - the URL that will return the given responsecontent - the content to returncontentType - the content type to returncharset - the name of a supported charset
public void setResponseAsGenericHtml(java.net.URL url,
java.lang.String title)
url - the URL that will return the given responsetitle - the title of the page
public void setDefaultResponse(java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType)
content - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to return
public void setDefaultResponse(byte[] content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType)
content - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to returnpublic void setDefaultResponse(java.lang.String content)
content - the content to return
public void setDefaultResponse(java.lang.String content,
java.lang.String contentType)
content - the content to returncontentType - the content type to return
public void setDefaultResponse(java.lang.String content,
java.lang.String contentType,
java.lang.String charset)
content - the content to returncontentType - the content type to returncharset - the name of a supported charset
public void setDefaultResponse(java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
content - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to returnresponseHeaders - the response headers to return
public void setDefaultResponse(java.lang.String content,
int statusCode,
java.lang.String statusMessage,
java.lang.String contentType,
java.lang.String charset,
java.util.List<? extends org.apache.commons.httpclient.NameValuePair> responseHeaders)
content - the content to returnstatusCode - the status code to returnstatusMessage - the status message to returncontentType - the content type to returncharset - the name of a supported charsetresponseHeaders - the response headers to returnpublic java.util.Map<java.lang.String,java.lang.String> getLastAdditionalHeaders()
getResponse(WebRequestSettings).
getResponse(WebRequestSettings)public WebRequestSettings getLastWebRequestSettings()
WebRequestSettings that was used in the in the last call
to getResponse(WebRequestSettings).
WebRequestSettings that was used in the in the last call
to getResponse(WebRequestSettings)public int getRequestCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||