Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
View Interest List Message Details
<< Back to Search Results

Date: 01/06/2003
From: matt@newatlanta.com
Subject: RE: [ServletExec] Adding / as context path
Yes, that appears to do it.
Thanks Andrew!
I added a dummy alias:

Alias / "dummy"

to my httpd.conf file, bounced Apache, and viola:
http://localhost brought up the top-level welcome file for my webapp whose
context path is '/'.

Apache configuration mystery solved.

Matt McGinty
Software Engineer
New Atlanta Communications, LLC
matt@newatlanta.com
http://www.newatlanta.com

-----Original Message-----
From: servletexec-interest-owner@mail.newatlanta.com
[mailto:servletexec-interest-owner@mail.newatlanta.com]On Behalf Of
Andrew Wilson
Sent: Monday, January 06, 2003 2:33 PM
To: 'servletexec-interest@mail.newatlanta.com'
Subject: RE: [ServletExec] Adding / as context path


Sorry to come in late on this issue, but we ran into this also.

We found that using the apache "alias" command to redirect requests   
for the
root context to a different context solved this problem (the problem is that
apache just would never pass requests for the root context off to servlet
exec).

Here's the appropriate parts of our httpd.conf (the important line is the
"Alias" one):

Alias / "/fd1"

AddHandler servlet-exec jsp
ServletExecInstances qassf01 127.0.0.1:8888
ServletExecAliases qassf01 .jsp /
<Location />
   SetHandler servlet-exec
</Location>


Hope this works for you,

Andrew Wilson
Viair, Inc.

