OK. I still don't get it, but I don't want to prolong the thread.
Thanks for the info.
John
On Wed, 9 Jul 2003 16:30:08 -0400, Mark Biciunas <[EMAIL PROTECTED]> wrote:
It became necessary only when we tried to create a servlet that is accessed
without any path information (ie: www.mysite.com instead of
www.mysite.com/myservlet). Of course, if you have specified a static html
page as the welcoming page to your site, you may never need to access a
servlet without a path. In our case, we have no static html, everything is
generated on the fly with servlets, so we ran into the problem.
Mark Biciunas
[EMAIL PROTECTED]
----- Original Message -----
From: "John Turner" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, July 09, 2003 4:18 PM
Subject: Re: setting up a root servlet / getting images to appear in Tomcat
4.1.24
<[EMAIL PROTECTED]>
I'm just trying to understand why it was necessary.
Our apps have mixed content, and we did not have to configure things as you've described.
John
On Wed, 9 Jul 2003 16:04:06 -0400, Mark Biciunaswrote:not
> As I understand it, the servlet will receive all requests other than
> those
> that have been re-routed through servlet-mappings.
>
> Just out of curiosity, do you see a problem with this approach?
>
> Mark Biciunas
> Agorex Inc
> (905) 274-6785
> [EMAIL PROTECTED]
> ----- Original Message -----
> From: "John Turner" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, July 09, 2003 3:57 PM
> Subject: Re: setting up a root servlet / getting images to appear in
> Tomcat
> 4.1.24
>
>
>>
>> So you have a servlet that is intercepting all requests, other than
>> image
>> requests?
>>
>> John
>>
>> On Wed, 9 Jul 2003 15:55:21 -0400, Mark Biciunas
> <[EMAIL PROTECTED]>
>> wrote:
>>
>> > Actually, the point of the article is to explain how NOT to deliver
>> the
>> > images via the servlet and to allow Tomcat to serve images normally -
>> > something that doesn't happen if you are using a root context.
>> >
>> > It is only when you configure server.xml with a blank context path
>> (ie:
>> > <Context path="" docBase="myservlet" debug="0"/>) that you run into
>> this
>> > problem. If you specify a path (ie: <Context path="myservlet"
>> > docBase="myservlet" debug="0"/> then the problem doesn't appear.
>> >
>> > Hope this helps,
>> >
>> > Mark Biciunas
>> > [EMAIL PROTECTED]
>> > ----- Original Message -----
>> > From: "John Turner" <[EMAIL PROTECTED]>
>> > To: "Tomcat Users List" <[EMAIL PROTECTED]>
>> > Sent: Wednesday, July 09, 2003 3:19 PM
>> > Subject: Re: setting up a root servlet / getting images to appear in
>> > Tomcat
>> > 4.1.24
>> >
>> >
>> >>
>> >> Just so I'm clear....you want to deliver the images via the servlet?
>> >> I'm
>> >> missing why you have to declare the MIME types of images at
> all...Tomcat
>> > is
>> >> perfectly capable of serving them in a standard HTTP/1.1 manner
>> without
>> > any
>> >> intervention from a servlet, and without any additional
>> configuration.
>> >>
>> >> John
>> >>
>> >> On Wed, 9 Jul 2003 15:19:48 -0400, Mark Biciunas
>> > <[EMAIL PROTECTED]>
>> >> wrote:
>> >>
>> >> > This email formally presents what I have learned over the past
>> couple
>> >> > days
>> >> > about setting up a servlet to be accessed as root (ie:
>> >> www.myservlet.com
>> >> > instead of www.myservlet.com/somepath) without loosing access to
>> >> images
>> >> > and
>> >> > other mime types. It is based primarily on advice received from
>> Bill
>> >> > Barker
>> >> > and Stefan Radzom as well as the hints and suggestions of many
> others.
>> >> > As
>> >> > you are looking at this solution, please bear in mind that I am> anhave
>> >> > expert in Tomcat configuration and there is likely a lot of things
>> I
>> > have
>> >> > missed. I welcome any additional advice / corrections people have
>> to
>> >> > offer.
>> >> >
>> >> >
>> >> > Setting up a servlet to be accessed without a path (ie:
>> >> > www.myservlet.com)
>> >> > is fairly easy if you pay attention to a couple of extra steps.
> First
>> >> > this
>> >> > is to deploy your application in the webapps directory as usual
>> (ie:
>> >> > webapps/myservlet). Next, update conf/servlet.xml so that you>> amake
>> >> > root
>> >> > context that looks like:
>> >> >
>> >> > <Context path="" docBase="myservlet" debug="0"/>
>> >> >
>> >> > This will tell tomcat to serve ALL incoming requests to your
>> servlet,
>> >> > including requests for images, etc. If your servlet is not set up
>> to
>> >> > handle
>> >> > mime types, then your images, etc. will seem to disappear. To>> >> sure
>> >> > the
>> >> > images, etc. are handled correctly, you need to map them out in
>> your
>> >> > WEB-INF/web.xml as follows:
>> >> >
>> >> > <servlet>
>> >> > <servlet-name>myservlet</servlet-name>
>> >> > <servlet-class>mypackage.MyServlet</servlet-class>
>> >> > </servlet>
>> >> >
>> >> > <servlet-mapping>
>> >> > <servlet-name>myservlet</servlet-name>
>> >> > <url-pattern>/</url-pattern>
>> >> > </servlet-mapping>
>> >> >
>> >> > <servlet-mapping>
>> >> > <servlet-name>default</servlet-name>
>> >> > <url-pattern>*.gif</url-pattern>
>> >> > </servlet-mapping>
>> >> >
>> >> > <servlet-mapping>
>> >> > <servlet-name>default</servlet-name>
>> >> > <url-pattern>*.jpg</url-pattern>
>> >> > </servlet-mapping>
>> >> >
>> >> > What is happining here in the first two sections is that you have
>> >> > identified
>> >> > the servlet class and mapping for your servlet. This is more or
>> less
>> > the
>> >> > same as you would do for any servlet. If you do nothing more than
>> >> this,
>> >> > your servlet will (should) work, but you will not see any images
> since
>> >> > picture.gif would match to a url-pattern of "/" and get sent to
>> your
>> >> > servlet
>> >> > for processing.
>> >> >
>> >> > In the second two sections, we are telling Tomcat that anything
>> that
>> >> > matches
>> >> > a pattern of *.gif or *.jpg should be sent to the default servlet.
>> >> Now
>> >> > any
>> >> > requests that match *.gif or *.jpg will be handled correctly. If
>> you
>> >> > need
>> >> > to support more mime types, simply create more servlet mappings.
>> >> >
>> >> > Where did the default servlet come from? It is already configured
>> in
>> >> > conf/web.xml. Remember that conf/web.xml is automatically read
> before
>> >> > your
>> >> > WEB-INF/web.xml so it can do it's thing without you having to
>> worry
>> >> > about
>> >> > it at all. The trick is to use url-patterns to send requests back
>> to
>> > the
>> >> > default servlet so that they don't end up in your servlet.
>> >> >
>> >> > The above solution will work great as long as you don't have to
>> many
>> > mime
>> >> > types to deal with. If you need to handle lots of diferent types
>> of
>> >> > requests, then Bill Barker presented the following alternate
>> solution
>> >> > which
>> >> > involves changing your servlet code to redirect requests:
>> >> >
>> >> > URL file = getServletContext().getResource(request.getPathInfo())
;
>> >> > if( file != null ) { // physical resource exists
>> >> > RequestDispatcher rd =
>> >> > getServletContext().getNamedDispatcher("default");
>> >> > rd.forward(request, response);
>> >> > return;
>> >> > }
>> >> > // Your code here.
>> >> >
>> >> > I have not tried this solution so I do not know to much about it.
>> It
>> >> > seems
>> >> > staightforward enough though, so I would expect it to work great.
>> >> >
>> >> >
>> >> > Mark Biciunas
>> >> > [EMAIL PROTECTED]
>> >> >
>> >> >
>> >>
--------------------------------------------------------------------
>>
>>
>> -
>> >> > To unsubscribe, e-mail: tomcat-user- [EMAIL PROTECTED]
>> >> > For additional commands, e-mail: tomcat-user-
>> [EMAIL PROTECTED]
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Using M2, Opera's revolutionary e-mail client:
>> http://www.opera.com/m2/
>> >>
>>--------------------------------------------------------------------->> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: tomcat-user- [EMAIL PROTECTED]
>> >
>> >
>> > --------------------------------------------------------------------
-
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: tomcat-user- [EMAIL PROTECTED]
>> >
>> >
>>
>>
>>
>> --
>> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
