RE: Deploying multiple WAR files on Resin and Apache

From: Osma Ahvenlampi <oa@xxx.fi>
Date: Thu Apr 04 2002 - 00:57:52 PST

That isn't a fix for the problem you described. Do the URLs for the
images (view source of the HTML page in the browser) have the /app1
prefix or not?

If not, you need to stop using root-relative image references (as in
<img src="/foo">) and use relative-to-current-directory instead (as in
<img src="../foo">) or prefix everything with getContextPath() like
Chris explained below.

If the URLs DO start with the /app1 prefix, then your application is
fine but Apache doesn't know where to find the images. That would then
be because you've set the directory alias in Apache incorrectly. You can
work around that with what you have below (forwarding everything to
Resin instead), but that hurts performance, or fix the directory alias
in Apache so that Apache can serve the static files itself.

On Wed, 2002-04-03 at 22:34, Thu, Aye wrote:
> Thanks, Chris. I think that would be the long term solution and I'll be
> doing that. Combing through the archives, I found a temporary solution which
> is to add the following to the Apache conf file:
>
> <Location "/app1/">
>
> sethandler caucho-request
>
> </Location>
>
> I think this means that all requests for app1 goes straight to Resin and
> Apache doesn't even handle images.
>
>
>
>
> -----Original Message-----
> From: Chris Pratt [mailto:thechrispratt@xxx.com]
> Sent: Wednesday, April 03, 2002 1:08 PM
> To: resin-interest@xxx.com
> Subject: Re: Deploying multiple WAR files on Resin and Apache
>
>
> That's because the <img and <link tags are being loaded by the browser, not
> the server. One thing you could do is use request.getContextPath() +
> "/images/image.gif" in the src attribute for the <img> tag.
> (*Chris*)
>
> ----- Original Message -----
>
> From: Thu, <mailto:ThuA@usa.redcross.org> Aye
> To: 'resin-interest@xxx.com' <mailto:'resin-interest@xxx.com'>
> Sent: Wednesday, April 03, 2002 8:56 AM
> Subject: Deploying multiple WAR files on Resin and Apache
>
>
> This is not exactly a resin question but it relates to configuration of
> Resin with Apache. The scenario is:
> 1. I have multiple WAR files representing multiple applications. Each
> application have their own images and HTML files in /images and /html
> subdirectories relative to the application in the WAR file. (e.g. in JSP
> files, applications refer to their image resources as <IMG height=4
> src="images/blue_line.jpg" >)
>
> 2. I have resin configured with:
> <web-app id='app1' app-dir="/usr/websites/app1/app1.war"/>
>
> 3. I have Apache configured with:
>
> Alias /app1/ "/usr/websites/app1"
> <Directory "/usr/websites/app1">
> AllowOverride None
> Options None
> Order allow,deny
> Allow from all
> </Directory>
>
> 4. Everything works fine for JSPs and Servlets but all the relative paths
> for images and javascripts are being relative from the root URL and not the
> "/app1" URL.
>
> <http://myserver/app1> http://myserver/app1
> Each app have their own images so I can't create an alias called /images/.
>
> The question is how do I configure Resin or Apache so that any relative
> paths in the WAR files are calculated for that WAR file's URL and not the
> root URL?
>
> Thanks!
> Aye
>
> Aye-Theinga K. Thu
> Software Engineering
> NBCS Development Center
> (703) 803-4937
>

-- 
Osma Ahvenlampi <oa@xxx.fi>

Received on Thu 04 Apr 2002 00:57:52 -0800

This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:17:00 PDT