tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thyago Lisboa Mota" <thy...@tre-ce.gov.br>
Subject Re: JSessionID problem
Date Fri, 07 Nov 2003 16:36:46 GMT
I thought the jsessionid had to be encoded in the URL (using
response.encodeURL(...)) to work like you say... If I just type
http://myserver/session.jsp I thought a new session would be created each
time.  So, the server controls the session using information from the client
browser ?

So, if the Linux server is working just fine, the problem is with the W2K
one, that is creating a new jsession each time I refresh the page... How can
I fix this ?

Thanks for your help

Thyago

----- Original Message -----
From: <inaminute@pobox.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>; "Thyago Lisboa
Mota" <thyago@tre-ce.gov.br>
Sent: Friday, November 07, 2003 6:35 AM
Subject: Re: JSessionID problem


> Quoting Thyago Lisboa Mota <thyago@tre-ce.gov.br>:
>
> > Hi,
> >
> >     I am facing a problem with jsessionid and I hope u guys can help me.
I
> > have 2 tomcat (4.1.29 version) configurations, one at W2K (for develop)
and
> > another at Linux Red Hat (for production).  The W2K one is working just
fine.
> >  But with the Linux one I always receive the same ID for the jsessionid,
no
> > matter how many times I refresh the page.  Bellow is the JSP scriptlet I
am
> > using for test purpose (file "Session.jsp" saved at webapps\ROOT ):
> >
> > <%
> >  out.println("Session ID: " + session);
> >  out.println("<BR>Date: " + session.getAttribute("date"));
> >  session.setAttribute("date", new java.util.Date());
> >  out.println("<br><a href=\"" + response.encodeURL("session.jsp") +
"\">Click
> > here</a>");
> > %>
>
> Provided you have this declared in your JSP:
>
> <%@ page language="java" import="java.util.Date, java.util.Enumeration" %>
>
> You might try to get session info with the following scriptlet:
>
> <%
>
> // print session info
>
>         Date created = new Date(session.getCreationTime());
>         Date accessed = new Date(session.getLastAccessedTime());
>         out.print("ID: " + session.getId() + "<br />");
>         out.print("Created: " + created + "<br />");
>         out.print("Last Accessed: " + accessed + "<br />");
>         out.print("<br />Attribute names : <br />");
>
>         Enumeration e = session.getAttributeNames();
> while (e.hasMoreElements()) {
>     out.print(e.nextElement() + "<br />");
> }
> %>
>
> >
> >   If I test this code from the Linux Tomcat Server (just typing
> > http://myserver/session.jsp ) jsessionid doesn´t change each time a
refresh
> > the page...
> Isn't it the way it should work ? Keeping a single session between
requests ?
> But I only have RedHat Linux, for dev. and prod. ;)
>
> >And the link doesnt show jsessionid either, as should (notice the
> > "encodeURL")
> >
> >   The configuration files (server.xml) of Tomcats are the same in both
> > plattaforms. The only difference is the attribute appbase of the host
element
> > ("/var/www/webapps" at Linux).
> >
> >   Any clues ?
> >
> > Thyago
> >
> > My server.xml:
> >
> > <Server
> >  port="8005"
> >  shutdown="SHUTDOWN"
> >    debug="0">
> >
> >  <Service name="Tomcat-Standalone">
> >
> >  <Connector
> >       className="org.apache.coyote.tomcat4.CoyoteConnector"
> >    port="8080"
> >        minProcessors="5"
> >        maxProcessors="75"
> >        enableLookups="true"
> >        redirectPort="8443"
> >        acceptCount="100"
> >        debug="0"
> >        connectionTimeout="20000"
> >        useURIValidationHack="false"
> >        disableUploadTimeout="true" />
> >
> >      <Engine
> >        name="Standalone"
> >          defaultHost="localhost"
> >          debug="0">
> >
> >    <Host
> >         name="localhost"
> >             debug="0"
> >             appBase="d:\webapps"
> >          unpackWARs="false"
> >             autoDeploy="true">
> >
> >     <Context
> >            path=""
> >                docBase="raiz"
> >                debug="0"
> >                reloadable="true"
> >                crossContext="true" />
> >
> >        </Host>
> >     </Engine>
> >  </Service>
> > </Server>
> >
> >
> >
>
>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message