users@glassfish.java.net

Re: GF2 Virtual Server capabilities

From: <Jan.Luehe_at_Sun.COM>
Date: Fri, 01 Jun 2007 09:56:39 -0700

glassfish_at_javadesktop.org wrote:

>>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.
>
>

Correct.

>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.
>
>

Yes. Alternate docroots follow the same url matching rules that are
specified in the servlet spec.
Those rules don't check whether a resource exists for one mapping, but
not for another.
In other words, whether a resource exists (or does not exist) for a
given mapping is irrelevant
for the url matching algorithm.

>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>
>
>

Yes.

>
>
>>>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!
>
>

You're welcome.


Jan


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