- This topic has 7 replies, 2 voices, and was last updated Oct 06, 2010
23:44:55 by PD4ML.
November 20, 2009 at 00:18#26289
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:
<br /> ...<br /> HttpSession session = request.getSession();<br /> OutputStream output = response.getOutputStream();<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.setCookie("JSESSIONID", session.getId());<br /> response.setContentType("application/pdf");<br /> pd4ml.render(new URL(url.toString()), output);<br />
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.
ThanksNovember 20, 2009 at 11:30#27631
Does it mean
1. render() cannot load the URL, respecting a given ;jsessionid= or
2. it loads the main URL correctly, but the session ID is not propagated to the referenced resources (CSS, images etc)?November 23, 2009 at 01:22#27632
The issue is 1. render() cannot load the URL.
The page is rendered however fields populated by values stored in the jsession are blank.November 24, 2009 at 01:07#27633
Just to confirm above statement:
The page we are trying to display contained in URL is rendered correctly using the render() method. All CSS, images, HTML etc are rendered correctly as per normal. The jsessionid however is not being transferred to the page used in the render() method.
This means that where session values are displayed on the page, the value is showing as blank. This is because a new session is created by default in which our attributes used on the page don’t exist.November 26, 2009 at 02:30#27634
Could you please provide an email address so that we may contact and deal with your support team directly. This issue is holding up production changes and we can’t afford lengthy delays by waiting on answers to be posted in a forum.
Previously we had an issue and it was dealt with via email swiftly and attentively. We were hoping it would be a similar case this time. Any knowledge gained outside of the forum can be copied in at a later date.
ThanksDecember 1, 2009 at 14:09#27635
The support email address is support at pd4ml dot com. (Sorry for the cryptic email address notation – spam robots are really annoying)December 7, 2009 at 22:13#27636
Was there a resolution to this question?
I am experiencing the same behavior: when using setSessionID(session.getId()) followed by render() the page that is being rendered has a new session, not the one requested (session.isNew()==true, session.getId() is a new id).October 6, 2010 at 23:44#27637
The session ID propagation of a particular web application depends on the platform and configuration of server or the application.
In J2EE/Servlet/JSP “world” it uses JSESSIONID cookie or jsessionid URL suffix, however it is possible to override the defaults. Also the configuration may disable the cookie method or the URL suffix method.
PD4ML supports the following methods of session ID propagation.
Let’s say we load http://pd4ml.com
- pd4ml.setCookie( “JSESSIONID”, cookieValue );
where cookieValue is something like that: “9034657927465;path=/”
The cookie is sent with the “main” request to http://pd4ml.com as well as with the requests to the referenced resources (images, CSSs etc)
- pd4ml.setSessionID( sessionID )
In the case PD4ML embeds the sessionID only to referenced resource URLs this way:
If it fails with the embedded jsessionid, it repeats the request without the ID.
NOTE: It does not embed jsessionid to the original request to http://pd4ml.com, as you have control over the URL string in your Java code, so you can ebbed it by yourself and avoid possible confusions with the request repeating.
You may see the modified image URLs on STDOUT or in the server log if you switch the debug mode on:
The default “jsessionid” keyword can be changed with
JVM command line parameter.
The topic ‘Session not transfered when using pd4ml.render()’ is closed to new replies.