You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2002/07/26 21:31:13 UTC
RE: Changing servlet context path with mod_jk2 and Apache
Andris,
You will have to map *.something instead of the whole path.
I haven't looked at mod_jk2 but I am guessing it will be something like
this:
<Location /*.jsp>JkUriSet worker ajp13</Location>
Now, to map servlets you will either have to specify each of them by
name.
<Location /myservlet>JkUriSet worker ajp13</Location>
<Location /myservlet2>JkUriSet worker ajp13</Location>
Or give them a fake extension:
<Location /*.servlet>JkUriSet worker ajp13</Location>
Then, in your web.xml change the <servlet-mapping> to something like:
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/myservlet.servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>myservlet2</servlet-name>
<url-pattern>/myservlet2.servlet</url-pattern>
</servlet-mapping>
Make sense? I think choice two is much easier since you do not have
to keep changing your mappings in Apache. But you decide for yourself.
Charile
> -----Original Message-----
> From: Andris Spruds [mailto:litrema@apollo.lv]
> Sent: Friday, July 26, 2002 4:17 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Changing servlet context path with mod_jk2 and Apache
>
>
> Hi Tomcat folks,
>
> I'm trying to put my servlet under http://www.myserver.com/myservlet
> (instead
> of whole www.myserv.com/myapp/servlet/myservlet line) by using Apache2 &
> mod_jk2. In general, I need a more simple URL, or noone will remember to
> visit my site ;)
>
> Everything went fine: I get rid of the "/servlet/" part by using
> <servlet-mapping> directive in Tomcat' web.xml and changed the
> context path
> of the application to "/". Next, <Location />JkUriSet worker
> apj13<Location>
> in Apache's httpd.conf and everything goes... With one exception: when I
> access http://www.myserver.com/images then Tomcat complains about
> "context-path not defined". My intention, however, was to to leave static
> data handling (images, css, etc) to Apache. The problem is that mod_jk2's
> "JkUriSet"
> takes all the directories bellow the <Location> directive and
> does not allow
> to define exceptions (as
> in the case I want some subdirectory content to be served by Apache, not
> Tomcat).
>
> Any advices will be warmly welcomed.
> Thnx,
> Andris Spruds
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Changing servlet context path with mod_jk2 and Apache
Posted by Eddie Bush <ek...@swbell.net>.
You shouldn't have to give it a fake extension I don't think. the
web.xml would be the ideal place to map it though. I've done mappings
such as just mapping the class name to /, as in:
<servlet-mapping>
<servlet-name>theName</servlet-name>
<url-pattern>/theName</url-pattern>
</servlet-mapping>
... and it worked just fine.
Charles N. Harvey III wrote:
>Andris,
>You will have to map *.something instead of the whole path.
>
>I haven't looked at mod_jk2 but I am guessing it will be something like
>this:
>
><Location /*.jsp>JkUriSet worker ajp13</Location>
>
>Now, to map servlets you will either have to specify each of them by
>name.
>
><Location /myservlet>JkUriSet worker ajp13</Location>
><Location /myservlet2>JkUriSet worker ajp13</Location>
>
>Or give them a fake extension:
>
><Location /*.servlet>JkUriSet worker ajp13</Location>
>
>Then, in your web.xml change the <servlet-mapping> to something like:
><servlet-mapping>
> <servlet-name>myservlet</servlet-name>
> <url-pattern>/myservlet.servlet</url-pattern>
></servlet-mapping>
><servlet-mapping>
> <servlet-name>myservlet2</servlet-name>
> <url-pattern>/myservlet2.servlet</url-pattern>
></servlet-mapping>
>
>
>Make sense? I think choice two is much easier since you do not have
>to keep changing your mappings in Apache. But you decide for yourself.
>
>
>Charile
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Changing servlet context path with mod_jk2 and Apache
Posted by Andris Spruds <li...@apollo.lv>.
Hey, it works!!! Thank you, Charile!
Happy Andris.
----- Original Message -----
From: "Charles N. Harvey III" <ch...@alloy.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, July 26, 2002 9:31 PM
Subject: RE: Changing servlet context path with mod_jk2 and Apache
Andris,
You will have to map *.something instead of the whole path.
I haven't looked at mod_jk2 but I am guessing it will be something like
this:
<Location /*.jsp>JkUriSet worker ajp13</Location>
Now, to map servlets you will either have to specify each of them by
name.
<Location /myservlet>JkUriSet worker ajp13</Location>
<Location /myservlet2>JkUriSet worker ajp13</Location>
Or give them a fake extension:
<Location /*.servlet>JkUriSet worker ajp13</Location>
Then, in your web.xml change the <servlet-mapping> to something like:
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/myservlet.servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>myservlet2</servlet-name>
<url-pattern>/myservlet2.servlet</url-pattern>
</servlet-mapping>
Make sense? I think choice two is much easier since you do not have
to keep changing your mappings in Apache. But you decide for yourself.
Charile
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>