You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Joseph S <jk...@selectacast.net> on 2009/06/09 02:03:34 UTC
Problem with overriding the default servlet on tc 6.0.18
I have this in the web.xml of my application:
<servlet-mapping>
<servlet-name>
MyServlet
</servlet-name>
<url-pattern>
/
</url-pattern>
</servlet-mapping>
Which works fine, except for requests without pathinfo (i.e.
http://servername/ ). That still seems to be handled by the default
tomcat servlet, which is serving up the index.jsp that I no longer want
to use. Am I doing something wrong or is this a bug?
Incidentally I discovered you can't <welcome-file-list> by having an
empty element, you have to have at least one <welcome-file> in there or
the default servlet will use the one in $CATALINA_BASE/conf/web.xml .
Bug or feature?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problem with overriding the default servlet on tc 6.0.18
Posted by Joseph S <jk...@selectacast.net>.
Joseph S wrote:
> After restarting tomcat it started working by itself, but only if I've
> overriden the default <welcome-file-list> in my web.xml
More on this: I discovered that reloading the webapp itself doesn't
work, I have to restart Tomcat itself in order to get the welcome file
list override to take.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problem with overriding the default servlet on tc 6.0.18
Posted by Joseph S <jk...@selectacast.net>.
After restarting tomcat it started working by itself, but only if I've
overriden the default <welcome-file-list> in my web.xml or move
index.jsp out of the way, implying that the default tomcat servlet is
running *before* mine and then handing off to mine. I checked and
requesting a plain static file does get handled by my servlet instead of
the tomcat default, so this is only an issue with /
Joseph S wrote:
> I have this in the web.xml of my application:
>
> <servlet-mapping>
> <servlet-name>
> MyServlet
> </servlet-name>
> <url-pattern>
> /
> </url-pattern>
> </servlet-mapping>
>
>
> Which works fine, except for requests without pathinfo (i.e.
> http://servername/ ). That still seems to be handled by the default
> tomcat servlet, which is serving up the index.jsp that I no longer
> want to use. Am I doing something wrong or is this a bug?
>
> Incidentally I discovered you can't <welcome-file-list> by having an
> empty element, you have to have at least one <welcome-file> in there
> or the default servlet will use the one in $CATALINA_BASE/conf/web.xml
> . Bug or feature?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problem with overriding the default servlet on tc 6.0.18
Posted by Konstantin Kolinko <kn...@gmail.com>.
2009/6/9 Bill Barker <wb...@wilshire.com>:
>
>> Incidentally I discovered you can't <welcome-file-list> by having an empty
>> element, you have to have at least one <welcome-file> in there or the
>> default servlet will use the one in $CATALINA_BASE/conf/web.xml . Bug or
>> feature?
>
> I'd say an enhancement rather than a bug, since you can always do (as you
> have discovered):
> <welcome-file-list>
> <welcome-file>index.doesnotexist</welcome-file>
> </welcome-file-list>
>
> For the benifit of the archives, this of course assumes that you have set
> replaceWelcomeFiles="true" in the <Context ... /> element.
>
The above said about "replaceWelcomeFiles" is wrong. That property
is not documented and is used by Tomcat internals only. It is automatically
switched on before processing a web.xml file, and thus its initial value, as
specified in context file, does not matter.
The welcome files list in a web application always replaces the default one.
In web-app_2_3.dtd there is
<!ELEMENT welcome-file-list (welcome-file+)>
so the list cannot be empty.
In 2.4 and 2.5 schemas the minOccurs attribute for "welcome-file"
element is 1 (the default value), so the list cannot be empty either.
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problem with overriding the default servlet on tc 6.0.18
Posted by Bill Barker <wb...@wilshire.com>.
"Joseph S" <jk...@selectacast.net> wrote in message
news:4A2DA6D6.50707@selectacast.net...
>I have this in the web.xml of my application:
>
> <servlet-mapping>
> <servlet-name>
> MyServlet
> </servlet-name>
> <url-pattern>
> /
> </url-pattern>
> </servlet-mapping>
>
>
> Which works fine, except for requests without pathinfo (i.e.
> http://servername/ ). That still seems to be handled by the default
> tomcat servlet, which is serving up the index.jsp that I no longer want to
> use. Am I doing something wrong or is this a bug?
>
This is a feature. Tomcat needs to process the <welcome-file-list> before
doing Servlet mapping so that the correct servlet is invoked for the welcome
file.
> Incidentally I discovered you can't <welcome-file-list> by having an empty
> element, you have to have at least one <welcome-file> in there or the
> default servlet will use the one in $CATALINA_BASE/conf/web.xml . Bug or
> feature?
I'd say an enhancement rather than a bug, since you can always do (as you
have discovered):
<welcome-file-list>
<welcome-file>index.doesnotexist</welcome-file>
</welcome-file-list>
For the benifit of the archives, this of course assumes that you have set
replaceWelcomeFiles="true" in the <Context ... /> element.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org