You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by SE <ha...@ml1.net> on 2003/05/14 21:41:51 UTC

Using customized realms without editing server.xml

Hello there,

I am developing a webapp witch needs authentication and uses its own 
realm for connecting a relational database. I already know how to 
install it and how to configure Tomcat (editing server.xml) but I’m 
looking for a way to encapsulate the use of the customized realm by my 
webapp completely in the WAR, so it’s configured just when you do a deploy.

Or, at least, I’d like to be able to configure it without touching 
server.xml (programmatically, with Ant, …?….)

I searched this in Tomcat docs, in the mail archives, in www, etc, but 
all references or articles explains how to edit server.xml, none one 
seems to suggest that other methods exists.

BTW, if I edit this file but the realm class is not in the classpath, 
Tomcat abruptly shuts down... is this Ok?

I hope this is not a stupid question, and thanks in advance for your 
invested time in reading this email.

Regards,



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using customized realms without editing server.xml

Posted by Jacob Kjome <ho...@visi.com>.
If you use the ant manager "deploy" task to deploy a .war file, you can 
include a "META-INF/context.xml" file in your .war file.  Tomcat will see 
this and use it for configuration.  The "context.xm" file is a "context 
configuration file" (CCF).  This contains a single <Context ...> element 
just like you might add to server.xml, except you don't need to touch 
server.xml when you use this method.  Note that the file must be named 
"context.xml" or Tomcat will not see it.

Alternatively, you can drop the CCF into Tomcat's CATALINA_HOME/webapps 
directory and have the <Context ...> element's "docBase" attribute pointing 
to wherever your .war file or directory containing your context is.  In 
this case, the CCF needn't be named exactly "context.xml".  Call the file 
anything you want as long as it ends in ".xml".  See admin.xml and 
manager.xml in the webapps directory for an example.

Jake

At 04:41 PM 5/14/2003 -0300, you wrote:
>Hello there,
>
>I am developing a webapp witch needs authentication and uses its own realm 
>for connecting a relational database. I already know how to install it and 
>how to configure Tomcat (editing server.xml) but I’m looking for a way to 
>encapsulate the use of the customized realm by my webapp completely in the 
>WAR, so it’s configured just when you do a deploy.
>
>Or, at least, I’d like to be able to configure it without touching 
>server.xml (programmatically, with Ant, …?….)
>
>I searched this in Tomcat docs, in the mail archives, in www, etc, but all 
>references or articles explains how to edit server.xml, none one seems to 
>suggest that other methods exists.
>
>BTW, if I edit this file but the realm class is not in the classpath, 
>Tomcat abruptly shuts down... is this Ok?
>
>I hope this is not a stupid question, and thanks in advance for your 
>invested time in reading this email.
>
>Regards,
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

RE: Using customized realms without editing server.xml

Posted by Joseph Yang <ya...@rewardstream.com>.
If you only want this realm to be used in specific context, do the
following:

Let's call the context as webapps/myApp

1. put a file called myApp.xml together with myApp (folder or .war)

2. inside myApp.xml, put your realm like below
<Context path="/myApp" docBase="myApp" reloadable="true">
      <Realm  className="....." debug="99"/>
</Context>

-----Original Message-----
From: SE [mailto:hadexcorp@ml1.net]
Sent: Wednesday, May 14, 2003 12:42 PM
To: Tomcat Users List
Subject: Using customized realms without editing server.xml


Hello there,

I am developing a webapp witch needs authentication and uses its own
realm for connecting a relational database. I already know how to
install it and how to configure Tomcat (editing server.xml) but I’m
looking for a way to encapsulate the use of the customized realm by my
webapp completely in the WAR, so it’s configured just when you do a deploy.

Or, at least, I’d like to be able to configure it without touching
server.xml (programmatically, with Ant, …?….)

I searched this in Tomcat docs, in the mail archives, in www, etc, but
all references or articles explains how to edit server.xml, none one
seems to suggest that other methods exists.

BTW, if I edit this file but the realm class is not in the classpath,
Tomcat abruptly shuts down... is this Ok?

I hope this is not a stupid question, and thanks in advance for your
invested time in reading this email.

Regards,



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org