Create a session from an existing one

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Create a session from an existing one

Silvio Bierman
Hello all,

I know the servlet API does not allow this but I would like to know if
Jetty (embedded) somehow allows creating a new session (obtaining its
Session object) when I already have a session attached to the current
request.

I am using URL based session tracking and need to provide a URL that
will land in the new session.

Is there a way to work with the session manager or so to achieve this?

Currently on Jetty 9.2.1.v20140609 using it in embedded mode.

Thanks,

Silvio


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Create a session from an existing one

Joakim Erdfelt-9
I don't understand what you are attempting to do?

Are you wanting a new Session object based on a request?
If so, why not invalidate the current one, and make a new one via the servlet api?

   Session currentSess = req.getSession();
   if ( currentSess != null ) {
      currentSess.invalidate();
   }
   Session newSess = req.getSession(true);



--
Joakim Erdfelt <[hidden email]>
Expert advice, services and support from from the Jetty & CometD experts


On Thu, Jun 19, 2014 at 1:05 AM, Silvio Bierman <[hidden email]> wrote:
Hello all,

I know the servlet API does not allow this but I would like to know if Jetty (embedded) somehow allows creating a new session (obtaining its Session object) when I already have a session attached to the current request.

I am using URL based session tracking and need to provide a URL that will land in the new session.

Is there a way to work with the session manager or so to achieve this?

Currently on Jetty 9.2.1.v20140609 using it in embedded mode.

Thanks,

Silvio


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Create a session from an existing one

Jan Bartel-3
Hi Silvio,

I don't really understand what you're trying to do either. Can you
explain a bit more?

thanks
Jan

On 19 June 2014 17:44, Joakim Erdfelt <[hidden email]> wrote:

> I don't understand what you are attempting to do?
>
> Are you wanting a new Session object based on a request?
> If so, why not invalidate the current one, and make a new one via the
> servlet api?
>
>    Session currentSess = req.getSession();
>    if ( currentSess != null ) {
>       currentSess.invalidate();
>    }
>    Session newSess = req.getSession(true);
>
>
>
> --
> Joakim Erdfelt <[hidden email]>
> webtide.com - intalio.com/jetty
> Expert advice, services and support from from the Jetty & CometD experts
> eclipse.org/jetty - cometd.org
>
>
> On Thu, Jun 19, 2014 at 1:05 AM, Silvio Bierman
> <[hidden email]> wrote:
>>
>> Hello all,
>>
>> I know the servlet API does not allow this but I would like to know if
>> Jetty (embedded) somehow allows creating a new session (obtaining its
>> Session object) when I already have a session attached to the current
>> request.
>>
>> I am using URL based session tracking and need to provide a URL that will
>> land in the new session.
>>
>> Is there a way to work with the session manager or so to achieve this?
>>
>> Currently on Jetty 9.2.1.v20140609 using it in embedded mode.
>>
>> Thanks,
>>
>> Silvio
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>



--
Jan Bartel <[hidden email]>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Create a session from an existing one

Silvio Bierman
Hi Jan,

We have a web-application that allows a user who is logged in to a
"main" user session (an HTTP Session that is tracked via a session id in
the URL) to open additional windows that form a separate session.

We already do the following: (HTML-FORM IN PAGE WITHOUT SESSION) /
[POST] -> SERVLET / [CREATE SESSION + REDIRECT TO SESSION] -> (HTML PAGE
WITH SESSION IN URL)

And want to do something similar starting from a page that is already in
a session.

I hope that clears it up a bit? In other words I need another way of
creating a session than request.getSession(true) because the request is
already in a session. I need the session to be created without having a
session-less request around.

Cheers,

Silvio


On 06/19/2014 08:40 PM, Jan Bartel wrote:

> Hi Silvio,
>
> I don't really understand what you're trying to do either. Can you
> explain a bit more?
>
> thanks
> Jan
>
> On 19 June 2014 17:44, Joakim Erdfelt <[hidden email]> wrote:
>> I don't understand what you are attempting to do?
>>
>> Are you wanting a new Session object based on a request?
>> If so, why not invalidate the current one, and make a new one via the
>> servlet api?
>>
>>     Session currentSess = req.getSession();
>>     if ( currentSess != null ) {
>>        currentSess.invalidate();
>>     }
>>     Session newSess = req.getSession(true);
>>
>>
>>
>> --
>> Joakim Erdfelt <[hidden email]>
>> webtide.com - intalio.com/jetty
>> Expert advice, services and support from from the Jetty & CometD experts
>> eclipse.org/jetty - cometd.org
>>
>>
>> On Thu, Jun 19, 2014 at 1:05 AM, Silvio Bierman
>> <[hidden email]> wrote:
>>> Hello all,
>>>
>>> I know the servlet API does not allow this but I would like to know if
>>> Jetty (embedded) somehow allows creating a new session (obtaining its
>>> Session object) when I already have a session attached to the current
>>> request.
>>>
>>> I am using URL based session tracking and need to provide a URL that will
>>> land in the new session.
>>>
>>> Is there a way to work with the session manager or so to achieve this?
>>>
>>> Currently on Jetty 9.2.1.v20140609 using it in embedded mode.
>>>
>>> Thanks,
>>>
>>> Silvio
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Create a session from an existing one

Silvio Bierman
In reply to this post by Joakim Erdfelt-9
Hi Joakim,

No, I want a new session on its own which I will adress by (re)directing windows to them via URLs with session ids in them. I don't want to invalidate the current session because I need both.

Cheers,

Silvio


On 06/19/2014 05:44 PM, Joakim Erdfelt wrote:
I don't understand what you are attempting to do?

Are you wanting a new Session object based on a request?
If so, why not invalidate the current one, and make a new one via the servlet api?

   Session currentSess = req.getSession();
   if ( currentSess != null ) {
      currentSess.invalidate();
   }
   Session newSess = req.getSession(true);



--
Joakim Erdfelt <[hidden email]>
Expert advice, services and support from from the Jetty & CometD experts


On Thu, Jun 19, 2014 at 1:05 AM, Silvio Bierman <[hidden email]> wrote:
Hello all,

I know the servlet API does not allow this but I would like to know if Jetty (embedded) somehow allows creating a new session (obtaining its Session object) when I already have a session attached to the current request.

I am using URL based session tracking and need to provide a URL that will land in the new session.

Is there a way to work with the session manager or so to achieve this?

Currently on Jetty 9.2.1.v20140609 using it in embedded mode.

Thanks,

Silvio


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email