org.springframework.test.web.servlet.htmlunit
Class MockMvcWebConnection
java.lang.Object
org.springframework.test.web.servlet.htmlunit.MockMvcWebConnection
- All Implemented Interfaces:
- com.gargoylesoftware.htmlunit.WebConnection
public final class MockMvcWebConnection
- extends java.lang.Object
- implements com.gargoylesoftware.htmlunit.WebConnection
Allows MockMvc
to transform a WebRequest
into a WebResponse
. This is the core integration
with HTML Unit.
Example usage can be seen below:
MockMvc mockMvc = ...
MockMvcWebConnection webConnection = new MockMvcWebConnection(mockMvc);
WebClient webClient = new WebClient();
webClient.setWebConnection(webConnection);
... use webClient as normal ...
Currently the WebConnection assumes that the first path segment is the context root of the application. For example,
the URL http://localhost/context/test/this would use /context as the context root.
- Author:
- Rob Winch
- See Also:
MockMvcHtmlUnitDriver
,
GebSpecTestExecutionListener
Method Summary |
com.gargoylesoftware.htmlunit.WebResponse |
getResponse(com.gargoylesoftware.htmlunit.WebRequest webRequest)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MockMvcWebConnection
public MockMvcWebConnection(org.springframework.test.web.servlet.MockMvc mockMvc)
getResponse
public com.gargoylesoftware.htmlunit.WebResponse getResponse(com.gargoylesoftware.htmlunit.WebRequest webRequest)
throws java.io.IOException
- Specified by:
getResponse
in interface com.gargoylesoftware.htmlunit.WebConnection
- Throws:
java.io.IOException