tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid...@pidster.com>
Subject Re: JSPs forcing session ID to be created?
Date Sun, 25 Jun 2006 12:40:10 GMT
I think Tomcat creates a session, unless you tell it otherwise.


http://wiki.jboss.org/wiki/Wiki.jsp?page=DisableSessionPersistence

I repeat the popular refrain "Google is your friend."






Michael Rimov wrote:
> Environment:  Tomcat 5.5.17 using http connector, Servlet API 2.4.
> 
> Hi All,
> 
> I'm not sure where to go from here, so I'm going to assume it's a Catalina
> issue and go from there.
> 
> I was working on a front controller that wouldn't instantiate a session
> unless absolutely necessary - (for scalability reasons)  --   To my dismay,
> I was seeing a session created anyway.
> 
> After some debugging, I came across the source of my problem:
> 
> The following JSP will generate a session token:
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
> <html>
> 	<head>
> 		<title>Example</title>
> 	</head>
> 	<body>
> 		<h1>Sample Form</h1>
> 	</body>
> </html>
> 
> 
> Here's the relevant stack trace.
> 
> 
> 	RequestFacade.getSession(boolean) line: 822	
> 	
> ApplicationHttpRequest(HttpServletRequestWrapper).getSession(boolean) line:
> 215	
> 	ApplicationHttpRequest.getSession(boolean) line: 544	
> 	ApplicationHttpRequest.getSession() line: 493	
> 	PageContextImpl._initialize(Servlet, ServletRequest,
> ServletResponse, String, boolean, int, boolean) line: 148	
> 	PageContextImpl.initialize(Servlet, ServletRequest, ServletResponse,
> String, boolean, int, boolean) line: 123	
> 	JspFactoryImpl.internalGetPageContext(Servlet, ServletRequest,
> ServletResponse, String, boolean, int, boolean) line: 104	
> 	JspFactoryImpl.getPageContext(Servlet, ServletRequest,
> ServletResponse, String, boolean, int, boolean) line: 61	
> 	Example.jsp line: not available	
> 	Example_jsp(HttpJspBase).service(HttpServletRequest,
> HttpServletResponse) line: 97	
> 	Example_jsp(HttpServlet).service(ServletRequest, ServletResponse)
> line: 802	
> 	JspServletWrapper.service(HttpServletRequest, HttpServletResponse,
> boolean) line: 332	
> 
> In this case, the boolean value for creating the session is true.
> 
> 
> I got some raw source code (older tomcat) and the _jspService looked like
> this:
> 
> 
>       _jspxFactory = JspFactory.getDefaultFactory();
>       response.setContentType("text/html");
>       pageContext = _jspxFactory.getPageContext(this, request, response,
>       			null, true, 8192, true);
>       _jspx_page_context = pageContext;
>       application = pageContext.getServletContext();
>       config = pageContext.getServletConfig();
>       session = pageContext.getSession();
>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> 
> Is this really by design?  Bug?  Obviously, I'd rather not have a new
> session created until I need it.
> 
> Is this situation submittable as a bug or am I misusing the library?
> 
> Thanks in advance!
> 
> 								-Mike
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message