We are migrating a JSF web application from Tomcat 6.x onto IBM WebSphere 6.0 which is using pd4ml. Previously we have had no problems with this on Tomcat but now when we try and run our application on WebSphere, there is no HttpSession being passed when we try and render a PDF from a JSP page.
The basic flow of the app is:
- a servlet is called which then uses the render(java.net.URL url, java.io.OutputStream os) method
- The URL points to a JSP page within the same application
- The OutputStream is the HttpResponse output stream
- When the page is rendered, it contains a PDF version of the JSP page.
A basic code snippet of how we have been doing the conversion from the servlet is given below:
Code:
...
HttpSession session = request.getSession();
OutputStream output = response.getOutputStream();
PD4ML pd4ml = new PD4ML();
pd4ml.setCookie("JSESSIONID", session.getId());
response.setContentType("application/pdf");
pd4ml.render(new URL(url.toString()), output);
After this didn't work initially I tried a few things including:
- upgrading to the latest version of pd4ml (3.5.1)
- calling pd4ml.setSessionId(session.getId()) *This never worked originally for some reason
- appending ";jessionid=" + session.getId() to the end of the URL
- appending "?pd4session=" + session.getId() to the end of the URL
Currently the page that gets rendered does not get the HttpSession (so ends up creating a new one) and so values stored in it which are used to populate fields end up displaying as blank.
Note that I have confirmed that a different session gets created by logging the session id both in the servlet and from the JSP page.
Could you please advise of any known issues with integration in WebSphere or advise on passing the Session to a rendered page.
Thanks