I have content of a file (x509crl) in base64 encoded value. I fired GET request to a servlet. By pasting following URL in a browser file download dialog pops up.
"http://host:port/myServlet?content=base64_encoded_value"
I was able to download a file, but I could not open a file. According to a pki expert in my workshop, if content of crl file is correct then OS should open it up just fine.
Here is the doGet method from my servlet class. I wonder what mistakes I made.
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
String content = request.getParameter("content");
response.setContentType("application/pkix-crl");
response.setHeader("Content-Disposition","attachment;filename=test.crl");
byte[] byteArray = Base64.decodeBase64(content.getBytes());
ServletOutputStream sos = response.getOutputStream();
sos.write(byteArray);
sos.close();
}
I am using commons-codec-1.3 and I didn't include any exception handling in the example.