tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kenneth R. Kress <kkr...@home.com>
Subject Re: Servlet configuration
Date Sat, 23 Sep 2000 15:51:45 GMT
Jake,

I'm glad you have something that works. The LocationMatch
directive tells Apache to direct a particular url-pattern
to a servlet instead of an html file. If you use port 8080 or run 
tomcat-jakarta stand-alone, the url-pattern directive is sufficient. But
if you integrate Apache and Jakarta, you need the LocationMatch
directive -- as far as I know.

Are you using Apache? When you say, "you just need to provide 
something like the following to your tomcat.conf file", I begin
to suspect that you are not integrating Apache and Tomcat.
Tomcat generates a file called tomcat-apache.conf each
time it is started. Unless you are doing your own thing, you
should consider using the tomcat-apache.conf file. It permits 
Apache to handle html files and tomcat to handle jsps and servlets.
This is discussed in "Setting Tomcat to Cooperate with the Apache Web Server"
in $TOMCAT_HOME/doc/uguide/tomcat_ug.html.

I found the url-pattern only worked when I came to
the pages through jakarta-tomcat's port 8080. When I came
through Apache, I got page not found errors. The solution
to that problem was to use LocationMatch.

The reason I needed aliasing may be quite different from
from your reasons. And perhaps that explains why you may
be satisfied setting the context path, while I need more 
flexibility. We also differ in that my goal was to shorten the path, 
not lengthen it. 

The aliasing discussed on JGuru is useful for a Model 2 architecture
where *ALL* requests to a context are first sent to a dispatching servlet. 
That servlet looks at the pathinfo() and then re-directs the request
to the appropriate page or servlet. This centralized approach
has benefits for security, logging, and dynamic reconfiguration
of paths. It also permits you to hide the implementation details --
you can use cgi-bin instead of servlet, you can end your files
with .pl instead of .jsp, and so on.

   Ken.

