Search in sources :

Example 6 with PostResponse

use of org.apache.sling.servlets.post.PostResponse in project sling by apache.

the class SlingPostServletTest method testRedirection.

private void testRedirection(String requestPath, String resourcePath, String redirect, String expected) throws Exception {
    RedirectServletResponse resp = new RedirectServletResponse();
    SlingHttpServletRequest request = new RedirectServletRequest(redirect, requestPath);
    PostResponse htmlResponse = new HtmlResponse();
    htmlResponse.setPath(resourcePath);
    assertEquals(expected != null, servlet.redirectIfNeeded(request, htmlResponse, resp));
    assertEquals(expected, resp.redirectLocation);
}
Also used : HtmlResponse(org.apache.sling.servlets.post.HtmlResponse) SlingHttpServletRequest(org.apache.sling.api.SlingHttpServletRequest) MockSlingHttpServletRequest(org.apache.sling.commons.testing.sling.MockSlingHttpServletRequest) PostResponse(org.apache.sling.servlets.post.PostResponse)

Aggregations

PostResponse (org.apache.sling.servlets.post.PostResponse)6 IOException (java.io.IOException)4 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)4 MockSlingHttpServlet3Request (org.apache.sling.servlets.post.impl.helper.MockSlingHttpServlet3Request)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 Calendar (java.util.Calendar)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 Part (javax.servlet.http.Part)3 ModifiableValueMap (org.apache.sling.api.resource.ModifiableValueMap)3 PersistenceException (org.apache.sling.api.resource.PersistenceException)3 Resource (org.apache.sling.api.resource.Resource)3 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)3 ValueMap (org.apache.sling.api.resource.ValueMap)3 MockResourceResolver (org.apache.sling.commons.testing.sling.MockResourceResolver)3 AbstractPostResponse (org.apache.sling.servlets.post.AbstractPostResponse)3 Modification (org.apache.sling.servlets.post.Modification)3