How to use Tomcat Context information in GlassFish


If you're using Tomcat and you are looking into moving to GlassFish (because of Java EE 5, admin tools, Grizzly performance, etc...), you might find this question I was asked twice recently about a specific feature migration.

If you were using Tomcat's Context feature and reading the initialization parameters say from servletContext.getInitParameter(), you need to provide the same information in a slightly different format in the standard web.xml deployment descriptor.

<context-param>
   <param-name>param</param-name>
   <param-value>value</param-value>
</context-param>

Note this can also be added to $GLASSFISH_HOME/domains/$DOMAIN_NAME/config/default-web.xml if you don't want to repeat this in all your web-apps. But be careful as it takes precedence over the web application web.xml.



Comments:

Hi, Great feature !
But is-it possible to use it "à la" Tomcat ?
Sample : You have a webapp called sample and you want to set a special context file only for this webapp (as I understand the current feature will shared values for all webapp ?).
With tomcat put a context file in $CATALINA_HOME/conf/Catalina/localhost/sample.xml And the sample.xml context values will not be shared for all other webapps.
An other point : is it deployable on life ?
With a cli or an ant task, something like deploy -f warPath -contextPath contextPath
-- Olivier

Posted by Olivier Lamy on février 15, 2007 at 01:43 AM CET #

No, this is not a global setting if you use web.xml (per web-app setting).
I'm not sure I understand the second part of the question, but I guess this should help:
CLI: % bin/asadmin deploy --contextroot mywebapp.war
ANT: you're probably looking for the sun-appserv-deploy ant task.

Posted by Alexis MP on février 15, 2007 at 01:15 PM CET #

Post a Comment:
Comments are closed for this entry.
About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today
Blogroll

No bookmarks in folder

News

No bookmarks in folder