本文整理匯總了Java中org.apache.catalina.Context.getPrivileged方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.getPrivileged方法的具體用法?Java Context.getPrivileged怎麽用?Java Context.getPrivileged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.catalina.Context
的用法示例。
在下文中一共展示了Context.getPrivileged方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createMBeans
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Create the MBeans for the specified Context and its nested components.
*
* @param context Context for which to create MBeans
*
* @exception Exception if an exception is thrown during MBean creation
*/
protected void createMBeans(Context context) throws Exception {
// Create the MBean for the Context itself
// if (log.isDebugEnabled())
// log.debug("Creating MBean for Context " + context);
// MBeanUtils.createMBean(context);
context.addContainerListener(this);
if (context instanceof StandardContext) {
((StandardContext) context).addPropertyChangeListener(this);
((StandardContext) context).addLifecycleListener(this);
}
// If the context is privileged, give a reference to it
// in a servlet context attribute
if (context.getPrivileged()) {
context.getServletContext().setAttribute
(Globals.MBEAN_REGISTRY_ATTR,
MBeanUtils.createRegistry());
context.getServletContext().setAttribute
(Globals.MBEAN_SERVER_ATTR,
MBeanUtils.createServer());
}
// Create the MBeans for the associated nested components
Loader cLoader = context.getLoader();
if (cLoader != null) {
if (log.isDebugEnabled())
log.debug("Creating MBean for Loader " + cLoader);
//MBeanUtils.createMBean(cLoader);
}
Manager cManager = context.getManager();
if (cManager != null) {
if (log.isDebugEnabled())
log.debug("Creating MBean for Manager " + cManager);
//MBeanUtils.createMBean(cManager);
}
Realm hRealm = context.getParent().getRealm();
Realm cRealm = context.getRealm();
if ((cRealm != null) && (cRealm != hRealm)) {
if (log.isDebugEnabled())
log.debug("Creating MBean for Realm " + cRealm);
//MBeanUtils.createMBean(cRealm);
}
// Create the MBeans for the NamingResources (if any)
NamingResources resources = context.getNamingResources();
createMBeans(resources);
}
示例2: createMBeans
import org.apache.catalina.Context; //導入方法依賴的package包/類
/**
* Create the MBeans for the specified Context and its nested components.
*
* @param context Context for which to create MBeans
*
* @exception Exception if an exception is thrown during MBean creation
*/
protected void createMBeans(Context context) throws Exception {
// Create the MBean for the Context itself
if (debug >= 4)
log("Creating MBean for Context " + context);
MBeanUtils.createMBean(context);
context.addContainerListener(this);
if (context instanceof StandardContext) {
((StandardContext) context).addPropertyChangeListener(this);
((StandardContext) context).addLifecycleListener(this);
}
// If the context is privileged, give a reference to it
// in a servlet context attribute
if (context.getPrivileged()) {
context.getServletContext().setAttribute
(Globals.MBEAN_REGISTRY_ATTR,
MBeanUtils.createRegistry());
context.getServletContext().setAttribute
(Globals.MBEAN_SERVER_ATTR,
MBeanUtils.createServer());
}
// Create the MBeans for the associated nested components
Loader cLoader = context.getLoader();
if (cLoader != null) {
if (debug >= 4)
log("Creating MBean for Loader " + cLoader);
MBeanUtils.createMBean(cLoader);
}
Logger hLogger = context.getParent().getLogger();
Logger cLogger = context.getLogger();
if ((cLogger != null) && (cLogger != hLogger)) {
if (debug >= 4)
log("Creating MBean for Logger " + cLogger);
MBeanUtils.createMBean(cLogger);
}
Manager cManager = context.getManager();
if (cManager != null) {
if (debug >= 4)
log("Creating MBean for Manager " + cManager);
MBeanUtils.createMBean(cManager);
}
Realm hRealm = context.getParent().getRealm();
Realm cRealm = context.getRealm();
if ((cRealm != null) && (cRealm != hRealm)) {
if (debug >= 4)
log("Creating MBean for Realm " + cRealm);
MBeanUtils.createMBean(cRealm);
}
// Create the MBeans for the associated Valves
if (context instanceof StandardContext) {
Valve cValves[] = ((StandardContext)context).getValves();
for (int l = 0; l < cValves.length; l++) {
if (debug >= 4)
log("Creating MBean for Valve " + cValves[l]);
MBeanUtils.createMBean(cValves[l]);
}
}
// Create the MBeans for the NamingResources (if any)
NamingResources resources = context.getNamingResources();
createMBeans(resources);
}