Re: Request.getContextPath() after RequestDispatcher.forward()
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 To whom it may concern, ciAnd7 wrote: | Context ... path=/ / Perhaps you meant: Context path= - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkfML38ACgkQ9CaO5/Lv0PCHoACeI3d+Ch7reozfQtAzsVINH6MT TTEAn35opET+yf75yVHO/0FfpnURyDFT =Uouv -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Request.getContextPath() after RequestDispatcher.forward()
Hi! I am using tomcat 6.0.13 on linux. I try to deploy my application in to the root context. I.e. it should be available as root application on one of virtual host (http://vhost1/). So, I add Context ... path=/ / into the server.xml (I know, it is not recommended to do it in server.xml, but it is simple and I just want to do simple testing right now). The application works fine. But there is a problem with request.getContextPath() method. My Servlets use RequestDispatcher.forward() to JSP. And then, JSP use Request.getContextPath() to generate URLs (more precisely, getContextPath() used by JSTL`s c:url .. implementation). But getContextPath() returns /, so urls generated by c:url looks like //image/blah.gif - i.e. they have double leading slashes. As result - browser can`t process urls correctly. As I understand specification, getContextPath() should returns empty string in such case... (And JSTL`s implementation of c:url expects such behavior). If I deploy application under ordinal context path, all works correctly (getContextPath() returns string like /myapp). If my Servlet use RD.include() instead of forward(), all works fine: getContextPath() returns empty string. Could somebody help me with solution. Thanks. -- View this message in context: http://www.nabble.com/Request.getContextPath%28%29-after-RequestDispatcher.forward%28%29-tp15808317p15808317.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request.getContextPath() after RequestDispatcher.forward()
Christopher Schultz-2 wrote: ciAnd7 wrote: | Context ... path=/ / Perhaps you meant: Context path= - -chris No. I mean ' path=/ '. I try empty string putting Context / in server.xml, and in app.war/META-INF/context.xml but without success: ROOT application from default host directory executed for '/' path on every virtual host. I found solution with 'path=/ ' and it seems to works except forward() gerContextPath(). -- View this message in context: http://www.nabble.com/Request.getContextPath%28%29-after-RequestDispatcher.forward%28%29-tp15808317p15812168.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request.getContextPath() after RequestDispatcher.forward()
On Mon, Mar 3, 2008 at 11:49 AM, ciAnd7 [EMAIL PROTECTED] wrote: No. I mean ' path=/ '. Then that's the problem -- it's wrong. The path of the default webapp is the empty string . :-) -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request.getContextPath() after RequestDispatcher.forward()
On Mon, Mar 3, 2008 at 11:49 AM, ciAnd7 [EMAIL PROTECTED] wrote: No. I mean ' path=/ '. The real problem is refusal to do things the recommended way, which is to name your default webapp ROOT (case sensitive). If you'd simply done that, you wouldn't have to mess around trying to emulate Rube Goldberg. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]