Invalidating all portlet sessions

View: New views
6 Messages — Rating Filter:   Alert me  

Invalidating all portlet sessions

by Anders Olsson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I have created a simple custom portal based on pluto-portal. From a servlet in my custom portal I
want to invalidate all related sessions in my deployed portlet applications, is there an easy way to
do this, using the portal-driver?

I suppose one possibility would be to iterate through all configured portlets and trigger an
ActionRequest and in each of the portlets make sure that they respond to that request by
invalidating the session. But I would just want to know if there's a better/easier way?

All portlets are separate web applications.

Regards
Anders



Re: Invalidating all portlet sessions

by Eric Dalquist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We do this in uPortal by using a PortletInvocationListener to track all
of the sessions that have been created for portlets and then a
HttpSessionListener which generates Spring ApplicationContext events for
session created/destroyed events.

Our custom listener:
https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/portlet/session/PortletSessionExpirationManager.java
Our session listener:
https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/spring/web/context/support/ApplicationContextDelagatingSessionListener.java

-Eric

Anders Olsson wrote:

> Hi!
>
> I have created a simple custom portal based on pluto-portal. From a
> servlet in my custom portal I want to invalidate all related sessions
> in my deployed portlet applications, is there an easy way to do this,
> using the portal-driver?
>
> I suppose one possibility would be to iterate through all configured
> portlets and trigger an ActionRequest and in each of the portlets make
> sure that they respond to that request by invalidating the session.
> But I would just want to know if there's a better/easier way?
>
> All portlets are separate web applications.
>
> Regards
> Anders
>
>


smime.p7s (4K) Download Attachment

Re: Invalidating all portlet sessions

by Anders Olsson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, this is exactly what I'm looking for! There is one thing left
for me to solve though: I can't figure out how I can retrieve the portal
session from the onEnd()-method of my PortletInvocationListener. In
uPortal the portal request can be retrieved using
IPortalRequestUtils.getOriginalPortalRequest() but I can't find a way to
do that within the pluto portal.

I tried using the PortalRequestContext that is stored as the request
attribute PortalRequestContext.REQUEST_KEY but that gives me the request
after it has already been dispatched to the pluto PortletServlet.

/ Anders


Eric Dalquist skrev:

> We do this in uPortal by using a PortletInvocationListener to track
> all of the sessions that have been created for portlets and then a
> HttpSessionListener which generates Spring ApplicationContext events
> for session created/destroyed events.
>
> Our custom listener:
> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/portlet/session/PortletSessionExpirationManager.java 
>
> Our session listener:
> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/spring/web/context/support/ApplicationContextDelagatingSessionListener.java 
>
>
> -Eric
>
> Anders Olsson wrote:
>> Hi!
>>
>> I have created a simple custom portal based on pluto-portal. From a
>> servlet in my custom portal I want to invalidate all related sessions
>> in my deployed portlet applications, is there an easy way to do this,
>> using the portal-driver?
>>
>> I suppose one possibility would be to iterate through all configured
>> portlets and trigger an ActionRequest and in each of the portlets
>> make sure that they respond to that request by invalidating the
>> session. But I would just want to know if there's a better/easier way?
>>
>> All portlets are separate web applications.
>>
>> Regards
>> Anders
>>
>>


Re: Invalidating all portlet sessions

by Eric Dalquist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is our request utils class. Since you're doing this from withing
Pluto I believe these are all safe operations:

https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/url/PortalRequestUtilsImpl.java

-Eric

Anders Olsson wrote:

> Thanks, this is exactly what I'm looking for! There is one thing left
> for me to solve though: I can't figure out how I can retrieve the
> portal session from the onEnd()-method of my
> PortletInvocationListener. In uPortal the portal request can be
> retrieved using IPortalRequestUtils.getOriginalPortalRequest() but I
> can't find a way to do that within the pluto portal.
>
> I tried using the PortalRequestContext that is stored as the request
> attribute PortalRequestContext.REQUEST_KEY but that gives me the
> request after it has already been dispatched to the pluto PortletServlet.
>
> / Anders
>
>
> Eric Dalquist skrev:
>> We do this in uPortal by using a PortletInvocationListener to track
>> all of the sessions that have been created for portlets and then a
>> HttpSessionListener which generates Spring ApplicationContext events
>> for session created/destroyed events.
>>
>> Our custom listener:
>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/portlet/session/PortletSessionExpirationManager.java 
>>
>> Our session listener:
>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/spring/web/context/support/ApplicationContextDelagatingSessionListener.java 
>>
>>
>> -Eric
>>
>> Anders Olsson wrote:
>>> Hi!
>>>
>>> I have created a simple custom portal based on pluto-portal. From a
>>> servlet in my custom portal I want to invalidate all related
>>> sessions in my deployed portlet applications, is there an easy way
>>> to do this, using the portal-driver?
>>>
>>> I suppose one possibility would be to iterate through all configured
>>> portlets and trigger an ActionRequest and in each of the portlets
>>> make sure that they respond to that request by invalidating the
>>> session. But I would just want to know if there's a better/easier way?
>>>
>>> All portlets are separate web applications.
>>>
>>> Regards
>>> Anders
>>>
>>>
>


smime.p7s (4K) Download Attachment

Re: Invalidating all portlet sessions

by Eric Dalquist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, I hit send too soon.

In our portal we add a request wrapper to the request before proceeding
with any processing. This wrapper provides access to the original
request via a specified request attribute. The code that goes along with
the PortalRequestUtilsImpl is here:

