Issue Details (XML | Word | Printable)

Key: PLUTO-53
Type: Bug Bug
Status: Closed Closed
Resolution: Invalid
Priority: Major Major
Assignee: Unassigned
Reporter: Ken Weiner
Votes: 3
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Pluto

Pluto violates PLT.15.4

Created: 30/Jun/04 10:47 PM   Updated: 22/Feb/07 04:58 AM
Return to search
Component/s: portlet container
Affects Version/s: unspecified
Fix Version/s: 1.0.1-rc2

Time Tracking:
Not Specified

File Attachments:
  Size
Text File PlutoSession.txt 2005-04-08 07:04 PM Torsten Glunde 1 kB
Image Attachments:

1. session request scenario.jpg
(19 kB)
Environment: Pluto Portal Driver + the Pluto Container or uPortal + the Pluto Container

Resolution Date: 22/Oct/04 01:53 AM


 Description  « Hide
The JSR 168 Portlet Specification (PLT.15.4) states that Portlets are supposed to be able to communicate information with other Servlets and JSPs that are part of the same Portlet Application via their session. It appears that this ability is not possible with Portlet Applications running in Pluto.

If you examine the session ID of the session within a Portlet and then examine the session ID within a Servlet that was accessed directly by the user with a URL pointing to that Servlet, you will see that the session IDs do not match, and apparently they should.

For a demonstration of this, please deploy and examine the following Portlet: http://www.unicon.net/download/PortletSessionTest.war

By the way, the motivation for wanting to share information via the session in this way comes from a need to handle file downloads from a Portlet.

For reference, see the recent discussion thread on the Pluto User Mailing List:

http://nagoya.apache.org/eyebrowse/BrowseList?listName=pluto-user@portals.apache.org&by=thread&from=812493
    

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Arne v.Irmer added a comment - 01/Jul/04 07:46 AM
It is good to know that pluto has a problem here, but I realy need servlets integrated pluto.
Please help.
 

David DeWolf added a comment - 24/Aug/04 12:25 AM
It appears to me that when portal requests are being dispatched to portlets (which exist in an different context), Tomcat is not properly "changing" the session associated with the request.

Because of this, when a portlet puts an attribute in it's underlying HttpSession, in reality it's adding the value to the HttpSession coresponding to the original (portal) context instead of the portlet's context. Because of this, any subsequent request to a portlet resource which is not made through the portal's context (for instance anything which uses renderResponse.encodeURL() do not have access to the desired attribute.

Interestingly, the Tomcat bug related to this was supposed to be fixed in Tomcat 5.0.7. I'm in 5.0.27 and am still having issues.

David DeWolf added a comment - 24/Aug/04 12:49 AM
For a test case try the "Application Scoped Session Attributes Test" which is now part of the pluto testsuite.

David DeWolf added a comment - 27/Aug/04 02:45 AM
I've nailed this down to what I believe is a bug in Tomcat 5.x.

There was originally a bug reported in Tomcat 5.x in which requests were always returning the session associated with the original context and thus ignoring section 7.3 of the spec (which defines session scoping per context). This has been resolved - HOWEVER, no cookie is created when the included session is created/accessed for the first time. This results in subsequent requests (specifically those which come through the "target" (included) context) to create a new session.

Please see: http://issues.apache.org/bugzilla/show_bug.cgi?id=4690 for a patch which can be applied to tomcat to resolve this issue. Hoepfully it (or a better fix ??) will be applied to Tomcat in the near future.

David DeWolf added a comment - 27/Aug/04 02:47 AM
This issue is not a Pluto bug. It appears to be a tomcat issue.

David DeWolf added a comment - 20/Sep/04 08:57 PM
ReOpening until it can be confirmed. There are reports that the proposed patch for Tomcat does not work.

Daniel Grob added a comment - 30/Sep/04 02:52 PM
We are suffering from the same problem when using Pluto on Tomcat 4.1.29. We have a portlet application "HelloWorld" deployed in Pluto. When calling a Servlet within the HelloWorld directly using the /HelloWorld context path, we are not reaching the same portlet and/or HTTP session as if we access the portlet/servlet using the Pluto portal application.

Currently, the only way we could think of achieving the correct behaviour, is the following:
- the portal application/portlet container (aka Pluto) and all portlet applications have distinct portlet and HTTP session, each having its own one. (PLT.15.2)
- Pluto knows all sessions of all portlet applications
- when a request to a specific portlet is sent to Pluto, Pluto redirects the request to the corresponding portlet application session (so that the request is executed in the context/session of the portlet application, not in the context/session of Pluto). Using the RequestDispatcher of the portlet application context("cross-context" feature) seems not to work as the Servlet then gets the context/session of the caller (here, Pluto).
- when a portlet displays an URL that directly invokes a Servlet in a portlet application, Pluto has to encode the URL in a way that it points directly to the Servlet URL using the portlet application context path and that it contains the session id of the HTTP session of the portlet application as a jsessionid parameter.

David DeWolf added a comment - 14/Oct/04 01:15 PM
A patch has been applied to tomcat (Oct 13, 2004) which allows a work around for this issue. I think this bug can now be marked as resolved. If someone else can confirm that the patch works for them, please mark the bug as resolved.


David DeWolf added a comment - 22/Oct/04 01:53 AM
Mailing list has comfirmed that this works on Tomcat5.5. We now know that this is definately not a Pluto issue.

Wayne Holder added a comment - 01/Feb/05 07:04 AM
I see this issue has been closed because, in theory, this problem is not supposed to happen with Tomcat 5.5. However, I still see this problem using the RC2 binary release, which comes with Tomcat 5.5 as the servlet container. In fact, the test servlet ExternalAppScopedAttributeTestCompanionServlet, included with the testsuite app demonstrates this problem with RC2. Is this issue really fixed in Tomcat 5.5, or only in a later release of 5.5?

Wayne Holder added a comment - 01/Feb/05 08:57 AM
To correct my last comment, I forgot to also set crossContext="true" in the <context> tab. After doing this, I was able to verify that application level session information set in a portlet can be accessed by a servlet running in the same web applciation if the following things are all true:

1. The <context> tag sets crossContext="true"
2. The <connector> tag sets emptySessionPath="true"
3. You are using Tomcat 5.5.4, or later

Of course, one thing that seems crazy to me is that I have to do these things when the portlet calling the servlet resides in the very same web app and, therefore, shares the same context path.

IMO, JSR-168 does not make it at all clear what the proper context path for a portlet should be. That is, should the portlet take the context of the portal app where it's displayed, or the web app where the portlet's class is defined? I think these things need to be specified in much more detail.

Torsten Glunde added a comment - 08/Apr/05 07:01 PM
The issue seems not to be solved if you try to create a session from within a servlet being requested via the webapp context and afterwards try to request the portal with the same cookie/sessionid pluto returns a new session and the session attribute that was set within the first servlet call was of course not available for the portlet (although it resides in the same servlet context as the servlet from the first request) in the second request against the portal.

Please see the attachments added to clarify what happened.

Torsten Glunde added a comment - 08/Apr/05 07:04 PM
http dump