Hi Peter

Had the same problem. I needed a solution quickly so I just patched the
code to get it to work.
Firstly, I created a class to handle the sessions:
-------------------------------
public final class SessionPatch
{
  private static StandardManager sm;
  private static SessionPatch sp;
  
  private SessionPatch()
  {
          sm = new StandardManager();
    sm.setSessionTimeOut(30);
    try 
    {
            sm.start();
          } catch(IllegalStateException ex ) {}
  }
  
  public static SessionPatch getInstance()
  {
    if (sm == null)
    {
      sp = new SessionPatch();
    }
    return sp;
  }
  
  public HttpSession getNewSession() 
  {
    return sm.getNewSession("");
  }
  
  public HttpSession findSession(String id) 
  {
    return sm.findSession(id);
  }
}
--------------------------------------
Then I used the following code on each page:
---------------------------------
  SessionPatch patch = SessionPatch.getInstance();
  HttpSession patchedSession;
  if
((patchedSession=patch.findSession(request.getParameter("jsessionid")))=
=null) 
    patchedSession = patch.getNewSession();
---------------------------------

Then you can use patchedSession as your session object:
----------------------------------
patchedSession.setAttribute("user", user);

"unconditional.xml?jsessionid="+patchedSession.getId()

-----------------------------------

Ugly solution, but it works until I have time to figure out something
better.

Leon


-----Original Message-----
From: Peter Hrastnik [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 8:40 AM
To: [EMAIL PROTECTED]
Subject: response.encodeURL and Apache 1.3.12


encodeURL appends ";jsessionid=something" to the given URL (e.g.
response.encodeURL(test.jsp) results in test.jsp;jsessionid=something).
The Apache webserver can't handle such URLs. In other words, it is not
possible to use the (for production systems recommended) tomcat-apache
environment without using cookies to handle sessions. I know that
there's a workaround with Apache's mod_rewrite module but IMHO this
isn't a good solution.

So I created a special encodeURL function that appends the session id
somehow like "test.jsp?jsessionid=something" but I can't figure out how
to tell tomcat to use that request variable as the session id.

Thanx for your help,
        Peter.

-- 
Mag. Peter Hrastnik
tele.ring Telekom Service GmbH
A-1030 Wien, Hainburgerstr. 33
Tel.: +43/1/931012/3277, Mobil: +43/650/6503277

Reply via email to