I'd try to use MBeans and JMX infrastructure to find out tomcat
configuration. http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html
The admin webapp depends on MBeans to 'talk' to tomcat. So try this way.
You're GREAT ;-).
Very thank you.
------------------------------------------------------------------------------------------------------------------------------------------
Added t our code
------------------------------------------------------------------------------------------------------------------------------------------
import javax.management.*;
import org.apache.commons.modeler.Registry;
private static void initialize() {
try {
MBeanServer mBeanServer = Registry.getRegistry(null,
null).getMBeanServer();
extractParametersTomcat(mBeanServer,"*:*");
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement
use File | Settings | File Templates.
}
}
private static void extractParametersTomcat(MBeanServer mBeanServer,
String qry )
{
Set names = null;
try {
names=mBeanServer.queryNames(new ObjectName(qry), null);
} catch (Exception e) {
return;
}
Iterator it=names.iterator();
while( it.hasNext()) {
ObjectName oname=(ObjectName)it.next();
try {
MBeanInfo minfo=mBeanServer.getMBeanInfo(oname);
String code=minfo.getClassName();
if
("org.apache.commons.modeler.BaseModelMBean".equals(code)) {
code=(String)mBeanServer.getAttribute(oname,
"modelerType");
}
boolean protocolIsHTTP = false;
boolean isSecure = false;
boolean isSchemeHTTPS = false;
String _protocol;
Object _port;
if(
minfo.getClassName().equals("org.apache.catalina.mbeans.ConnectorMBean")
) {//if#1
_protocol = (String)mBeanServer.getAttribute(oname,
"protocol");
_port = mBeanServer.getAttribute(oname, "port");
if( _protocol.toLowerCase().startsWith("http") ) {
isSecure = ( ( mBeanServer.getAttribute(oname,
"secure") != null ) &&
( mBeanServer.getAttribute(oname,
"secure").toString().equalsIgnoreCase("yes") ) );
isSchemeHTTPS = ( (
mBeanServer.getAttribute(oname, "scheme") != null ) &&
(
mBeanServer.getAttribute(oname,
"scheme").toString().equalsIgnoreCase("https") ));
if( isSecure || isSchemeHTTPS )
portSSL = _port.toString();
else
portNoSSL = _port.toString();
}
} //final if#1
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]