https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/url/PortalHttpServletRequest.java

That adds more functionality than you need to worry about for this usage
but you can see how the original portal request is accessed. If you did
something like that in a filter in front of Pluto you should be fine.

-Eric

Eric Dalquist wrote:

> Here is our request utils class. Since you're doing this from withing
> Pluto I believe these are all safe operations:
>
> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/url/PortalRequestUtilsImpl.java 
>
>
> -Eric
>
> Anders Olsson wrote:
>> Thanks, this is exactly what I'm looking for! There is one thing left
>> for me to solve though: I can't figure out how I can retrieve the
>> portal session from the onEnd()-method of my
>> PortletInvocationListener. In uPortal the portal request can be
>> retrieved using IPortalRequestUtils.getOriginalPortalRequest() but I
>> can't find a way to do that within the pluto portal.
>>
>> I tried using the PortalRequestContext that is stored as the request
>> attribute PortalRequestContext.REQUEST_KEY but that gives me the
>> request after it has already been dispatched to the pluto
>> PortletServlet.
>>
>> / Anders
>>
>>
>> Eric Dalquist skrev:
>>> We do this in uPortal by using a PortletInvocationListener to track
>>> all of the sessions that have been created for portlets and then a
>>> HttpSessionListener which generates Spring ApplicationContext events
>>> for session created/destroyed events.
>>>
>>> Our custom listener:
>>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/portlet/session/PortletSessionExpirationManager.java 
>>>
>>> Our session listener:
>>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/spring/web/context/support/ApplicationContextDelagatingSessionListener.java 
>>>
>>>
>>> -Eric
>>>
>>> Anders Olsson wrote:
>>>> Hi!
>>>>
>>>> I have created a simple custom portal based on pluto-portal. From a
>>>> servlet in my custom portal I want to invalidate all related
>>>> sessions in my deployed portlet applications, is there an easy way
>>>> to do this, using the portal-driver?
>>>>
>>>> I suppose one possibility would be to iterate through all
>>>> configured portlets and trigger an ActionRequest and in each of the
>>>> portlets make sure that they respond to that request by
>>>> invalidating the session. But I would just want to know if there's
>>>> a better/easier way?
>>>>
>>>> All portlets are separate web applications.
>>>>
>>>> Regards
>>>> Anders
>>>>
>>>>
>>


smime.p7s (4K) Download Attachment

Re: Invalidating all portlet sessions

by Anders Olsson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks!

I ended up using a filter that stores the portal session (if there is
one) as a request attribute, I couldn't quite get the wrapper thing to
work, I haven't investigated it further.

Now everything works perfectly though!

/ Anders

Eric Dalquist skrev:

> Sorry, I hit send too soon.
>
> In our portal we add a request wrapper to the request before
> proceeding with any processing. This wrapper provides access to the
> original request via a specified request attribute. The code that goes
> along with the PortalRequestUtilsImpl is here:
>
> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/url/PortalHttpServletRequest.java 
>
>
> That adds more functionality than you need to worry about for this
> usage but you can see how the original portal request is accessed. If
> you did something like that in a filter in front of Pluto you should
> be fine.
>
> -Eric
>
> Eric Dalquist wrote:
>> Here is our request utils class. Since you're doing this from withing
>> Pluto I believe these are all safe operations:
>>
>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/url/PortalRequestUtilsImpl.java 
>>
>>
>> -Eric
>>
>> Anders Olsson wrote:
>>> Thanks, this is exactly what I'm looking for! There is one thing
>>> left for me to solve though: I can't figure out how I can retrieve
>>> the portal session from the onEnd()-method of my
>>> PortletInvocationListener. In uPortal the portal request can be
>>> retrieved using IPortalRequestUtils.getOriginalPortalRequest() but I
>>> can't find a way to do that within the pluto portal.
>>>
>>> I tried using the PortalRequestContext that is stored as the request
>>> attribute PortalRequestContext.REQUEST_KEY but that gives me the
>>> request after it has already been dispatched to the pluto
>>> PortletServlet.
>>>
>>> / Anders
>>>
>>>
>>> Eric Dalquist skrev:
>>>> We do this in uPortal by using a PortletInvocationListener to track
>>>> all of the sessions that have been created for portlets and then a
>>>> HttpSessionListener which generates Spring ApplicationContext
>>>> events for session created/destroyed events.
>>>>
>>>> Our custom listener:
>>>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/portlet/session/PortletSessionExpirationManager.java 
>>>>
>>>> Our session listener:
>>>> https://www.ja-sig.org/svn/uPortal/trunk/uportal-impl/src/main/java/org/jasig/portal/spring/web/context/support/ApplicationContextDelagatingSessionListener.java 
>>>>
>>>>
>>>> -Eric
>>>>
>>>> Anders Olsson wrote:
>>>>> Hi!
>>>>>
>>>>> I have created a simple custom portal based on pluto-portal. From
>>>>> a servlet in my custom portal I want to invalidate all related
>>>>> sessions in my deployed portlet applications, is there an easy way
>>>>> to do this, using the portal-driver?
>>>>>
>>>>> I suppose one possibility would be to iterate through all
>>>>> configured portlets and trigger an ActionRequest and in each of
>>>>> the portlets make sure that they respond to that request by
>>>>> invalidating the session. But I would just want to know if there's
>>>>> a better/easier way?
>>>>>
>>>>> All portlets are separate web applications.
>>>>>
>>>>> Regards
>>>>> Anders
>>>>>
>>>>>
>>>