> -----Original Message-----
> From: Matt McGinty [mailto:matt@newatlanta.com]
> Sent: Thursday, January 02, 2003 1:47 PM
> To: servletexec-interest@mail.newatlanta.com
> Subject: RE: [ServletExec] Adding / as context path
>
>
> Another possible workaround would be:
> 1. configure your JSP as a servlet (as you have done)
> 2. create a servlet mapping of "/index.html" to that named
> servlet (remove
> any '/' mappings).
>
> That way, you'll request http://mysite.com, Apache will ask SE for
> /index.html, and SE will run your JSP.
> Links that begin with '/' should work too.
>
> That's about all I can think of.
>
> Matt McGinty
> Software Engineer
> New Atlanta Communications, LLC
> matt@newatlanta.com
> http://www.newatlanta.com
>
>
> -----Original Message-----
> From: servletexec-interest-owner@mail.newatlanta.com
> [mailto:servletexec-interest-owner@mail.newatlanta.com]On
> Behalf Of Matt
> McGinty
> Sent: Thursday, January 02, 2003 4:34 PM
> To: servletexec-interest@mail.newatlanta.com
> Subject: RE: [ServletExec] Adding / as context path
>
>
> Tom,
> When you configure your JSP as a Servlet, and map / to that
> named Servlet,
> and then request http://mysite.com, your JSP runs, but it runs as a
> configured servlet (not really as a welcome file).
> This is just masking the true problem... that Apache is
> changing the request
> to be http://mysite.com/index.html
>
> If the links to your .css and your .js files do NOT begin
> with a forward
> slash, then I think the reason they do not work as expected
> is because of
> the response header named "Content-Location".
> in my tests using Telnet I can see that it's value is                 
"index.html.en".
> So it appears to me that the browser is trying to resolve
> your .css and .js
> links relative
> to that non-existent file.
>
> If the links to your .css and your .js files DO begin with a
> forward slash,
> then when the browser requests them from the server, the same
> JSP configured
> as a servlet is invoked a second time.
> This is because '/' maps to the web app and '/' maps   
to that
> configured JSP
> inside the webapp.
> Configuring a servlet mapping of '/' overrides any welcome
> file settings.
> If you have a servlet mapping of '/', then any request that
> does not match
> other, longer prefix aliases will go to that Servlet.
> http://mysite.com/yada/bing/bada will still go that servlet
> likewise for
> http://mysite.com/index.html
> or
> http://mysite.com/index.html.en
> or
> http://mysite.com/images/small_icon.gif
> or
> http://mysite.com/mystyle.css
> or
> http://mysite.com/myjavascript.js
>
> That is expected behavior when you configure a default servlet (i.e. a
> servlet mapping of '/')
> Prefix aliases are matched before suffix aliases, and they
> are matched from
> longest to shortest.
>
> I used an image link for my testing (instead of css or js, because it
> simplifies things).
> The JSP I used is:
>
> ---
> <html>
>  <p>
>    This is index.jsp
>    <%=request.getRequestURI()%>
>  </p>
>  <img src='/images/small_icon.gif'>
> </html>
> ---
>
> If I configure the JSP as a servlet and map '/' to that named
> servlet, and
> request http://mysite.com, my JSP runs, but the image link is
> not correct
> (i.e. the image does NOT display, AND it does NOT show up as
> a broken link).
> If I then request http://mysite.com/images/small_icon.gif I
> get the exact
> same response (i.e. the JSP runs).
> This is expected behavior.
>
> The underlying issue is still there... your Apache is still
> taking a request
> like http://mysite.com and turning it into
> http://mysite.com/index.html
> or
> http://mysite.com/index.html.en
>
> And it is doing this before ServletExec ever gets a chance to
> handle the
> request.
> It seems that Apache 1.3.20 does not have this problem, but
> Apache 1.3.26 on
> Windows definately does.
> If you give your webapp a context path other than '/' the
> problem seems to
> go away.
>
> If you can't find a way to configure your Apache so it won't
> do this, then
> here is a possible workaround:
>
> create an index.html in the doc root of your web app.
> Have it contain:
>
> ---
> <META HTTP-EQUIV='Refresh' NAME='refresh'           
CONTENT="0;
> URL='http://www.mysite.com/index.jsp'">
> ---
>
> This is like a redirect.
>
> Matt McGinty
> Software Engineer
> New Atlanta Communications, LLC
> matt@newatlanta.com
> http://www.newatlanta.com
>
> -----Original Message-----
> From: servletexec-interest-owner@mail.newatlanta.com
> [mailto:servletexec-interest-owner@mail.newatlanta.com]On
> Behalf Of tom
> green
> Sent: Tuesday, December 31, 2002 12:13 PM
> To: servletexec-interest@mail.newatlanta.com
> Subject: RE: [ServletExec] Adding / as context path
>
>
> Hi,
>    I was able to get to index.jsp page by creating a
> URL Mapping from / to index.jsp in SE.
> But when the index.jsp page comes up the css and js
> files are not getting rendered properly and I am
> getting debug errors in IE. Should Apache render these
> files or SE? And how to do it?
>
> Anybody knows how to make the css and js files come up
> properly with this setup?
>
> Thanx
> tom
>
> --- Matt McGinty <matt@newatlanta.com> wrote:
> > Tom,
> > When you say "... is not working.", might you mean
> > that you are getting a
> > 404 when requesting http://www.mysite.com ?
> >
> > If so, I think this problem is caused by how Apache
> > handles default pages.
> > In httpd.conf, you may see:
> >
> > <IfModule mod_dir.c>
> >     DirectoryIndex index.html
> > </IfModule>
> >
> > When apache gets a request like
> > http://www.mysite.com it changes it to be
> > http://www.mysite.com/index.html (Apache assumes
> > that you want index.html).
> > *THEN* it passes the request to your web app running
> > in SE (the one whose
> > context path is '/')
> > If index.html is not present, then a 404 results.
> >
> > I'm not certain how to tell Apache to not do this,
> > but there may be a way.
> > Basically, I think that Apache is trying to be
> > "smart" and do some extra
> > work with the request before passing it over to SE.
> >
> > The reason I think this is because I request:
> > http://localhost
> >
> > and my apache access log shows:
> > 127.0.0.1 - - [31/Dec/2002:10:55:43 -0500] "GET /
> > HTTP/1.1" 200 3581
> >
> > But the response in my browser is the error page
> > that is configured in my
> > web app with context path of '/'.
> > That error page is mapped to the 404 return code,
> > and it shows me that the
> > r

Message Thread
Date Subject Author
12/31/2002 RE: [ServletExec] Adding / as context path matt@newatlanta.com
12/31/2002 RE: [ServletExec] Adding / as context path trt987@yahoo.com
01/02/2003 RE: [ServletExec] Adding / as context path matt@newatlanta.com
01/02/2003 RE: [ServletExec] Adding / as context path matt@newatlanta.com
01/06/2003 RE: [ServletExec] Adding / as context path AndrewW@ViAir.com
01/06/2003 RE: [ServletExec] Adding / as context path matt@newatlanta.com
12/30/2002 [ServletExec] Adding / as context path trt987@yahoo.com
<< Back to Search Results


   
company media information terms of use privacy policy contact us