Re: [jetty-user] Create a session from an existing one

Silvio Bierman <[email protected]> Thu, 19 Jun 2014 23:30:49 +0200
Newsgroups gmane.comp.java.jetty.support
Message-ID <[email protected]>
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 <[email protected]> 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 <[email protected]>
>> 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
>> <[email protected]> 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
>>>
>>>
>
>