| java.lang.Object com.gargoylesoftware.htmlunit.WebConnectionImpl com.gargoylesoftware.htmlunit.MockWebConnection
MockWebConnection | public class MockWebConnection extends WebConnectionImpl (Code) | | A fake WebConnection designed to mock out the actual http connections.
version: $Revision: 2132 $ author: Mike Bowler author: Noboru Sinohara author: Marc Guillemot author: Brad Clarke author: Ahmed Ashour |
Method Summary | |
public Map | getLastAdditionalHeaders() Return the additional headers that were used in the in the last call
to
MockWebConnection.getResponse(WebRequestSettings) . | public SubmitMethod | getLastMethod() | public List | getLastParameters() | public WebRequestSettings | getLastWebRequestSettings() Return the
WebRequestSettings that was used in the in the last call
to
MockWebConnection.getResponse(WebRequestSettings) . | final protected Log | getLog() | public WebResponse | getResponse(WebRequestSettings webRequestSettings) | public HttpState | getState() | public void | setDefaultResponse(String content, int statusCode, String statusMessage, String contentType) Set the response that will be returned when a url is requested that does
not have a specific content set for it. | public void | setDefaultResponse(byte[] content, int statusCode, String statusMessage, String contentType) Set the response that will be returned when a url is requested that does
not have a specific content set for it. | public void | setDefaultResponse(String content) Set the response that will be returned when a url is requested that does
not have a specific content set for it. | public void | setResponse(URL url, String content, int statusCode, String statusMessage, String contentType, List responseHeaders) Set the response that will be returned when the specified url is requested. | public void | setResponse(URL url, byte[] content, int statusCode, String statusMessage, String contentType, List responseHeaders) Set the response that will be returned when the specified url is requested. | public void | setResponse(URL url, String content) Convenience method that is the same as calling
MockWebConnection.setResponse(URL,String,int,String,String,List) with a status
of "200 OK", a content type of "text/html" and no additional headers. | public void | setResponse(URL url, String content, String contentType) Convenience method that is the same as calling
MockWebConnection.setResponse(URL,String,int,String,String,List) with a status
of "200 OK" and no additional headers. | public void | setResponseAsGenericHtml(URL url, String title) Specify a generic html page that will be returned when the given url is specified. |
MockWebConnection | public MockWebConnection(WebClient webClient)(Code) | | Create an instance
Parameters: webClient - The web client |
getLastMethod | public SubmitMethod getLastMethod()(Code) | | Return the method that was used in the last call to submitRequest()
See above |
getLastParameters | public List getLastParameters()(Code) | | Return the parameters that were used in the last call to submitRequest()
See above |
getLog | final protected Log getLog()(Code) | | Return the log that is being used for all scripting objects
The log. |
getState | public HttpState getState()(Code) | | Return the
HttpState The state. |
setDefaultResponse | public void setDefaultResponse(String content, int statusCode, String statusMessage, String contentType)(Code) | | Set the response that will be returned when a url is requested that does
not have a specific content set for it.
Parameters: content - The content to return Parameters: statusCode - The status code to return Parameters: statusMessage - The status message to return Parameters: contentType - The content type to return |
setDefaultResponse | public void setDefaultResponse(byte[] content, int statusCode, String statusMessage, String contentType)(Code) | | Set the response that will be returned when a url is requested that does
not have a specific content set for it.
Parameters: content - The content to return Parameters: statusCode - The status code to return Parameters: statusMessage - The status message to return Parameters: contentType - The content type to return |
setDefaultResponse | public void setDefaultResponse(String content)(Code) | | Set the response that will be returned when a url is requested that does
not have a specific content set for it.
Parameters: content - The content to return |
setResponse | public void setResponse(URL url, String content, int statusCode, String statusMessage, String contentType, List responseHeaders)(Code) | | Set the response that will be returned when the specified url is requested.
Parameters: url - The url that will return the given response Parameters: content - The content to return Parameters: statusCode - The status code to return Parameters: statusMessage - The status message to return Parameters: contentType - The content type to return Parameters: responseHeaders - A list of KeyValuePairs that will be returned asresponse headers. |
setResponse | public void setResponse(URL url, byte[] content, int statusCode, String statusMessage, String contentType, List responseHeaders)(Code) | | Set the response that will be returned when the specified url is requested.
Parameters: url - The url that will return the given response Parameters: content - The content to return Parameters: statusCode - The status code to return Parameters: statusMessage - The status message to return Parameters: contentType - The content type to return Parameters: responseHeaders - A list of KeyValuePairs that will be returned asresponse headers. |
setResponseAsGenericHtml | public void setResponseAsGenericHtml(URL url, String title)(Code) | | Specify a generic html page that will be returned when the given url is specified.
The page will contain only minimal html to satisfy the html parser but will contain
the specified title so that tests can check for titleText.
Parameters: url - The url that will return the given response Parameters: title - The title of the page |
|
|