You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Loïc Lefèvre <ll...@fivia.com> on 2001/08/01 12:02:31 UTC

PROBLEM with...

Hi

It's me againnnnnnnnnnnnnn ;)
Now that apache and tomcat SEEMS to work together,
I've got dome problems about SESSION.
After being 'loged', the following code return null:

HttpSession session = req.getSession(false);

The question is : WHY?

Loïc Lefèvre


RE: PROBLEM with...

Posted by Loïc Lefèvre <ll...@fivia.com>.
Hemm,

look at the last answer to this question ;)

-----Message d'origine-----
De : Dmitri Colebatch [mailto:dim@bigpond.net.au]
Envoyé : mercredi 1 août 2001 14:28
À : tomcat-user@jakarta.apache.org
Objet : Re: PROBLEM with...


Hi,

On Wed, 1 Aug 2001, Ludovic Maitre wrote:
> > HttpSession session = req.getSession(false);

That will _always_ return true, unless some time before its call there has
been a call:

    HttpSession session = req.getSession(true);

This is how you create a session.  You mention "logging", I'm not sure why
you think that should create a session.  If you have the above line and
its not working, then something is wrong, otherwise its perfectly
understandable.

> (
>         <RequestInterceptor
>             className="org.apache.tomcat.request.SessionInterceptor"
>             noCookies="false" />  <-- was true )

Sessions work with or without cookies.  If you specify
noCookies="true" then links will need to have url rewriting done on them
to track the session.  But sessions definately work both ways.

cheesr
dim


>
> I will now try to use the rewriterule mentionned in the FAQ for verify
> that she
> work, and if it works, i give a feedback to you/the mailing list
> (it seems to be the same problem no ?)
>
> regards,
>
> Ludovic
>
> > Loïc Lefèvre
> >
> > -----Message d'origine-----
> > De : bk [mailto:bk]De la part de Bernd Koecke
> > Envoyé : mercredi 1 août 2001 12:41
> > À : tomcat-user@jakarta.apache.org
> > Objet : Re: PROBLEM with...
> >
> > Hi,
> >
> > Loïc Lefèvre wrote:
> > >
> > > Hi
> > >
> > > It's me againnnnnnnnnnnnnn ;)
> > > Now that apache and tomcat SEEMS to work together,
> > > I've got dome problems about SESSION.
> > > After being 'loged', the following code return null:
> > >
> > > HttpSession session = req.getSession(false);
> >
> > Try it with the Parameter 'true'. You don't have a session by default
> > and with Parameter 'false' you won't get a new one.
> >
> > >
> > > The question is : WHY?
> > >
> > > Loïc Lefèvre
> >
> > Bernd
> > --
> > Dipl.-Inform. Bernd Koecke
> > UNIX-Entwicklung
> > Schlund+Partner AG
> > Fon: +49-721-91374-0
> > E-Mail: bk@schlund.de
>
> --
>  Ludovic.Maitre@sophia.inria.fr
>
>  INRIA - 2004 route des lucioles - BP 93    Tel: (33/0) 4 92 38 50 41
>  06902   SOPHIA-ANTIPOLIS cedex (France)    Fax: (33/0) 4 92 38 76 02
>


Re: PROBLEM with...

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
Hi,

On Wed, 1 Aug 2001, Ludovic Maitre wrote:
> > HttpSession session = req.getSession(false);

That will _always_ return true, unless some time before its call there has
been a call:

    HttpSession session = req.getSession(true);

This is how you create a session.  You mention "logging", I'm not sure why
you think that should create a session.  If you have the above line and
its not working, then something is wrong, otherwise its perfectly
understandable.

> (
>         <RequestInterceptor
>             className="org.apache.tomcat.request.SessionInterceptor"
>             noCookies="false" />  <-- was true )

Sessions work with or without cookies.  If you specify
noCookies="true" then links will need to have url rewriting done on them
to track the session.  But sessions definately work both ways.

cheesr
dim


> 
> I will now try to use the rewriterule mentionned in the FAQ for verify
> that she 
> work, and if it works, i give a feedback to you/the mailing list 
> (it seems to be the same problem no ?)
> 
> regards,
> 
> Ludovic 
> 
> > Lo�c Lef�vre
> > 
> > -----Message d'origine-----
> > De : bk [mailto:bk]De la part de Bernd Koecke
> > Envoy� : mercredi 1 ao�t 2001 12:41
> > � : tomcat-user@jakarta.apache.org
> > Objet : Re: PROBLEM with...
> > 
> > Hi,
> > 
> > Lo�c Lef�vre wrote:
> > >
> > > Hi
> > >
> > > It's me againnnnnnnnnnnnnn ;)
> > > Now that apache and tomcat SEEMS to work together,
> > > I've got dome problems about SESSION.
> > > After being 'loged', the following code return null:
> > >
> > > HttpSession session = req.getSession(false);
> > 
> > Try it with the Parameter 'true'. You don't have a session by default
> > and with Parameter 'false' you won't get a new one.
> > 
> > >
> > > The question is : WHY?
> > >
> > > Lo�c Lef�vre
> > 
> > Bernd
> > --
> > Dipl.-Inform. Bernd Koecke
> > UNIX-Entwicklung
> > Schlund+Partner AG
> > Fon: +49-721-91374-0
> > E-Mail: bk@schlund.de
> 
> -- 
>  Ludovic.Maitre@sophia.inria.fr
> 
>  INRIA - 2004 route des lucioles - BP 93    Tel: (33/0) 4 92 38 50 41
>  06902   SOPHIA-ANTIPOLIS cedex (France)    Fax: (33/0) 4 92 38 76 02
> 


