本文整理汇总了Java中org.apache.catalina.deploy.ContextEnvironment类的典型用法代码示例。如果您正苦于以下问题:Java ContextEnvironment类的具体用法?Java ContextEnvironment怎么用?Java ContextEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextEnvironment类属于org.apache.catalina.deploy包,在下文中一共展示了ContextEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList<String> results = new ArrayList<String>();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return results.toArray(new String[results.size()]);
}
示例2: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
public static DynamicMBean createMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered( oname )) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例3: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
示例4: testBug49132
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Test JNDI is available to ServletContextListeners.
*/
@Test
public void testBug49132() throws Exception {
Tomcat tomcat = getTomcatInstance();
// No file system docBase required
org.apache.catalina.Context ctx = tomcat.addContext("", null);
// Enable JNDI - it is disabled by default
tomcat.enableNaming();
ContextEnvironment environment = new ContextEnvironment();
environment.setType(BUG49132_VALUE.getClass().getName());
environment.setName(BUG49132_NAME);
environment.setValue(BUG49132_VALUE);
ctx.getNamingResources().addEnvironment(environment);
ctx.addApplicationListener(Bug49132Listener.class.getName());
tomcat.start();
assertEquals(LifecycleState.STARTED, ctx.getState());
}
示例5: testBug53465
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
@Test
public void testBug53465() throws Exception {
Tomcat tomcat = getTomcatInstance();
tomcat.enableNaming();
File appDir =
new File("test/webapp-3.0");
// app dir is relative to server home
org.apache.catalina.Context ctxt =
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
tomcat.start();
ByteChunk bc = new ByteChunk();
int rc = getUrl("http://localhost:" + getPort() +
"/test/bug5nnnn/bug53465.jsp", bc, null);
Assert.assertEquals(HttpServletResponse.SC_OK, rc);
Assert.assertTrue(bc.toString().contains("<p>10</p>"));
ContextEnvironment ce =
ctxt.getNamingResources().findEnvironment("bug53465");
Assert.assertEquals("Bug53465MappedName", ce.getProperty("mappedName"));
}
示例6: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
示例7: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = getNamingResources().findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
示例8: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
static DynamicMBean createMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered( oname )) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例9: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
static void destroyMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
示例10: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs =
((NamingResources)this.resource).findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
throw new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
示例11: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for
* this web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = getNamingResources().findEnvironments();
ArrayList results = new ArrayList();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname =
MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
throw new IllegalArgumentException
("Cannot create object name for environment " + envs[i]);
}
}
return ((String[]) results.toArray(new String[results.size()]));
}
示例12: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
public static ModelMBean createMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ModelMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例13: destroyMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment The ContextEnvironment to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(ContextEnvironment environment)
throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, environment);
mserver.unregisterMBean(oname);
}
示例14: getEnvironments
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Return the MBean Names of the set of defined environment entries for this
* web application
*/
public String[] getEnvironments() {
ContextEnvironment[] envs = ((NamingResources) this.resource).findEnvironments();
ArrayList<String> results = new ArrayList<String>();
for (int i = 0; i < envs.length; i++) {
try {
ObjectName oname = MBeanUtils.createObjectName(managed.getDomain(), envs[i]);
results.add(oname.toString());
} catch (MalformedObjectNameException e) {
IllegalArgumentException iae = new IllegalArgumentException(
"Cannot create object name for environment " + envs[i]);
iae.initCause(e);
throw iae;
}
}
return results.toArray(new String[results.size()]);
}
示例15: createMBean
import org.apache.catalina.deploy.ContextEnvironment; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>ContextEnvironment</code> object.
*
* @param environment
* The ContextEnvironment to be managed
*
* @exception Exception
* if an MBean cannot be created or registered
*/
public static DynamicMBean createMBean(ContextEnvironment environment) throws Exception {
String mname = createManagedName(environment);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with " + mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(environment);
ObjectName oname = createObjectName(domain, environment);
if (mserver.isRegistered(oname)) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}