The Source for Java Technology Collaboration
Webmaster Alert: Posting to Jive Forums is currently not working. Estimated time for fix is unknown.

Home » java.net Forums » GlassFish » GlassFish

Thread: GlassFish v2 alternate/additional rootpath

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Last Post: Jan 12, 2008 11:58 AM by: hobione
hobione

Posts: 10
GlassFish v2 alternate/additional rootpath
Posted: Jan 11, 2008 3:22 PM
 
  Click to reply to this thread Reply

Hello. I am trying to set an alternate rootpath for GlassFish v2. Here is the scenario.

I have deployed my application through admin GUI, and it un war under GF_HOME/applications\j2ee-modules\cdOrder

I can access this web app through browser like this. http://localhost:8080/cdOrder
(Old school, no problem at all...)

Now, I have a dir and file resides under my c:\ user_document\test.pdf and
I’d like to access through browser like this, http://localhost:/user_document/test.pdf

I used to set up an additional root path in Sun web server (iPlanet) more like mapping a server root path so I can separate out applications and static content (like PDF, Word, Excel) in two different places. I am trying to do the same things in GF but wont able to do it.

I have tried to install a Virtual server but I did not see any options to add an additional rootpath.

Please someone can help me on this, I really appreciate it. I love GlassFish, I love admin GUI as well, but I just got stuck to set up an additional root path and can't move forward.
:)
Hobi
Norman, OK

jluehe

Posts: 282
Re: GlassFish v2 alternate/additional rootpath
Posted: Jan 11, 2008 4:46 PM   in response to: hobione
 
  Click to reply to this thread Reply

That should be easy. You can leverage the existing virtual server named "server", and add the following alternate docroot to it, as follows:

asadmin set [...] server.http-service.virtual-server.server.property.alternatedocroot_1="from=/user_document/* dir=/"

This is on Solaris and assumes the presence of a directory "/user_document/" containing the file "test.pdf", to follow your example.

On Windows, the following should do:

asadmin set [...] server.http-service.virtual-server.server.property.alternatedocroot_1="from=/user_document/* dir=c:\"

Notice that after executing the above command, no server restart is necessary.

Jan

hobione

Posts: 10
Re: GlassFish v2 alternate/additional rootpath
Posted: Jan 11, 2008 7:26 PM   in response to: jluehe
 
  Click to reply to this thread Reply

Jan:
Thank you so much for your reply. I am new in GlassFish, only two commands I know about GF, which are how to start and stop the server. Would you explain your command, specially the dotted ([..]) area. I am getting an error "Missing expected dotted-name part".

asadmin set [...] server.http-service.virtual-server.server.property.alternatedocroot_1="from=/user_document/* dir=c:\"

Appreciated.
Hobi

anilam

Posts: 159
Re: GlassFish v2 alternate/additional rootpath
Posted: Jan 11, 2008 9:27 PM   in response to: hobione
 
  Click to reply to this thread Reply

Jan is trying to tell you to use CLI and dotted name to set the alternate docroot.
On window, you can just type
asadmin set server.http-service.virtual-server.server.property.alternatedocroot_1="from=/user_document/* dir=c:\ " (put a space after the last back-slash, otherwise you will get syntax error)

If you are more familiar with the admin console, you can do this by going to the virtual server page.
Select tree node: Configuration -> HTTP-Service -> Virtual Server -> server
on the right panel, add a row to the property table,
property name: alternatedocroot_1
property value: from=/user_document/* dir=c:\

You can then access your test.pdf which is put under /user_document

Jan has a blog that explains alternate docroot for a web application. You may want to take a look too.
http://blogs.sun.com/jluehe/entry/alternate_docroots_in_web_applications

hope this help.
Anissa

hobione

Posts: 10
Re: GlassFish v2 alternate/additional rootpath
Posted: Jan 12, 2008 11:58 AM   in response to: anilam
 
  Click to reply to this thread Reply

You guys are SO helpful. awesome.




 XML java.net RSS