Re: PROBLEM with...

Posted by Ludovic Maitre <Lu...@sophia.inria.fr>.
Loïc Lefèvre wrote:
> 
> Hem sorry, I should have say more:
> 
> When the server receive the log request, a session is created (with true)
> and a redirection is made to an other page, in this page, the following code
> is executed:
> 
> HttpSession session = req.getSession(false);
> 
> and it return null :(
> 
> So now I can ask: WHY?
> 
Hello, 

I had the same symptom and it was because my rewriterules in Apache was
"eating" 
the session and the best solution i have find is to use cookies for
storing the session.

(
        <RequestInterceptor
            className="org.apache.tomcat.request.SessionInterceptor"
            noCookies="false" />  <-- was true )

I will now try to use the rewriterule mentionned in the FAQ for verify
that she 
work, and if it works, i give a feedback to you/the mailing list 
(it seems to be the same problem no ?)

regards,

Ludovic 

> Loïc Lefèvre
> 
> -----Message d'origine-----
> De : bk [mailto:bk]De la part de Bernd Koecke
> Envoyé : mercredi 1 août 2001 12:41
> À : tomcat-user@jakarta.apache.org
> Objet : Re: PROBLEM with...
> 
> Hi,
> 
> Loïc Lefèvre wrote:
> >
> > Hi
> >
> > It's me againnnnnnnnnnnnnn ;)
> > Now that apache and tomcat SEEMS to work together,
> > I've got dome problems about SESSION.
> > After being 'loged', the following code return null:
> >
> > HttpSession session = req.getSession(false);
> 
> Try it with the Parameter 'true'. You don't have a session by default
> and with Parameter 'false' you won't get a new one.
> 
> >
> > The question is : WHY?
> >
> > Loïc Lefèvre
> 
> Bernd
> --
> Dipl.-Inform. Bernd Koecke
> UNIX-Entwicklung
> Schlund+Partner AG
> Fon: +49-721-91374-0
> E-Mail: bk@schlund.de

-- 
 Ludovic.Maitre@sophia.inria.fr

 INRIA - 2004 route des lucioles - BP 93    Tel: (33/0) 4 92 38 50 41
 06902   SOPHIA-ANTIPOLIS cedex (France)    Fax: (33/0) 4 92 38 76 02

RE: PROBLEM with...

Posted by Loïc Lefèvre <ll...@fivia.com>.
Hem sorry, I should have say more:

When the server receive the log request, a session is created (with true)
and a redirection is made to an other page, in this page, the following code
is executed:

HttpSession session = req.getSession(false);

and it return null :(

So now I can ask: WHY?

Loïc Lefèvre

-----Message d'origine-----
De : bk [mailto:bk]De la part de Bernd Koecke
Envoyé : mercredi 1 août 2001 12:41
À : tomcat-user@jakarta.apache.org
Objet : Re: PROBLEM with...


Hi,

Loïc Lefèvre wrote:
>
> Hi
>
> It's me againnnnnnnnnnnnnn ;)
> Now that apache and tomcat SEEMS to work together,
> I've got dome problems about SESSION.
> After being 'loged', the following code return null:
>
> HttpSession session = req.getSession(false);

Try it with the Parameter 'true'. You don't have a session by default
and with Parameter 'false' you won't get a new one.

>
> The question is : WHY?
>
> Loïc Lefèvre

Bernd
--
Dipl.-Inform. Bernd Koecke
UNIX-Entwicklung
Schlund+Partner AG
Fon: +49-721-91374-0
E-Mail: bk@schlund.de


Re: PROBLEM with...

Posted by Bernd Koecke <bk...@schlund.de>.
Hi,

Loïc Lefèvre wrote:
> 
> Hi
> 
> It's me againnnnnnnnnnnnnn ;)
> Now that apache and tomcat SEEMS to work together,
> I've got dome problems about SESSION.
> After being 'loged', the following code return null:
> 
> HttpSession session = req.getSession(false);

Try it with the Parameter 'true'. You don't have a session by default
and with Parameter 'false' you won't get a new one.

> 
> The question is : WHY?
> 
> Loïc Lefèvre

Bernd
-- 
Dipl.-Inform. Bernd Koecke
UNIX-Entwicklung
Schlund+Partner AG
Fon: +49-721-91374-0
E-Mail: bk@schlund.de