I finally win my battle with the listserv! (hint: read the directions ;-)
> All,
>
> Interesting quesion wrt the spec: What should a call to req.getSession() or
> req.getSession(true) return in an included servlet/JSP when a session has not yet
>been
> created?
>
> The servlet spec (both 2.2 and 2.3) states:
> "the included servlet cannot...call any method that affects the headers of the
> response.
> Any attempt to do so should be ignored".
>
> Well, a getSession() or getSession(true) *does* modify the headers of of the
> HttpResponse, because it forces a res.addCookie("JSESSIONID=1234").
>
> So, the issue is, what does "Any attempt to do so should be ignored" mean?
>getSession
> is
> supposed to return a HttpSession handle. I believe "ignoring" means returning null.
>
> Anyone know the answer?
>
> Thx,
> MKB
>
> PS For more context, here's an example:
>
> MyServlet.java
> ....
> res.setContentType("text/html");
> PrintWriter pw = res.getWriter();
> pw.println("Hello");
> pw.flush(); //headers are committed to the output stream
> ...
> //no session created yet!
> RequestDispatcher dis = req.getRequestDispather().include("/MyJSP.jsp");
>
> ----------------
> MyJSP.jsp
> ...
> HttpSession sess = request.getSession();
> ...
> ---------------
>
> Q: What is the expected action of getSession()? Exception? Null?
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
=====
Mike Burba
iPlanet eCommerce Solutions
C: 517.927.1010
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html