users@glassfish.java.net

Re: Glassfish requested resource () is not available servlet issue

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 13 Jan 2010 09:22:54 -0800

On 01/13/10 05:22 AM, glassfish_at_javadesktop.org wrote:
> This has helped a lot. I put an index.html in my root and the error has gone away.
>
> Thank you Jan.
>

Great!

Note that you could also configure your app so that your
HelloWorldServlet is served as the welcome page. The Servlet 3.0 spec
makes this possible by requiring that the web container also consider
welcome files mapped to Servlets instead of just static resources, see
SRV 10.10 ("Welcome Files"):

  The Web server must append each welcome file in the order specified in
  the deployment descriptor to the partial request and check whether a
  static resource in the WAR is mapped to that request URI. *If no match
  is found, the Web server MUST again append each welcome file in the
  order specified in the deployment descriptor to the partial request
  and check if a servlet is mapped to that request URI.*

You could achieve this by adding "/index.html" to the list of URL
patterns mapped to your Servlet:

  <servlet-mapping>
    <servlet-name>HelloWorldServlet</servlet-name>
    <url-pattern>/hey</url-pattern>
    <url-pattern>/index.html</url-pattern>
  </servlet-mapping>

After making the above change and redeploying your app, clicking on
your app's launch link will cause the string "Hello World" to be
returned as the response.

Hope this helps.

Jan

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