|
Replies:
4
-
Last Post:
Jan 12, 2008 11:58 AM
by: hobione
|
|
|
|
|
|
|
GlassFish v2 alternate/additional rootpath
Posted:
Jan 11, 2008 3:22 PM
|
|
|
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
|
|
|
|
|
|
|
Re: GlassFish v2 alternate/additional rootpath
Posted:
Jan 11, 2008 4:46 PM
in response to: hobione
|
|
|
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
|
|
|
|
|
|
|
|
Re: GlassFish v2 alternate/additional rootpath
Posted:
Jan 11, 2008 7:26 PM
in response to: jluehe
|
|
|
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
|
|
|
|
|
|
|
|
Re: GlassFish v2 alternate/additional rootpath
Posted:
Jan 11, 2008 9:27 PM
in response to: hobione
|
|
|
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
|
|
|
|
|
|
|
|
Re: GlassFish v2 alternate/additional rootpath
Posted:
Jan 12, 2008 11:58 AM
in response to: anilam
|
|
|
You guys are SO helpful. awesome.
|
|
|
|
|