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 Biciunas <[EMAIL PROTECTED]> wrote:
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
<[EMAIL PROTECTED]>
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 Biciunaswrote:all...Tomcat
> 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> isothers.
>> 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 manyan>> > As >> > you are looking at this solution, please bear in mind that I am not>> > expert in Tomcat configuration and there is likely a lot of things IFirst
> 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.>> > thissince
>> > is to deploy your application in the webapps directory as usual (ie:
>> > webapps/myservlet). Next, update conf/servlet.xml so that you have a
>> > 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 make
>> 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>> > picture.gif would match to a url-pattern of "/" and get sent to yourbefore
>> > 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>> > 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: [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]
