net.sf.javaprinciples
Class ServletSupport
java.lang.Object
net.sf.javaprinciples.ServletSupport
public class ServletSupport
- extends Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UNIT_LOCALID
public static final String UNIT_LOCALID
- See Also:
- Constant Field Values
UNIT_CORRELATIONID
public static final String UNIT_CORRELATIONID
- See Also:
- Constant Field Values
CONTEXT_PATH
public static final String CONTEXT_PATH
- See Also:
- Constant Field Values
config
protected javax.servlet.ServletConfig config
d
protected org.springframework.web.servlet.FrameworkServlet d
ServletSupport
public ServletSupport()
setFrameworkServlet
public void setFrameworkServlet(org.springframework.web.servlet.FrameworkServlet dispatcher)
setup
public void setup(org.springframework.context.ApplicationContext applicationContext)
throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
getWebApplicationContext
public org.springframework.web.context.WebApplicationContext getWebApplicationContext()
createMockPostRequest
public org.springframework.mock.web.MockHttpServletRequest createMockPostRequest(String uri)
createMockGetRequest
public org.springframework.mock.web.MockHttpServletRequest createMockGetRequest(String uri)
createMockPutRequest
public org.springframework.mock.web.MockHttpServletRequest createMockPutRequest(String uri)
createMockRequest
public org.springframework.mock.web.MockHttpServletRequest createMockRequest(String uri,
String httpMethod)
loadContent
public byte[] loadContent(String filename)
- Load content from the specified file using the classloader.
- Parameters:
filename -
- Returns:
assertResponse
public void assertResponse(org.springframework.mock.web.MockHttpServletResponse response,
String filename)
- Assert the response content against the content in the supplied file.
- Parameters:
response - The mock response containing the byte data.filename - The name of the file containing the expectation.
assertResponseToContent
public void assertResponseToContent(org.springframework.mock.web.MockHttpServletResponse response,
String expectedResponseContent)
- Assert the response content against the content in the supplied file.
- Parameters:
response - The mock response containing the byte data.expectedResponseContent - The expected content of the given response.
dispatch
public org.springframework.mock.web.MockHttpServletResponse dispatch(javax.servlet.http.HttpServletRequest request)
throws javax.servlet.ServletException,
IOException
- Throws:
javax.servlet.ServletException
IOException
loadXmlDocument
public static Document loadXmlDocument(String pathToResource)
throws SAXException,
IOException,
ParserConfigurationException
- Throws:
SAXException
IOException
ParserConfigurationException
documentToString
public static String documentToString(Document xmlDocument)
throws TransformerFactoryConfigurationError,
TransformerException
- Throws:
TransformerFactoryConfigurationError
TransformerException
Copyright © 2013. All Rights Reserved.