Bistro!
Alexis Moussine-Pouchkine's Weblog
public enum Topic { Java, GlassFish, Tools, Sun, InFrenchInZeText, SDPY }

20070215 jeudi février 15, 2007

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.



( févr. 15 2007, 09:22:05 AM CET ) Permalink Comments [2]

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 09: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 09:15 PM CET #

Post a Comment:

Comments are closed for this entry.

GlassFish Podcast
Get GlassFish V3 Preview
Support GlassFish Enterprise

Today's Page Hits: 542




bea conference glassfish ips java javaee javafx javaone javazone jug metro mysql netbeans openesb openoffice opensource paris performance pkg podcast presentation sdpy sun swing techdays tips updatecenter v3 webservices wsit
Links