You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Anto Paul <an...@gmail.com> on 2004/09/29 09:41:47 UTC
Servlet mapping problem
Hi all,
I am writing an application which have to serve content based on the
hostname it is requested. Different hosts will be set to same ROOT
directory. There wont be any content at the ROOT. Everything will be
on subdirectories. I wrote a servlet with mapping as / . But when it
is forwarded to subdirectory it is coming to same servlet and
executing in a loop. This is an example of what I need.
Directory structure. Host name
ROOT/sites/one.com - one.com
ROOT/sites/two.com two.com
ROOT/sites/three.com three.com
A request to one.com should go to /sites/one.com .
A request to two.com should go to /sites/two.com .
How to make it.
Thanks in advance
Anto Paul
--
To strive,to seek,to find and not to yield
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Servlet mapping problem
Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Anto Paul wrote:
>Hi there,
> I posted this to Tomcat User List. I didnt posted this to Struts.
>Although the application is using Struts it is not specific to Struts.
>
>rgds
>Anto Paul
>
>
>On Wed, 29 Sep 2004 00:59:53 -0700, Michael McGrady
><mi...@michaelmcgrady.com> wrote:
>
>
>>Anto Paul wrote:
>>
>>
>>
>>>Hi all,
>>> I am writing an application which have to serve content based on the
>>>hostname it is requested. Different hosts will be set to same ROOT
>>>directory. There wont be any content at the ROOT. Everything will be
>>>on subdirectories. I wrote a servlet with mapping as / . But when it
>>>is forwarded to subdirectory it is coming to same servlet and
>>>executing in a loop. This is an example of what I need.
>>>
>>>Directory structure. Host name
>>>ROOT/sites/one.com - one.com
>>>ROOT/sites/two.com two.com
>>>ROOT/sites/three.com three.com
>>>
>>>A request to one.com should go to /sites/one.com .
>>>A request to two.com should go to /sites/two.com .
>>>
>>>How to make it.
>>>
>>>Thanks in advance
>>>
>>>Anto Paul
>>>
>>>
>>>
>>>
>>>
>>>
>>Hello, Anto,
>>
>>I don't have enough information to tell what your problem is. Are you
>>using ActionForwards to go to these areas? What "servlet" with a
>>mapping as / are you talking about? Remember this is a Struts list. If
>>you have everything mapped to your servlet in your web.xml, then, of
>>course, everything is going to go to your servlet. I suspect this is
>>what you have done. Why do you have a servlet with a "mapping" as "/" ?
>>
>>Michael McGrady
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>
>
>
>
Oops, my bad.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Servlet mapping problem
Posted by Anto Paul <an...@gmail.com>.
Hi there,
I posted this to Tomcat User List. I didnt posted this to Struts.
Although the application is using Struts it is not specific to Struts.
rgds
Anto Paul
On Wed, 29 Sep 2004 00:59:53 -0700, Michael McGrady
<mi...@michaelmcgrady.com> wrote:
>
>
> Anto Paul wrote:
>
> >Hi all,
> > I am writing an application which have to serve content based on the
> >hostname it is requested. Different hosts will be set to same ROOT
> >directory. There wont be any content at the ROOT. Everything will be
> >on subdirectories. I wrote a servlet with mapping as / . But when it
> >is forwarded to subdirectory it is coming to same servlet and
> >executing in a loop. This is an example of what I need.
> >
> >Directory structure. Host name
> >ROOT/sites/one.com - one.com
> >ROOT/sites/two.com two.com
> >ROOT/sites/three.com three.com
> >
> >A request to one.com should go to /sites/one.com .
> >A request to two.com should go to /sites/two.com .
> >
> >How to make it.
> >
> >Thanks in advance
> >
> >Anto Paul
> >
> >
> >
> >
> Hello, Anto,
>
> I don't have enough information to tell what your problem is. Are you
> using ActionForwards to go to these areas? What "servlet" with a
> mapping as / are you talking about? Remember this is a Struts list. If
> you have everything mapped to your servlet in your web.xml, then, of
> course, everything is going to go to your servlet. I suspect this is
> what you have done. Why do you have a servlet with a "mapping" as "/" ?
>
> Michael McGrady
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
--
To strive,to seek,to find and not to yield
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
AW: AW: Servlet mapping problem
Posted by Steffen Heil <li...@steffen-heil.de>.
Hi
> I cant grasp what you said. I am using Tomcat 4.1.x. I searched in Google
for world welcome-file and could'nt find anything on it. Are you talking
about welcome-file-list ?.
Yes. It's entry is welcome-file.
<welcome-file-list>
<welcome-file>root</welcome-file>
</welcome-file-list>
If someone accesses "/", tomcat will search for "/root" and will find the
empty file. Then it will start to process that file, but since "/root" is
mapped, your servlet is called.
Regards,
Steffen
Re: AW: Servlet mapping problem
Posted by Anto Paul <an...@gmail.com>.
I cant grasp what you said. I am using Tomcat 4.1.x. I searched in
Google for world welcome-file and could'nt find anything on it. Are
you talking about welcome-file-list ?.
rgds
Anto Paul
On Wed, 29 Sep 2004 11:43:33 +0200, Steffen Heil <li...@steffen-heil.de> wrote:
> Hi
>
> > I wrote a servlet with mapping as / . But when it is forwarded to
> subdirectory it is coming to same servlet and executing in a loop.
>
> You cannot map a single url. Tomcat only maps prefixes. So, you cannot map
> "/" with tomcat. (Resin can, but this is another story.)
> Here is a workaround:
> Map "/root" as a servlet and define "root" as world welcome-file (see docs).
> Depending on the tomcat version in use, you need to create a empty file
> named "root".
>
> > Remember this is a Struts list.
>
> Nope.
>
> Regards,
> Steffen
>
>
>
>
--
To strive,to seek,to find and not to yield
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
AW: Servlet mapping problem
Posted by Steffen Heil <li...@steffen-heil.de>.
Hi
> I wrote a servlet with mapping as / . But when it is forwarded to
subdirectory it is coming to same servlet and executing in a loop.
You cannot map a single url. Tomcat only maps prefixes. So, you cannot map
"/" with tomcat. (Resin can, but this is another story.)
Here is a workaround:
Map "/root" as a servlet and define "root" as world welcome-file (see docs).
Depending on the tomcat version in use, you need to create a empty file
named "root".
> Remember this is a Struts list.
Nope.
Regards,
Steffen
Re: Servlet mapping problem
Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Anto Paul wrote:
>Hi all,
> I am writing an application which have to serve content based on the
>hostname it is requested. Different hosts will be set to same ROOT
>directory. There wont be any content at the ROOT. Everything will be
>on subdirectories. I wrote a servlet with mapping as / . But when it
>is forwarded to subdirectory it is coming to same servlet and
>executing in a loop. This is an example of what I need.
>
>Directory structure. Host name
>ROOT/sites/one.com - one.com
>ROOT/sites/two.com two.com
>ROOT/sites/three.com three.com
>
>A request to one.com should go to /sites/one.com .
>A request to two.com should go to /sites/two.com .
>
>How to make it.
>
>Thanks in advance
>
>Anto Paul
>
>
>
>
Hello, Anto,
I don't have enough information to tell what your problem is. Are you
using ActionForwards to go to these areas? What "servlet" with a
mapping as / are you talking about? Remember this is a Struts list. If
you have everything mapped to your servlet in your web.xml, then, of
course, everything is going to go to your servlet. I suspect this is
what you have done. Why do you have a servlet with a "mapping" as "/" ?
Michael McGrady
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org