users@glassfish.java.net

Re: GF2 Virtual Server capabilities

From: <glassfish_at_javadesktop.org>
Date: Thu, 31 May 2007 21:04:55 PDT

> Once a request has been mapped to the url-pattern of
> an alternate
> docroot, it will be served from the alternate docroot
> only, and the
> regular docroot will not be considered for this
> request.
>
> Therefore, if your webapp contains resources a.html,
> b.html, c.html,
> d.html, and e.html, and you want a.html, b.html, and
> c.html to be
> looked up in the normal docroot, and d.html and
> e.html to be served
> from an alternate docroot, you need to specify
> alternate docroot properties
> for d.html and e.html in your sun-web.xml, as
> follows:
>
> <sun-web-app>
> <property name="alternatedocroot_1"
> value="from=/d.html
> ir=<alternate-docroot-1>"/>
> <property name="alternatedocroot_2"
> value="from=/e.html
> ir=<alternate-docroot-2>"/>
> </sun-web-app>


So, the key is the URL mapping, not necessarily the existence of an actual resource.

The following wouldn't make any sense then:

<sun-web-app>
<property name="alternatedocroot_1" value="from=*.html dir=<alternate-docroot-1>"/>
<property name="alternatedocroot_2" value="from=*.html dir=<alternate-docroot-2>"/>
</sun-web-app>

The server would take, in this example, d.html, map it to the first alternate docroot, say "this URL matches", and then happily return a 404 because alternate-docroot-1 doesn't actually contain d.html, it's int docroot-2. The system won't fail at the resource level, just the whole URL.

So, to be really effective, I should do

<sun-web-app>
<property name="alternatedocroot_1" value="from=/client/* dir=/home/clients_stuff"/>
</sun-web-app>

> >Finally, will it work for JSP 2.0 tag files?
> >
> >i.e. can I have the following files:
> >
> >$wardeploydir/WEB-INF/tags/tag1.jsp
> >$alternateroot/WEB-INF/tags/tag2.jsp
> >$alternateroot/test.jsp <-- has a <%_at_taglib
> prefix="t" tagdir="/WEB-INF/tags"%> header and uses
> both tag1 and tag2
>
> It should work in principle (since the JSP compiler
> uses
> ServletContext.getResource(), which considers
> alternate docroots, to load a requested JSP page or
> tag file), but I
> have not tested it.

I'd probably have to put the client tags in to an alternate directory, much like the earlier example.

> Jan

Thanx Jan!
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=219865