String httpReqPathJks = "http://localhost:" + httpPort + "/ejbca/publicweb/webdist/certdist?cmd=cachain&caid=-1688117755&format=jks";
final WebClient webClient = new WebClient();
WebConnection con = webClient.getWebConnection();
WebRequestSettings settings = new WebRequestSettings(new URL(httpReqPathPem));
WebResponse resp = con.getResponse(settings);
assertEquals("Response code", 200, resp.getStatusCode());
String ctype = resp.getContentType();
assertTrue(StringUtils.startsWith(ctype, "application/octet-stream"));
List<NameValuePair> list = resp.getResponseHeaders();
Iterator<NameValuePair> iter = list.iterator();
boolean found = false;
while (iter.hasNext()) {
NameValuePair pair = iter.next();
log.debug(pair.getName() + ": " + pair.getValue());
if (StringUtils.equalsIgnoreCase("Content-disposition", pair.getName())) {
assertEquals("attachment; filename=\"chain.pem\"", pair.getValue());
found = true;
}
}
assertTrue("Unable find AdminCA1 in certificate chain or parsing the response wrong.", found);
settings = new WebRequestSettings(new URL(httpReqPathJks));
resp = con.getResponse(settings);
assertEquals("Response code", 200, resp.getStatusCode());
ctype = resp.getContentType();
assertTrue(StringUtils.startsWith(ctype, "application/octet-stream"));
list = resp.getResponseHeaders();
iter = list.iterator();
found = false;
while (iter.hasNext()) {
NameValuePair pair = (NameValuePair)iter.next();
if (StringUtils.equalsIgnoreCase("Content-disposition", pair.getName())) {