users@glassfish.java.net

Re: alternatedocroot_1

From: Noah White <emailnbw_at_gmail.com>
Date: Sun, 30 Mar 2014 12:43:29 -0400

Hi Bob,

So we used to use a sun-web.xml file in our project and decided that having our own servlet to serve files from ‘alternate doc roots’ was a better fit for things. It also meant that we could get rid of a manual provisioning step (editing the sun-web.xml file).

Before we went that route our sun-web.xml file looked like the example below. This was for a JavaEE6 project deployed to Glassfish 3.1.2.2, so if you are using a different JavaEE (like 5 or 7) the doctype may look different - and this is actually important.

Also note that sun-web.xml is deprecated but still supported for backwards compat. In a new project you should be using glassfish-web.xml for this.

<!DOCTYPE sun-web-app PUBLIC
        "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN"
        "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app>
    <!-- Change alternatedocroots to agree with your local environment -->
    <property name=“alternatedocroot_1" value="from=/foobarr/* dir=D:\" />
    <!-- If you have more then one foobar then uncomment/add more alternate doc roots -->
    <!— <property name="alternatedocroot_2" value="from=/foobar2/* dir=C:\" /> -->
</sun-web-app>

The documentation for the glassfish-web.xml can be found here [1]. The format for setting a property in that file is the same just the DOCTYPE and root elements have changed.

What version of GF are you deploying to and what version of the EE APIs are you coding against?

-Noah

[1] - http://docs.oracle.com/cd/E26576_01/doc.312/e24929/dd-files.htm#beaql

On Mar 30, 2014, at 2:15 AM, forums_at_java.net wrote:

> crickets...........interesting.......
>
> --
>
> [Message sent by forum member 'bobt100']
>
> View Post: http://forums.java.net/node/901612
>
>