Package org.commonjava.test.http.expect
Class ExpectationServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.commonjava.test.http.expect.ExpectationServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public final class ExpectationServlet extends javax.servlet.http.HttpServlet- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExpectationServlet()ExpectationServlet(String baseResource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexpect(String method, String testUrl, int responseCode, InputStream bodyStream)voidexpect(String method, String testUrl, int responseCode, String body)voidexpect(String method, String testUrl, ExpectationHandler handler)Map<String,Integer>getAccessesByPath()IntegergetAccessesFor(String path)IntegergetAccessesFor(String method, String path)StringgetAccessKey(String method, String path)StringgetAccessKey(CommonMethod method, String path)StringgetBaseResource()Map<String,ContentResponse>getRegisteredErrors()voidregisterException(String method, String path, int code, String error)protected voidservice(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Constructor Detail
-
ExpectationServlet
public ExpectationServlet()
-
ExpectationServlet
public ExpectationServlet(String baseResource)
-
-
Method Detail
-
getRegisteredErrors
public Map<String,ContentResponse> getRegisteredErrors()
-
getBaseResource
public String getBaseResource()
-
registerException
public void registerException(String method, String path, int code, String error)
-
expect
public void expect(String method, String testUrl, int responseCode, InputStream bodyStream)
-
expect
public void expect(String method, String testUrl, ExpectationHandler handler)
-
service
protected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException- Overrides:
servicein classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
getAccessKey
public String getAccessKey(CommonMethod method, String path)
-
-