RE: mod_webapp contexts and virtual hosts
Hey, I've run into something similar, with mod_jk. More below -- Jarecsni, Jnos MORGAN HILL CONSULTING, Internet Applications Unit mailto:[EMAIL PROTECTED] http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392 |-Original Message- |From: Szymon Stasik [mailto:[EMAIL PROTECTED]] |Sent: Tuesday, February 19, 2002 11:15 AM |To: tomcat-dev |Subject: mod_webapp contexts and virtual hosts | |Since I need to have applications available in root, I was trying confs |like (I also have to use apache...): | |WebAppDeploy app_1 conn /app_1 | |with some rewriting but then it seems to be some session/cookie issue :( | I've successfully set up a similar environment. I use Apache mod_rewrite+mod_proxy to do the job. I also had to modify the code in mod_jk since it sets the session cookie (JSESSIONID) with a path which is equivalent with the application context name. That's why sessions don't work. Since it's a very common set up I simply don't understand why it is neglected by tomcat-developers. I've sent numerous mails to tomcat-dev, but was ignored. Again: a transparent integration with Apache (with one vhost per tomcat webapp approach) is not possible because of tomcat's incorrect handling of the session cookie. If you're interested in my solution I'll provide you with more details. Cheers, Jnos -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
altering the session cookie's path (Tomcat 4.0x)
Hi, I wanted to alter Tomcat's default behavior for setting the JSESSIONID cookie. Tomcat normally sets the path of this cookie to be equivalent of the webcontext if any, otherwise it sets it to /. Since I'll need to proxy request with Apache (with altering the URL's first part containing the web context) this kind of session cookie won't work. BTW I'll use each application with a different virtual host, so no conflict may arise from using the same path for all session cookies coming from my server. So I've downloaded the source distribution of Tomcat 4.0-dev (it was a nightly build of 15th of february). I changed the code and successfully created a binary distribution of Catalina with ant dist and ant deploy-catalina. I've run the application but was shocked to see that Catalina still sets the path to the webcontext... I've checked the source code and found only this class where the session cookie is manipulated: o.a.c.connector.HttpResponseBase (lines 642 sqq). Now I'm a bit puzzled about this... Does some of you see where I made a mistake? Thanks, Jnos -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: altering the session cookie's path (Tomcat 4.0x): RESOLVED
Hi, after some time I've found that the session cookie is set in the AJP connector, namely in org.apache.ajp.tomcat4.AJP13Response (method sendHeaders()). Actually to my surprise o.a.c.connector.HttpResponseBase#sendHeaders() is called only when the first resource is asked for (that's what I saw), it's not called thereafter any more. Now everything is working like charm. I have a few questions re this solution: 1. since it's my modification of the tomcat code, naturally it will not be present in any forthcoming tomcat versions - so I'll have to patch each tomcat version before use (something I always tried to avoid) 2. where and how can I initiate that this modification (or a similar one) be applied to the official tomcat source? 3. although my solution is merely an ad hoc one, I can think of a more robust solution to the problem: this behavior of tomcat (what path it generates in the session cookie) should be governed by some configuration properties and not be hardwired in code (the current official code is not flexible enough, since it always sets the path to be equivalent with the application context if any). Cheers, Jnos |-Original Message- |From: Jarecsni Jnos [mailto:[EMAIL PROTECTED]] |Sent: Saturday, February 16, 2002 8:01 PM |To: Tomcat Developers List |Subject: altering the session cookie's path (Tomcat 4.0x) | | |Hi, | |I wanted to alter Tomcat's default behavior for setting the JSESSIONID |cookie. Tomcat normally sets the path of this cookie to be |equivalent of the |webcontext if any, otherwise it sets it to /. [...] | |I've run the application but was shocked to see that Catalina |still sets the |path to the webcontext... I've checked the source code and found only this |class where the session cookie is manipulated: |o.a.c.connector.HttpResponseBase (lines 642 sqq). | |Now I'm a bit puzzled about this... Does some of you see where I made a |mistake? | -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
altering the session cookie's path (Tomcat 4.0x)
Hi, I wanted to alter Tomcat's default behavior for setting the JSESSIONID cookie. Tomcat normally sets the path of this cookie to be equivalent of the webcontext if any, otherwise it sets it to /. Since I'll need to proxy request with Apache (with altering the URL's first part containing the web context) this kind of session cookie won't work. BTW I'll use each application with a different virtual host, so no conflict may arise from using the same path for all session cookies coming from my server. So I've downloaded the source distribution of Tomcat 4.0-dev (it was a nightly build of 15th of february). I changed the code and successfully created a binary distribution of Catalina with ant dist and ant deploy-catalina. I've run the application but was shocked to see that Catalina still sets the path to the webcontext... I've checked the source code and found only this class where the session cookie is manipulated: o.a.c.connector.HttpResponseBase (lines 642 sqq). Now I'm a bit puzzled about this... Does some of you see where I made a mistake? Thanks, Jnos -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
setting the path in the session cookie (Tomcat 402b)
Hi, it seems that tomcat uses the /contextname path when creating the cookie for the JSESSIONID. Since we use Apache in front of Tomcat and we use mod_rewrite with mod_proxy to provide aliasing of dynamic Java resources, it is not working for us. We would like to be able to configure this path. Thanks in advance Jnos -- Jarecsni, Jnos MORGAN HILL CONSULTING, Internet Applications Unit mailto:[EMAIL PROTECTED] http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
jakarta-tomcat-connectors
Hi, I'd like to build TC40x. Where can I download jakarata-tomcat-connectors? The building.txt says one should download it. Thanks Jnos -- Jarecsni, Jnos MORGAN HILL CONSULTING, Internet Applications Unit mailto:[EMAIL PROTECTED] http://morganhillconsulting.hu/ :: Phone+Fax: + 36 1 484 0392 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
FW: Sun J2EE RI, JSP, Include, ErrorPage -- cannot use an errorpage with dinamically included JSPs
Hi! I have a very unnoying problem. In a J2EE application I use a "master JSP" as a template for generating predefined screens (the idea is borrowed from the demo application PetStore). This JSP includes several other JSPs (for the top, left side, right side, central, bottom positions). What JSPs should be included for a given view is defined for each screen in a configuration object. Okay, this is quite simple so far, and what is more, it is working fine. The problem arises when one decides to add error handling. If you add the %@ page errorPage="errorpage.jsp" % directive to an included page, and throw an exception from that page, the JSP container says that it cannot forward to the errorpage "as OutputStream or Writer has already been obtained" (throws a java.lang.IllegalStateException) This happens when you use the jsp:include tag, the one which enables you to use an expression for defining its "page" attribute. It is essential for us, since we want to say something like the following in our template.jsp: jsp:include page="%= currentScreen.get("TOP") %" flush="true" // My Tomcat in J2EE 1.2.1 says "flush="true" is obligatory in JSP 1.0" so I use it in this form This line would dinamically include the JSP defined in the actual "screen" for the topmost area in the template. So this would be fine, but it does not work. The whole thing works fine with the %@ include file="file.jsp" % tag. So this tag does what I really need: it glues all included JSPs together, parses them, greating one big JSP (one servlet finally), which uses a common errorpage, so when I throw an exception from one of the included JSPs, the error page gets called. The only problem is that this tag does not accept an expression, only a literal string, so you cannot say: %@ include file="%= currentScreen.get("TOP") %" % Rather annoying, isn't it? I would appreciate any kind of urgent help. Cheers, Janos. PS: I forgot to mention before, that I tested Sun's PetStore Demo application in this respect, and it _failed_ also... So JSP error handling does not work (!) in Sun's demo application, either.