in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/RedirectOnLoginErrorTest.java [40:70]
private HttpMethod assertPostStatus(
String url, int expectedStatusCode, List<NameValuePair> postParams, String assertMessage, String referer)
throws IOException {
final PostMethod post = new PostMethod(url);
post.setFollowRedirects(false);
post.setDoAuthentication(false);
// set the referer to indicate where we came from
post.setRequestHeader("Referer", referer);
// set Accept header to trick sling into treating the request as from a browser
post.setRequestHeader("User-Agent", "Mozilla/5.0 Sling Integration Test");
if (postParams != null) {
final NameValuePair[] nvp = {};
post.setRequestBody(postParams.toArray(nvp));
}
if (postParams != null) {
final NameValuePair[] nvp = {};
post.setRequestBody(postParams.toArray(nvp));
}
final int status = httpClient.executeMethod(post);
if (assertMessage == null) {
assertEquals(expectedStatusCode, status);
} else {
assertEquals(assertMessage, expectedStatusCode, status);
}
return post;
}