users@glassfish.java.net

Re: Servlets 3.0: Default servlet hides static resources

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 27 Jan 2010 16:00:16 -0800

On 01/27/10 01:25 AM, glassfish_at_javadesktop.org wrote:
> Hi,
>
> I've encountered a problem when mapping a servlet to "/" (making it the default servlet, as per the spec):
>
> The servlet works just as expected, but if I try to request a static resource, e.g. a gif image or an html file, the path resolves to the default servlet. JSPs, however, are resolved as expected.
>
> This is the layout of my "webapp" directory:
>
> /test.html --> [i]Resolves to default servlet[/i]
> /test.jsp --> [i]OK[/i]
> /images/img.gif --> [i]Resolves to default servlet[/i]
>
> Is this the intended behavior of the Servlet 3.0 spec?
>

Note that the Servlet 3.0 spec defines special semantics for the
empty-string ("") URL pattern (as opposed to "/", which is what you
may be using, given the above description).

The empty string ("") URL pattern maps exactly to the application's
context root, that is, any requests of the form

  http://host:post/<context-root>/


Can I see your web.xml?

Thanks,

Jan


> [Message sent by forum member 'toker5' (java.net_at_reinseth.org)]
>
> http://forums.java.net/jive/thread.jspa?messageID=383209
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>