You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Nick Lothian <nl...@essential.com.au> on 2003/12/29 06:47:01 UTC

Cross Context Sessions & Pluto

Is anyone else attempting to use Cross Context Sessions in Pluto? It looks
like it might be possible in Tomcat 5 (See
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4690>), but not under
Tomcat 4.

My problem:
I have a pop-up window deployed as part of my portlet webapp. This popup is
accessed as a plain servlet - not via the pluto web app's URL. In this
servlet I need to access things on the HttpSession. I was hoping I could add
them to the HttpSession inside my portlet and have them available from my
servlet. This doesn't work because the two context's (pluto and the plain
webapp) get different sessions.

I think that this might be solved by the fix above, but I can't test it with
Pluto as it doesn't work under Tomcat 5.

Has anyone else had to deal with this problem? What did you do?

Alternatly, is anyone working on Pluto/Tomcat 5?

Nick

Re: Cross Context Sessions & Pluto

Posted by Stefan Hepper <st...@hursley.ibm.com>.
I'm not quite sure what the problem is, as the same session is available 
to both, the servlet and the portlet.

The following has been tested with pluto and tomcat 4.1
put a string into the app scope session from the portlet and retrieve it 
in the servlet (part of the TCK test suite of JSR 168).

Stefan

Nick Lothian wrote:

> Is anyone else attempting to use Cross Context Sessions in Pluto? It looks
> like it might be possible in Tomcat 5 (See
> <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4690>), but not under
> Tomcat 4.
> 
> My problem:
> I have a pop-up window deployed as part of my portlet webapp. This popup is
> accessed as a plain servlet - not via the pluto web app's URL. In this
> servlet I need to access things on the HttpSession. I was hoping I could add
> them to the HttpSession inside my portlet and have them available from my
> servlet. This doesn't work because the two context's (pluto and the plain
> webapp) get different sessions.
> 
> I think that this might be solved by the fix above, but I can't test it with
> Pluto as it doesn't work under Tomcat 5.
> 
> Has anyone else had to deal with this problem? What did you do?
> 
> Alternatly, is anyone working on Pluto/Tomcat 5?
> 
> Nick
> 


Re: Cross Context Sessions & Pluto

Posted by Stefan Hepper <st...@hursley.ibm.com>.
I'm not quite sure what the problem is, as the same session is available 
to both, the servlet and the portlet.

The following has been tested with pluto and tomcat 4.1
put a string into the app scope session from the portlet and retrieve it 
in the servlet (part of the TCK test suite of JSR 168).

Stefan

Nick Lothian wrote:

> Is anyone else attempting to use Cross Context Sessions in Pluto? It looks
> like it might be possible in Tomcat 5 (See
> <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4690>), but not under
> Tomcat 4.
> 
> My problem:
> I have a pop-up window deployed as part of my portlet webapp. This popup is
> accessed as a plain servlet - not via the pluto web app's URL. In this
> servlet I need to access things on the HttpSession. I was hoping I could add
> them to the HttpSession inside my portlet and have them available from my
> servlet. This doesn't work because the two context's (pluto and the plain
> webapp) get different sessions.
> 
> I think that this might be solved by the fix above, but I can't test it with
> Pluto as it doesn't work under Tomcat 5.
> 
> Has anyone else had to deal with this problem? What did you do?
> 
> Alternatly, is anyone working on Pluto/Tomcat 5?
> 
> Nick
> 


Re: Cross Context Sessions & Pluto

Posted by Serge Huber <sh...@jahia.com>.
At 08:34 AM 12/30/2003, David Sean Taylor wrote:

>On Monday, December 29, 2003, at 06:11  AM, Tony Field wrote:
>
>>We're actually doing it with WebLogic, and it seems to work fine.  Our 
>>portlet also pops up windows that are servlets, and once we made sure we 
>>were getting session attributes out of the right scope, it worked fine.
>Thats interesting. Does Weblogic support cross context dispatching also 
>(which Pluto requires), something like this:
>
>ServletContext appContext = myContext.getContext("/anotherWebapp");
>appContext.getRequestDispatcher("/someservletOnAnotherWebapp");

Do you really have to use sessions ? Otherwise it might be simpler with 
request attributes, such as :

request.setAttribute("myAttributeName", myAttributeObject)

You could also copy object between sessions located in different contexts 
using this method, but you would have to do the code for the copying 
yourself, and the object types would have to be limited to instance of 
classes which are available in both class loaders (such as java.lang.String 
for example).

Regards,
   Serge Huber.

- -- --- -----=[ shuber2 at jahia dot com ]=---- --- -- -
www.jahia.org : A collaborative source CMS and Portal Server 



Re: Cross Context Sessions & Pluto

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Monday, December 29, 2003, at 06:11  AM, Tony Field wrote:

> We're actually doing it with WebLogic, and it seems to work fine.  Our 
> portlet also pops up windows that are servlets, and once we made sure 
> we were getting session attributes out of the right scope, it worked 
> fine.
>
Thats interesting. Does Weblogic support cross context dispatching also 
(which Pluto requires), something like this:

ServletContext appContext = myContext.getContext("/anotherWebapp");
appContext.getRequestDispatcher("/someservletOnAnotherWebapp");



Re: Cross Context Sessions & Pluto

Posted by Tony Field <to...@fatwire.com>.
We're actually doing it with WebLogic, and it seems to work fine.  Our 
portlet also pops up windows that are servlets, and once we made sure 
we were getting session attributes out of the right scope, it worked 
fine.

So to get a session attribute set by the servlet, use this:
m_oPortletSession.getAttribute(sName, PortletSession.APPLICATION_SCOPE);
If you use any other scope, you won't see the servlet's session 
attributes.  When you set your session attributes in your servlet 
window, just do the usual.

Hope this helps

Tony

On 29-Dec-03, at 12:47 AM, Nick Lothian wrote:

>
> Is anyone else attempting to use Cross Context Sessions in Pluto? It 
> looks
> like it might be possible in Tomcat 5 (See
> <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4690>), but not 
> under
> Tomcat 4.
>
> My problem:
> I have a pop-up window deployed as part of my portlet webapp. This 
> popup is
> accessed as a plain servlet - not via the pluto web app's URL. In this
> servlet I need to access things on the HttpSession. I was hoping I 
> could add
> them to the HttpSession inside my portlet and have them available from 
> my
> servlet. This doesn't work because the two context's (pluto and the 
> plain
> webapp) get different sessions.
>
> I think that this might be solved by the fix above, but I can't test 
> it with
> Pluto as it doesn't work under Tomcat 5.
>
> Has anyone else had to deal with this problem? What did you do?
>
> Alternatly, is anyone working on Pluto/Tomcat 5?
>
> Nick
>