On Sat, 23 Sep 2000, you wrote:
> 
> Hmmm... I'm a bit confused here.
> 
> My example covers the first one you mention.  It does go into a little more 
> detail with using the getPathInfo() method but, for the most part, it is 
> exactly what my example said.
> 
> On the second one, I'm not sure I see where the problem is.  It says to add 
> the following to tomcat.conf or tomcat-apache.conf to support servlet 
> aliasing between Apache+Tomcat:
> 
> <LocationMatch /myApp/jsp-bin/* >
>      SetHandler jserv-servlet
> </LocationMatch>
> 
> However, I have this working quite nicely without doing that at all.  It 
> think that is a Jserv ONLY issue.  With Tomcat, you just need to provide 
> something like the following to your tomcat.conf file:
> 
> Alias /examples "C:/Program Files/Apache Group/Jakarta/tomcat/webapps/examples"
> <Directory "C:/Program Files/Apache Group/Jakarta/tomcat/webapps/examples">
>      Options Indexes FollowSymLinks
> </Directory>
> ApJServMount /examples/servlet /examples
> <Location "/examples/WEB-INF/">
>      AllowOverride None
>      deny from all
> </Location>
> <Directory "C:/Program Files/Apache 
> Group/Jakarta/tomcat/webapps/examples/WEB-INF/">
>      AllowOverride None
>      deny from all
> </Directory>
> <Location "/examples/META-INF/">
>      AllowOverride None
>      deny from all
> </Location>
> <Directory "C:/Program Files/Apache 
> Group/Jakarta/tomcat/webapps/examples/META-INF/">
>      AllowOverride None
>      deny from all
> </Directory>
> 
> 
> In this case, all your aliasing that you have done in your web.xml will 
> work just fine through apache.
> 
> Am I missing something?  Why would I want to use <LocationMatch>????
> 
> 
> Jake
> 
> 
> At 10:30 AM 9/23/2000 -0400, you wrote:
> >There are two Q&As on JGuru, which address the issue of
> >aliasing.
> >
> >Check out:
> >
> >How do I use servlet aliasing, so the URL
> >"http://foo.com/mywebapp/servlet/a.b.c.MyServlet" can become
> >"http://foo.com/mywebapp/Thingy"?
> >http://www.jguru.com/jguru/faq/view.jsp?EID=134402
> >
> >and
> >
> >How do I make servlet aliasing work with Apache+Tomcat?
> >http://www.jguru.com/jguru/faq/view.jsp?EID=140877
> >
> >   Ken.
> >
> >
> >On Fri, 22 Sep 2000, you wrote:
> > > Thanks!!!  For my purposes at this point, I can stick with the "test" root
> > > directory, so your answer solves my problem.  I read all about doing what
> > > you described below, in the docs online, but somehow they didn't make any
> > > sense at all, and you did.  Thanks a bunch!
> > >
> > > Jeff Nibler
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jacob Kjome [mailto:Jacob.R.Kjome@syntegra.com]
> > > > Sent: Friday, September 22, 2000 2:37 PM
> > > > To: 'tomcat-user@jakarta.apache.org'
> > > > Subject: RE: Serlvet configuration
> > > >
> > > >
> > > > in your local web.xml in the /webapps/test/WEB-INF directory,
> > > > you need the
> > > > following:
> > > >
> > > > <web-app>
> > > >
> > > >     <display-name>Test Servlets</display-name>
> > > >     <description>
> > > >     This is where my test servlets are
> > > >     </description>
> > > >
> > > >     <servlet>
> > > >         <servlet-name>myservlet</servlet-name>
> > > >         <servlet-class>ServletName</servlet-class>
> > > >     </servlet>
> > > >
> > > >     <servlet-mapping>
> > > >         <servlet-name>myservlet</servlet-name>
> > > >
> > > > <url-pattern>/here-too/oh-ya-and-even-here/servletname</url-pattern>
> > > >     </servlet-mapping>
> > > >
> > > >
> > > > </web-app>
> > > >
> > > > That gets you to the point to pointing to:
> > > >
> > > > http://www.myserver.com/test/here-too/oh-ya-and-even-here/servletName
> > > >
> > > > However, I'm not sure how you would set the directory for the initial
> > > > context to be different than what the directory (called
> > > > "test" in this case)
> > > > in your webapps directory is?
> > > >
> > > > Anyone?  This would be good to know.
> > > >
> > > >
> > > > Jake
> > > >
> > > > -----Original Message-----
> > > > From: NIBLER JEFF R. (PDX1JRN) [mailto:pdx1jrn@ups.com]
> > > > Sent: Friday, September 22, 2000 4:26 PM
> > > > To: tomcat-user@jakarta.apache.org
> > > > Subject: Serlvet configuration
> > > >
> > > >
> > > > Hi all, this is my first e-mail to the list, hope I did it
> > > > correctly (the
> > > > FAQ and info E-mail returned nada).  Ok, I have one question
> > > > about Tomcat:
> > > > what configuration file, and where in that file, can you
> > > > change the url
> > > > pathing for where your servlet is accessed?  For instance, lets say my
> > > > directory structure looks like:
> > > > C:\tomcat\webapps\test\web-inf\classes
> > > > Now by default (at least, default on my installation), to
> > > > view a servlet via
> > > > the url, you would nee to type:
> > > > http://www.myserver.com/test/servlet/servletName
> > > > So how do I change it so that the url pathing would read:
> > > > http://www.myserver.com/here/here-too/oh-ya-and-even-here/servletName
> > > > ?
> > > > In addition, when I do that, will I need to modify the
> > > > tomcat.conf that
> > > > Apache references if I want Apache to output the results of
> > > > the servlet to
> > > > the client? Thanks in advance for anyone who can help me on this one.
> > > >
> > > > Jeff Nibler
> > > >
> >--
> >Kenneth R. Kress                                kkress@home.com
> 

----------------------------------------
Content-Type: text/html; name="unnamed"
Content-Transfer-Encoding: 7bit
Content-Description: 
----------------------------------------

-- 
Kenneth R. Kress                                kkress@home.com

Mime
View raw message