/** * @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(); }
@Override public Object getAttribute(String name) { if (SecurityUtil.isPackageProtectionEnabled()) { return doPrivileged("getAttribute", new Object[]{name}); } else { return context.getAttribute(name); } }
@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(); } }
/** * 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()); }
@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; }
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();
(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);
@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); }
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();
if (this.getObjectName() != null) { Notification notification = new Notification("j2ee.state.stopping", this.getObjectName(), sequenceNumber.getAndIncrement()); broadcaster.sendNotification(notification); setState(LifecycleState.STOPPING); context.clearAttributes();
@Override public RequestDispatcher getNamedDispatcher(String name) { if (SecurityUtil.isPackageProtectionEnabled()) { return (RequestDispatcher) doPrivileged("getNamedDispatcher", new Object[]{name}); } else { return context.getNamedDispatcher(name); } }
@Override public void removeAttribute(String name) { if (SecurityUtil.isPackageProtectionEnabled()) { doPrivileged("removeAttribute", new Object[]{name}); } else { context.removeAttribute(name); } }
@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); }
@Override public void setAttribute(String name, Object object) { if (SecurityUtil.isPackageProtectionEnabled()) { doPrivileged("setAttribute", new Object[]{name,object}); } else { context.setAttribute(name, object); } }
@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); }
@Override public String getContextPath() { if (SecurityUtil.isPackageProtectionEnabled()) { return (String) doPrivileged("getContextPath", null); } else { return context.getContextPath(); } }
/** * 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); } }
@Override public ServletContext getServletContext() { if (context == null) { context = config.getServletContext(); if (context instanceof ApplicationContext) { context = ((ApplicationContext) context).getFacade(); } } return context; }
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();
(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);