Has anyone had any problems with this?
I'm trying to delete a cookie (setMaxAge=0), and calling res.addCookie(), but it doesn't look like the cookie is being removed from the client. The exact same code works in another servlet container. I'm using version 1.0.3b
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Scott Lawrence
> Sent: Tuesday, August 08, 2000 1:13 AM
> To: Orion-Interest
> Cc: [EMAIL PROTECTED]
> Subject: RE: ServletSession's and Servlet Reloading
>
>
> I do have development=true but that's only so that orion generates the
> source for the jsps as far as I know.
>
> I ran a few tests to see what was happening and I got mixed
> results. The
> most disturbing was the code below. It simply keeps track of
> an attribute
> in the session and how many times it exists vs. doesn't exist in the
> session. I sat with Netscape reloading the url for the
> servlet over and
> over and occassionally, every 19th request would fail to use the same
> session and a new one would be created.
>
> Also, I played around with HttpSessionBindingListener and
> simply kept track
> of when an object was removed from a session to verify that the
> session-timeout setting in my web.xml was working properly.
> Well, sometimes
> I would get 2 events instead of one when the object was
> removed from the
> session. It's as if the objects in the session that implemented
> HttpSessionBinding Listener would be registered twice after the bind
> occurred. I couldn't nail down the exact scenario in which two
> HttpSessionBindingEvents occurred on unbind.
>
> I wish a document existed that explained how sessions and reloading is
> taking place. Without this sort of explanation, I'm finding
> that I have to
> do a lot of trial and error for developing. I'm spending way
> too much time
> on the app server vs. my code... well less than if I were
> using Weblogic or
> other app server since orion starts so quickly ;-)... but
> still, it's making
> debugging next to impossible. I hope that sessions can be
> made accessible
> through the parent classloader of the servlet classloader so that the
> session is not lost from reload to reload. Alas, all
> indications are that
> this is not the case...
>
>
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.IOException;
> import java.io.PrintWriter;
>
> public class Test extends HttpServlet {
> static int notExistsCounter = 0;
> static int existsCounter = 0;
>
> public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException {
> HttpSession session = req.getSession(true);
> Object attribute = session.getAttribute("attribute");
> PrintWriter out = res.getWriter();
>
> if (attribute == null) {
> notExistsCounter++;
> out.println("attribute did not exist in session");
> out.println("binding attribute to session...");
> session.setAttribute("attribute", "this is a test");
> out.println("bound attribute to session");
> } else {
> existsCounter++;
> out.println("attribute exists in session");
> out.println("attribute: " + attribute);
> }
> out.println("exists count: " + existsCounter);
> out.println("doesn't exist count: " + notExistsCounter);
> }
> }
>
>
