public String getMimeType(String file) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getMimeType", new Object[] {file});
   } else {
     return context.getMimeType(file);
   }
 }
 public String getContextPath() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getContextPath", null);
   } else {
     return context.getContextPath();
   }
 }
 public Enumeration getAttributeNames() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (Enumeration) doPrivileged("getAttributeNames", null);
   } else {
     return context.getAttributeNames();
   }
 }
 public String getInitParameter(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getInitParameter", new Object[] {name});
   } else {
     return context.getInitParameter(name);
   }
 }
 public Object getAttribute(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return doPrivileged("getAttribute", new Object[] {name});
   } else {
     return context.getAttribute(name);
   }
 }
 public Set getResourcePaths(String path) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (Set) doPrivileged("getResourcePaths", new Object[] {path});
   } else {
     return context.getResourcePaths(path);
   }
 }
 public RequestDispatcher getNamedDispatcher(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (RequestDispatcher) doPrivileged("getNamedDispatcher", new Object[] {name});
   } else {
     return context.getNamedDispatcher(name);
   }
 }
 public void log(String msg) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("log", new Object[] {msg});
   } else {
     context.log(msg);
   }
 }
 public InputStream getResourceAsStream(String path) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (InputStream) doPrivileged("getResourceAsStream", new Object[] {path});
   } else {
     return context.getResourceAsStream(path);
   }
 }
 public RequestDispatcher getRequestDispatcher(final String path) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (RequestDispatcher) doPrivileged("getRequestDispatcher", new Object[] {path});
   } else {
     return context.getRequestDispatcher(path);
   }
 }
 public String getRealPath(String path) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getRealPath", new Object[] {path});
   } else {
     return context.getRealPath(path);
   }
 }
 public void removeAttribute(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("removeAttribute", new Object[] {name});
   } else {
     context.removeAttribute(name);
   }
 }
 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) throws RemoteException, RemoteException {
   if ((!getParent().getState().isAvailable())
       || "org.apache.jasper.runtime.JspApplicationContextImpl".equals(name)) {
     tomcatAttributes.put(name, value);
   } else super.setAttribute(name, value);
 }
 @Override
 public void addListener(Class<? extends EventListener> listenerClass) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("addListener", new Object[] {listenerClass.getName()});
   } else {
     context.addListener(listenerClass);
   }
 }
 @Override
 public FilterRegistration getFilterRegistration(String filterName) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (FilterRegistration) doPrivileged("getFilterRegistration", new Object[] {filterName});
   } else {
     return context.getFilterRegistration(filterName);
   }
 }
 @Override
 public JspConfigDescriptor getJspConfigDescriptor() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor", null);
   } else {
     return context.getJspConfigDescriptor();
   }
 }
Ejemplo n.º 18
0
 /** Adds the listener with the given class name to this ServletContext. */
 @Override
 public void addListener(String className) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("addListener", new Object[] {className});
   } else {
     context.addListener(className);
   }
 }
Ejemplo n.º 19
0
 /**
  * Sets the session tracking modes that are to become effective for this <tt>ServletContext</tt>.
  */
 @Override
 public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("setSessionTrackingModes", new Object[] {sessionTrackingModes});
   } else {
     context.setSessionTrackingModes(sessionTrackingModes);
   }
 }
 public void log(Exception exception, String msg) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged(
         "log", new Class[] {Exception.class, String.class}, new Object[] {exception, msg});
   } else {
     context.log(exception, msg);
   }
 }
 @Override
 public ClassLoader getClassLoader() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (ClassLoader) doPrivileged("getClassLoader", null);
   } else {
     return context.getClassLoader();
   }
 }
 public void log(String message, Throwable throwable) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged(
         "log", new Class[] {String.class, Throwable.class}, new Object[] {message, throwable});
   } else {
     context.log(message, throwable);
   }
 }
 @Override
 public int getEffectiveMinorVersion() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return ((Integer) doPrivileged("getEffectiveMinorVersion", null)).intValue();
   } else {
     return context.getEffectiveMinorVersion();
   }
 }
Ejemplo n.º 24
0
 @Override
 public void declareRoles(String... roleNames) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("declareRoles", roleNames);
   } else {
     context.declareRoles(roleNames);
   }
 }
 @Override
 public <T extends EventListener> void addListener(T t) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("addListener", new Object[] {t.getClass().getName()});
   } else {
     context.addListener(t);
   }
 }
 @Override
 public String getServletContextName() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getServletContextName", null);
   } else {
     return context.getServletContextName();
   }
 }
 @Override
 public SessionCookieConfig getSessionCookieConfig() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (SessionCookieConfig) doPrivileged("getSessionCookieConfig", null);
   } else {
     return context.getSessionCookieConfig();
   }
 }
Ejemplo n.º 28
0
 /**
  * Gets the <code>&lt;jsp-config&gt;</code> related configuration that was aggregated from the
  * <code>web.xml</code> and <code>web-fragment.xml</code> descriptor files of the web application
  * represented by this ServletContext.
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public JspConfigDescriptor getJspConfigDescriptor() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor", null);
   } else {
     return context.getJspConfigDescriptor();
   }
 }
Ejemplo n.º 29
0
 /**
  * Instantiates the given EventListener class and performs any required resource injection into
  * the new EventListener instance before returning it.
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (T) doPrivileged("createListener", new Object[] {clazz});
   } else {
     return context.createListener(clazz);
   }
 }
Ejemplo n.º 30
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public ClassLoader getClassLoader() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (ClassLoader) doPrivileged("getClassLoader", null);
   } else {
     return context.getClassLoader();
   }
 }