You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Greg Hanson <gr...@imall.com> on 2000/03/07 18:23:59 UTC

jsp for virtual domains

Let me begin by stating that I'm extremely new to the Java world and I'm
looking for great advice.
After looking over the spec for Servlet 2.2 and JSP 1.1, it appears that
there is no support for running jsp for virtual domains.
What I'd like to do:
Allow virtual domains the ability to implement jsp for their own site
without conflicting with other domains.  It appears that in order to do
this, the ServletContext per VM must have the same UID.  If each virtual
domain has a unique UID, would it be impossible to run only one VM for all
virtual domains and elliminate the potential for security breaches (i.e.
file accessibility).
If there is a good work around, I'd appreciate any advice available.
Thanks.

Greg Hanson
Excite@Home e-Business Services
http://www.excitehome.net
1+801.226.5007
"Quality is never an accident;
 it is always the result of
 intelligent effort."
	--John Ruskin


problem/bug in tomcat: restarting a session

Posted by Alex Yiu <ay...@us.oracle.com>.
Hi,

I found out that there is a bug / an extra restriction about restarting
a session in Tomcat implementation (3.1M1). This "behavior" does not
exist in previous Javasoft's servlet reference implementation. And,
IMHO, I don't think the restriction is unreasonble. Actually, I think
it's a bug.

What I want to do in restarting a session:
(1) invalidate the session
(2) recreate a new session within the same request
(3) then use the session (set/get attrs)

When I tried to do these, I got a java.lang.IllegalStateException,
saying, Session already invalidated (see below). After invalidation,
req.getSession(true) still returns the same session handle to me. I
think it should return a new session object to me. So, the
IllegalStateException won't occur.


Here is a piece of sample code: SessTest.java:
======================================================
import javax.servlet.http.*;
import java.io.*;

public class SessTest extends HttpServlet
{
  public void service(HttpServletRequest req, HttpServletResponse rep)
  {
    try {
      PrintWriter out=rep.getWriter();
      out.println("<pre>SessTest");
      HttpSession session=req.getSession(true);
      out.println(session.getAttribute("abc"));
      out.println(session);
      session.setAttribute("abc","def");
      session.invalidate();
      session=req.getSession(true);
      out.println("SessTest-002");
      out.println(session);
      session.setAttribute("abc","def");
      out.println("SessTestEnd</pre>");
    } catch (IOException ioe)
    {
    }
  }
}
======================================================

Here is the output:
======================================================
SessTest
null
org.apache.tomcat.session.StandardSession@1dc63906
SessTest-002
org.apache.tomcat.session.StandardSession@1dc63906
Error: 500

Internal Servlet Error:

java.lang.IllegalStateException: setAttribute: Session already
invalidated
        at
org.apache.tomcat.session.StandardSession.setAttribute(StandardSession.java:709)
        at SessTest.service(SessTest.java:20)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
        at
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:403)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:224)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:347)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
        at
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:305)
        at java.lang.Thread.run(Thread.java)
======================================================