users@glassfish.java.net

Re: Virtual Web Directory connected to Windows UNC Path

From: <Jan.Luehe_at_Sun.COM>
Date: Fri, 24 Aug 2007 11:34:58 -0700

glassfish_at_javadesktop.org wrote:

>Scenario:
>
>OS: Windows Server 2003 SP1
>App Server: GlassFish V2 RC4 Build 58
>
>I'm trying to deploy a web application to the root context. The web application is deployed as a directory located on C:\AppDir.
>
>We have a shared media directory located on a different server, and in the past have used a UNC path configured as a virtual web directory on Microsoft IIS 6.
>
>We are trying to use the built-in GlassFish web server, and would also like to be able to do the same thing.
>
>I have taken a look at the blog by Jan Luehe on configuring an alternate docroot, but so far that has not worked, even if I tried setting the alternate to just another local directory.
>
>Is there something that I am doing wrong. Here is what I have in the sun-web.xml file.
>
>[i]<?xml version="1.0" encoding="UTF-8"?>
>
><!--
> Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
> Use is subject to license terms.
>-->
>
><!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd">
><sun-web-app>
> <context-root>/</context-root>
> <property name="alternatedocroot_1" value="from=*media* dir=/media"/>
></sun-web-app>[/i]
>
>I am anticipating that this should produce the following results:
>
>http://<server>:<port>/media/image.gif --> c:\media\image.gif or better yet \\<server2>\media\image.gif (UNC path).
>
>Any help will be appreciated.
>
>

Couple of things:

- In your alternate docroot specification, change

    from=*media*

  to

    from=/media/*

   "from" must be a valid url-pattern, as defined by the servlet spec.

- Notice that the resource path is computed by *appending* the request's
  path info (as obtained by calling HttpServletRequest.getPathInfo())
  to the alternate docroot.

  Therefore, this request:

    http://<server>:<port>/media/image.gif

  would try to look up this resource:

    /media/media/image.gif

  based on your alternate docroot configuration.

Please let me know if you are still facing any issues after making the
above changes.


Jan


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