web.xml help - pulling images from the war under Apache

From: Scott Ellsworth (scott_at_alodar.com)
Date: 09/30/04


Date: Wed, 29 Sep 2004 21:46:41 -0700

Hi, all.

I would like my webapp to pull images from the war/exploded deployment
directory, rather than having Apache try to snag them from the
filesystem. I have not figured out what to put in web.xml to make that
happen, and I have been experimenting, reading docs, and googling all
day. Anyone want to loan me a clue?

The webapp is to go under Tomcat 4.1.29/Apache 1.3.?. On both the
XServe and the Solaris machines that are going to be the hosts for this,
Apache is set to use mod_jk to forward requests to Tomcat.

When I tried the following web.xml, images appeared happily in if I
connected directly to Tomcat on port 9006. No images appeared if I
connected to Apache on port 80. The compiled jsps did appear.
 
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
   <display-name>MyMonomer</display-name>
   <description>mymonomer</description>
   <servlet>
      <servlet-name>mymonomer</servlet-name>
      <jsp-file>/index.jsp</jsp-file>
   </servlet>

   <servlet-mapping>
      <servlet-name>mymonomer</servlet-name>
      <url-pattern>/*.gif</url-pattern>
   </servlet-mapping>
</web-app>

I would have thought my url-pattern would have given me all gifs.

I tried the following servlet mapping, but no images were displayed even
in Tomcat on 9006.

   <servlet-mapping>
      <servlet-name>mymonomer</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>

when I tried an url pattern of

   <servlet-mapping>
      <servlet-name>mymonomer</servlet-name>
      <url-pattern>*</url-pattern>
   </servlet-mapping>

Tomcat 4.1.29 started throwing exceptions.

NB: httpd.conf contains

<IfModule mod_jk.c>
        JKWorkersFile /etc/httpd/workers.properties
        JKLogFile /var/log/httpd/mod_jk.log
        JKLogLevel error
        JKMount /*.jsp JBoss1
        JKMount /servlet/* JBoss1
        JKMount /examples/* JBoss1
</IfModule>

in httpd.conf. jk.properties contains no content. server.xml contains
the usual defaults.

Scott



Relevant Pages

  • Re: Apache http Server + Resin/Tomcat
    ... JavaScript files and images. ... believe that Tomcat or Resin will do better job than Apache. ...
    (comp.lang.java.softwaretools)
  • Re: web.xml help - pulling images from the war under Apache
    ... Scott Ellsworth wrote: ... > Apache is set to use mod_jk to forward requests to Tomcat. ... > When I tried the following web.xml, images appeared happily in if I ...
    (comp.lang.java.programmer)
  • Re: Apache http Server + Resin/Tomcat
    ... JavaScript files and images. ... > believe that Tomcat or Resin will do better job than Apache. ...
    (comp.lang.java.softwaretools)
  • Re: Problems configuring a path="xx" on Apache/Tomcat
    ... I'm upgrading from Apache 1.3 Tomcat 3.* jdk 1.4 ... You should not need to create a new context for your webapp. ...
    (comp.lang.java.programmer)
  • May be slightly OT: Apache on Solaris Segmentation Fault
    ... I have Apache 2.0.52, which I compiled using the gcc from the Companion CD for Solaris 9) awhile ago, running on a Solaris 9 SPARC system. ... Originally, I had this system configured to front-end for WebLogic running on another Solaris 9 system, using the WebLogic Plugin for Apache to connect from Apache to WebLogic. ... Recently, I also needed to have this Apache instance front-end for a Tomcat 4.1.30 system, so I configured mod_proxy using apxs from the original Apache 2.0.52 source directory. ... I was seeing these errors when I access both the new webapp on Tomcat, as well as the original webapp on WebLogic, but I found that if I switch the Apache-to-WebLogic connection back to using the WebLogic Plugin for Apache instead of mod_proxy, I can access the WebLogic webapp without those segfault errors, so it seems like the segfaults must be occurring due to mod_proxy. ...
    (comp.unix.solaris)