本文整理了Java中org.apache.catalina.core.ApplicationContext
类的一些代码示例,展示了ApplicationContext
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationContext
类的具体详情如下:
包路径:org.apache.catalina.core.ApplicationContext
类名称:ApplicationContext
[英]Standard implementation of ServletContext
that represents a web application's execution environment. An instance of this class is associated with each instance of StandardContext
.
[中]表示web应用程序执行环境的ServletContext
的标准实现。此类的一个实例与StandardContext
的每个实例关联。
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* @return the servlet context for which this Context is a facade.
*/
@Override
public ServletContext getServletContext() {
if (context == null) {
context = new ApplicationContext(this);
if (altDDName != null)
context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
}
return context.getFacade();
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public Object getAttribute(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return doPrivileged("getAttribute", new Object[]{name});
} else {
return context.getAttribute(name);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public Enumeration<String> getAttributeNames() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (Enumeration<String>) doPrivileged(
"getAttributeNames", null);
} else {
return context.getAttributeNames();
}
}
代码示例来源:origin: tomcat/catalina
/**
* Return the servlet context for which this Context is a facade.
*/
public ServletContext getServletContext() {
if (context == null) {
context = new ApplicationContext(getBasePath(), this);
if (altDDName != null)
context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
}
return (context.getFacade());
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public ServletContext getContext(String uripath) {
ServletContext theContext = null;
if (SecurityUtil.isPackageProtectionEnabled()) {
theContext = (ServletContext)
doPrivileged("getContext", new Object[]{uripath});
} else {
theContext = context.getContext(uripath);
}
if ((theContext != null) &&
(theContext instanceof ApplicationContext)){
theContext = ((ApplicationContext)theContext).getFacade();
}
return theContext;
}
代码示例来源:origin: codefollower/Tomcat-Research
if (this.getObjectName() != null) {
Notification notification =
new Notification("j2ee.state.stopping", this.getObjectName(),
sequenceNumber.getAndIncrement());
broadcaster.sendNotification(notification);
setState(LifecycleState.STOPPING);
Manager manager = getManager();
if (manager != null && manager instanceof Lifecycle &&
((Lifecycle) manager).getState().isAvailable()) {
((Lifecycle) manager).stop();
((Lifecycle) pipeline).getState().isAvailable()) {
((Lifecycle) pipeline).stop();
context.clearAttributes();
Realm realm = getRealmInternal();
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
(sm.getString("applicationContext.setAttribute.namenull"));
removeAttribute(name);
return;
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0))
return;
if (replaced)
event =
new ServletContextAttributeEvent(context.getServletContext(),
name, oldValue);
else
event =
new ServletContextAttributeEvent(context.getServletContext(),
name, value);
ExceptionUtils.handleThrowable(t);
if (replaced)
context.fireContainerEvent("afterContextAttributeReplaced",
listener);
log(sm.getString("applicationContext.attributeEvent"), t);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public void setResponseCharacterEncoding(String encoding) {
if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
throw new IllegalStateException(
sm.getString("applicationContext.setResponseEncoding.ise",
getContextPath()));
}
context.setResponseCharacterEncoding(encoding);
}
代码示例来源:origin: tomcat/catalina
log.info(sm.getString("containerBase.notStarted", logName()));
return;
if (this.getObjectName() != null) {
Notification notification =
new Notification("j2ee.state.stopping", this.getObjectName(),
sequenceNumber++);
broadcaster.sendNotification(notification);
context.clearAttributes();
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
if (this.getObjectName() != null) {
Notification notification =
new Notification("j2ee.state.stopping", this.getObjectName(),
sequenceNumber.getAndIncrement());
broadcaster.sendNotification(notification);
setState(LifecycleState.STOPPING);
context.clearAttributes();
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public RequestDispatcher getNamedDispatcher(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (RequestDispatcher) doPrivileged("getNamedDispatcher",
new Object[]{name});
} else {
return context.getNamedDispatcher(name);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public void removeAttribute(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("removeAttribute", new Object[]{name});
} else {
context.removeAttribute(name);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina-ha
@Override
public void setAttribute(String name, Object value) {
if (name == null) {
throw new IllegalArgumentException(sm.getString("applicationContext.setAttribute.namenull"));
}
if (value == null) {
removeAttribute(name);
return;
}
if ( (!getParent().getState().isAvailable()) || "org.apache.jasper.runtime.JspApplicationContextImpl".equals(name) ){
tomcatAttributes.put(name,value);
} else
super.setAttribute(name,value);
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public void setAttribute(String name, Object object) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("setAttribute", new Object[]{name,object});
} else {
context.setAttribute(name, object);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
@Override
public void setAttribute(String name, Object value) {
if ( (!getParent().getState().isAvailable()) || "org.apache.jasper.runtime.JspApplicationContextImpl".equals(name) ){
tomcatAttributes.put(name,value);
} else
super.setAttribute(name,value);
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public String getContextPath() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String) doPrivileged("getContextPath", null);
} else {
return context.getContextPath();
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
/**
* Set an alternate Deployment Descriptor name.
*
* @param altDDName The new name
*/
@Override
public void setAltDDName(String altDDName) {
this.altDDName = altDDName;
if (context != null) {
context.setAttribute(Globals.ALT_DD_ATTR,altDDName);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public ServletContext getServletContext() {
if (context == null) {
context = config.getServletContext();
if (context instanceof ApplicationContext) {
context = ((ApplicationContext) context).getFacade();
}
}
return context;
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
if (this.getObjectName() != null) {
Notification notification =
new Notification("j2ee.state.stopping", this.getObjectName(),
sequenceNumber.getAndIncrement());
broadcaster.sendNotification(notification);
setState(LifecycleState.STOPPING);
Manager manager = getManager();
if (manager instanceof Lifecycle && ((Lifecycle) manager).getState().isAvailable()) {
((Lifecycle) manager).stop();
((Lifecycle) pipeline).getState().isAvailable()) {
((Lifecycle) pipeline).stop();
context.clearAttributes();
Realm realm = getRealmInternal();
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
(sm.getString("applicationContext.setAttribute.namenull"));
removeAttribute(name);
return;
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0))
return;
if (replaced)
event =
new ServletContextAttributeEvent(context.getServletContext(),
name, oldValue);
else
event =
new ServletContextAttributeEvent(context.getServletContext(),
name, value);
ExceptionUtils.handleThrowable(t);
if (replaced)
context.fireContainerEvent("afterContextAttributeReplaced",
listener);
log(sm.getString("applicationContext.attributeEvent"), t);
内容来源于网络,如有侵权,请联系作者删除!