dev@glassfish.java.net

Re: welcome-file and servlet-mapping config being ignored?

From: Max Poon <maxpoon_at_dev.java.net>
Date: Tue, 12 Jun 2007 18:21:04 +0800

Hi Ken

Thanks! I was deploying the app using directoryDeployed=true so I
thought the app can just be recompiled instead of redeployed and picked
up by App Server after restart. After redeploying the app (which
cleared the generated files under "domains/domain1/generated", I got
most of the things working properly except redirecting to the configured
welcome-file, ie requesting http://<host>/<uri>/ still seemed not to go
to http://<host>/<uri>/faces/index.jsf, automatically.

Thanks again!
Max


Ken Paulsen wrote:
>
> Hi Max,
>
> Assuming you have a servlet-mapping for the FacesServlet of "/faces/*"
> the welcome-file below should work (I just tried it and it worked) --
> although only for the index.jsp in the docroot. For subdirectories,
> it doesn't work (and I'm not sure it can work as the welcome-file
> would have to insert "/faces" after your context root, and the page
> name at the end of the requested uri).
>
> As for #2, are you saying the welcome-file is not invoked when you
> specify "index.jsf" as the welcome file and then make
> "http://<host>/<uri>/"? If so, this works for our app... however, we
> actually have files named "index.jsf" (using JSFTemplating) which I
> think is a requirement for this to work. However, if you mean that
> you have index.jsp and asking for index.jsf directly (w/ the servlet
> mapping mentioned) doesn't work... this should work (and I have test
> that it does work).
>
> If you are testing after making web.xml changes w/o redeploying, you
> should remove the files in the "domains/domain1/generated/"
> directory. GlassFish will not re-look at your web.xml files unless
> you redeploy or it can't find the information from the generated
> directory.
>
> Good luck!
>
> Ken
>
> Max Poon wrote:
>> Hi *
>>
>> On SJS AppServer 9.0_01 (+ NetBeans 5.5) :
>>
>> (1) It seems that the <welcome-file> configured in my app's
>> WEB-INF/web.xml :
>>
>> <welcome-file-list>
>> <welcome-file>/faces/index.jsp</welcome-file>
>> </welcome-file-list>
>>
>> is always ignored as
>>
>> * seen from NetBeans (attached image) and
>> * in actual application, i.e. requesting http://<host>/<uri>
>> always goes to http://<host>/<uri>/index.jsp instead of
>> http://<host>/<uri>/faces/index.jsp
>>
>> (2) Also, FacesServlet is not invoked for
>> http://<host>/<uri>/index.jsf even if web.xml has the following:
>>
>> <servlet-mapping>
>> <servlet-name>Faces Servlet</servlet-name>
>> <url-pattern>*.jsf</url-pattern>
>> </servlet-mapping>
>>
>>
>> Any input much appreciated.
>>
>> Thanks!
>> Max