Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to register a HttpSessionListener
How to register a HttpSessionListener [message #88302] Fri, 18 May 2007 01:54 Go to next message
Eclipse UserFriend
Originally posted by: kedar.sadekar.ca.com

I have seen workarounds for registering ServletContextListener classes.
How do I register HttpSessionListener's?

Are there any workarounds or extension points available.

Thanks.
Re: How to register a HttpSessionListener [message #88320 is a reply to message #88302] Fri, 18 May 2007 03:02 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Depending on what you're trying to do you might be able to do something
clever with an HttpSessionBindingListener.
Eventually I'm hoping we'll be able to support a regular SessionListener
scoped by the HttpContext, but that's not for the current release.

HTH
-Simon


"Kedar" <kedar.sadekar@ca.com> wrote in message
news:6b0b76992b7c3fb43aaf75099a468bea$1@www.eclipse.org...
>I have seen workarounds for registering ServletContextListener classes. How
>do I register HttpSessionListener's?
>
> Are there any workarounds or extension points available.
>
> Thanks.
>
Re: How to register a HttpSessionListener [message #88366 is a reply to message #88320] Fri, 18 May 2007 16:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kedar.sadekar.ca.con

Right now I am interested in the sessionCreated and sessionDestroyed
events alone - Could you please explain further what could be done with
the BindingListener?

Thanks
Re: How to register a HttpSessionListener [message #88398 is a reply to message #88320] Fri, 18 May 2007 17:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kedar.sadekar.ca.com

I am currenty just interested in the session created / destroyed events.

Could you please explain what is possible with the
HttpSessionBindingListener

Thanks,
/kedar

Simon Kaegi wrote:

> Depending on what you're trying to do you might be able to do something
> clever with an HttpSessionBindingListener.
> Eventually I'm hoping we'll be able to support a regular SessionListener
> scoped by the HttpContext, but that's not for the current release.

> HTH
> -Simon


> "Kedar" <kedar.sadekar@ca.com> wrote in message
> news:6b0b76992b7c3fb43aaf75099a468bea$1@www.eclipse.org...
>>I have seen workarounds for registering ServletContextListener classes. How
>>do I register HttpSessionListener's?
>>
>> Are there any workarounds or extension points available.
>>
>> Thanks.
>>
Re: How to register a HttpSessionListener [message #88439 is a reply to message #88398] Sat, 19 May 2007 17:28 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Maybe something like this...

import javax.servlet.http.*;

public class HttpSessionListenerAdaptor implements
HttpSessionBindingListener {
private HttpSessionListener delegate;

public HttpSessionListenerAdaptor(HttpSessionListener delegate) {
this.delegate = delegate;
}

public void valueBound(HttpSessionBindingEvent event) {
delegate.sessionCreated(event);
}

public void valueUnbound(HttpSessionBindingEvent event) {
delegate.sessionDestroyed(event);
}
}

The idea is to always check and register this in your session as you
get/create it. The valueUnbound event iwll get sent if either the session is
explicitly invalidated or if the container times it out.

HTH
-Simon

"Kedar" <kedar.sadekar@ca.com> wrote in message
news:b00c5b0bb88c7bc0adc41f014c4beba3$1@www.eclipse.org...
>I am currenty just interested in the session created / destroyed events.
>
> Could you please explain what is possible with the
> HttpSessionBindingListener
>
> Thanks,
> /kedar
>
> Simon Kaegi wrote:
>
>> Depending on what you're trying to do you might be able to do something
>> clever with an HttpSessionBindingListener.
>> Eventually I'm hoping we'll be able to support a regular SessionListener
>> scoped by the HttpContext, but that's not for the current release.
>
>> HTH
>> -Simon
>
>
>> "Kedar" <kedar.sadekar@ca.com> wrote in message
>> news:6b0b76992b7c3fb43aaf75099a468bea$1@www.eclipse.org...
>>>I have seen workarounds for registering ServletContextListener classes.
>>>How do I register HttpSessionListener's?
>>>
>>> Are there any workarounds or extension points available.
>>>
>>> Thanks.
>>>
>
>
Re: How to register a HttpSessionListener [message #88514 is a reply to message #88439] Mon, 21 May 2007 20:33 Go to previous message
Eclipse UserFriend
Originally posted by: kedar.sadekar.ca.com

Thanks Simon,
Will definitely try that.

/kedar

Simon Kaegi wrote:

> Maybe something like this...

> import javax.servlet.http.*;

> public class HttpSessionListenerAdaptor implements
> HttpSessionBindingListener {
> private HttpSessionListener delegate;

> public HttpSessionListenerAdaptor(HttpSessionListener delegate) {
> this.delegate = delegate;
> }

> public void valueBound(HttpSessionBindingEvent event) {
> delegate.sessionCreated(event);
> }

> public void valueUnbound(HttpSessionBindingEvent event) {
> delegate.sessionDestroyed(event);
> }
> }

> The idea is to always check and register this in your session as you
> get/create it. The valueUnbound event iwll get sent if either the session is
> explicitly invalidated or if the container times it out.

> HTH
> -Simon

> "Kedar" <kedar.sadekar@ca.com> wrote in message
> news:b00c5b0bb88c7bc0adc41f014c4beba3$1@www.eclipse.org...
>>I am currenty just interested in the session created / destroyed events.
>>
>> Could you please explain what is possible with the
>> HttpSessionBindingListener
>>
>> Thanks,
>> /kedar
>>
>> Simon Kaegi wrote:
>>
>>> Depending on what you're trying to do you might be able to do something
>>> clever with an HttpSessionBindingListener.
>>> Eventually I'm hoping we'll be able to support a regular SessionListener
>>> scoped by the HttpContext, but that's not for the current release.
>>
>>> HTH
>>> -Simon
>>
>>
>>> "Kedar" <kedar.sadekar@ca.com> wrote in message
>>> news:6b0b76992b7c3fb43aaf75099a468bea$1@www.eclipse.org...
>>>>I have seen workarounds for registering ServletContextListener classes.
>>>>How do I register HttpSessionListener's?
>>>>
>>>> Are there any workarounds or extension points available.
>>>>
>>>> Thanks.
>>>>
>>
>>
Previous Topic:Works in Knopflerfish but NoClassDefFoundError in Eqinox
Next Topic:tomcat deploy error
Goto Forum:
  


Current Time: Thu Apr 25 02:07:18 GMT 2024

Powered by FUDForum. Page generated in 0.03559 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top