users@glassfish.java.net

Re: tomcat "shared" webapp with different confiurations

From: Christian Andersson <ca_at_ofs.no>
Date: Wed, 07 May 2008 08:52:27 +0200

from the webpage
> 1. Global context.xml glassfish/domains/domain1/config/context.xml
> which will be loaded by *all* webapps.
> For example, global context.xml can define global environment entry to
> be shared across all webapps as follows.

unless I can have one domain per webapp all on the same virtual server,
this cannot be used.

> 2. Virtual server context.xml specified by virtual-server property
> "contextXmlDefault" in domain.xml will be loaded by all webapps of
> this virtual server.

since all my different webapps share the same virtual server, this
cannot be used either.

> 3. Webapp specific context.xml will be loaded by this webapp only.
> You can define /META-INF/context.xml in a WAR file for this webapp
> specific environment and resource definitions.

since this requires the context.xml to be IN the war file or the
deployed directory, this is also not possible to use..

what I need is a way to ave the webapp specific context.xml (or parts of
it) seperated from the webapp dirctory (for example in the
glassfish/domains/domain1/config directory (or somewhere else..) ofr
tomcat this is done using

[tomcat-install-dir]/conf/Catalina/[virtual-server-name]/[webapp-name].xml

but according to the blog, this is not possible .-( unless I have but I
  think I read somewhere that domains can have several virtual servers
defined and also you could have several domains for one virtual server,
so if it is possible for me to have several domains for this virtual
server, I can use #1 above to solve my problem.





Hong Zhang skrev:
> According to this blog, the Tomcat context.xml support has already been
> ported to glassfish v2:
> http://weblogs.java.net/blog/amyroh/archive/2007/05/context_webapp_1.html
>
> Does that mean you can just use the same context.xml mechanism with
> glassfish v2 to accomplish what you need?
>
> - Hong
>
> Christian Andersson wrote:
>
>> I'm in the process of migrating over a lot of webapplicatins from
>> tomcat to glassfish, and I have a question (also previously aked, but
>> got no answer.
>>
>>
>>
>> With tomcat I have been able to setup many webapplications that use the
>> SAME directory for the webapplication but use different configuration.
>> is this possible with glassfish?
>>
>> Let me explain what I have done..
>>
>> I have a small webbaplication that several customers use. I would like
>> to be able to host this webapplication like this..
>>
>> http://www.example.com/customer1
>> http://www.example.com/customer2
>> http://www.example.com/customer3
>> http://www.example.com/customer4
>>
>>
>> now IN tomcat, I can do that using the same webapplication directory and
>> then in my [TOMCAT-INSTALL-DIR]/conf/Catalina/example.com/ directory I
>> can setup Context configuration files
>>
>> customer1.xml
>> customer2.xml
>> customer3.xml
>> customer4.xml
>>
>> in these different context files I do stuff like this..
>>
>> <Context docBase="/var/tomcat/shared/webapplication">
>> <Parameter name="ConfigurationPath"
>> value="/var/tomcat/config/[COMPANY-NAME]/" override="true"/>
>> <Realm className="org.apache.catalina.realm.JNDIRealm"
>> connectionURL="ldap://localhost:389"
>> debug="99"
>> roleBase="ou=Roles,[COMPANY-DN]"
>> roleName="cn"
>> roleSearch="(uniqueMember={0})"
>> userPattern="uid={0},ou=People,[COMPANY-DN]"/>
>> </Context>
>>
>> (the [] parts in the context file is not written like that in the real
>> files but is changed depending on customer..
>>
>>
>> This type of configuration means that IF I upate an file in
>> /var/tomcat/shared/webapplication (jsp/jar, etc) ALL my customers get
>> that change, for an administrative point this is much easier then having
>> to do the same change for all customers..
>>
>> now, I could probably been able to do that with a war file and some
>> scripts, but I don't have that and I like to use an directory structure.
>>
>>
>> I think I read an comparison of tmcat and glassfish (v1 something of
>> glassfish) and I think it said that this was not possible, but glassfish
>> is now v2 and this might have changed.
>>
>> so is this kind of configuration possible using glassfish v2 ?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>