@Override
 public void declareRoles(String... roleNames) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("declareRoles", roleNames);
   } else {
     context.declareRoles(roleNames);
   }
 }
 @Override
 public String getContextPath() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getContextPath", null);
   } else {
     return context.getContextPath();
   }
 }
 @Override
 public Object getAttribute(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return doPrivileged("getAttribute", new Object[] {name});
   } else {
     return context.getAttribute(name);
   }
 }
 /**
  * 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);
   }
 }
 @Override
 public void removeAttribute(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("removeAttribute", new Object[] {name});
   } else {
     context.removeAttribute(name);
   }
 }
 @Override
 public void log(String msg) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("log", new Object[] {msg});
   } else {
     context.log(msg);
   }
 }
 /** 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);
   }
 }
 @Override
 public void setAttribute(String name, Object object) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged("setAttribute", new Object[] {name, object});
   } else {
     context.setAttribute(name, object);
   }
 }
 @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();
   }
 }
Exemplo n.º 10
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public String getInitParameter(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getInitParameter", new Object[] {name});
   } else {
     return context.getInitParameter(name);
   }
 }
Exemplo n.º 11
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public String getRealPath(String path) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getRealPath", new Object[] {path});
   } else {
     return context.getRealPath(path);
   }
 }
Exemplo n.º 12
0
 @Override
 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);
   }
 }
Exemplo n.º 13
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public String getServletContextName() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getServletContextName", null);
   } else {
     return context.getServletContextName();
   }
 }
Exemplo n.º 14
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public InputStream getResourceAsStream(String path) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (InputStream) doPrivileged("getResourceAsStream", new Object[] {path});
   } else {
     return context.getResourceAsStream(path);
   }
 }
Exemplo n.º 15
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();
   }
 }
Exemplo n.º 16
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public ClassLoader getClassLoader() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (ClassLoader) doPrivileged("getClassLoader", null);
   } else {
     return context.getClassLoader();
   }
 }
Exemplo n.º 17
0
 /** Adds a listener of the given class type to this ServletContext. */
 @Override
 public void addListener(Class<? extends EventListener> listenerClass) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged(
         "addListener", new Class[] {Class.class}, new Object[] {listenerClass.getName()});
   } else {
     context.addListener(listenerClass);
   }
 }
Exemplo n.º 18
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);
   }
 }
Exemplo n.º 19
0
 /**
  * Gets a Map of the FilterRegistration objects corresponding to all currently registered filters.
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (Map<String, FilterRegistration>) doPrivileged("getFilterRegistrations", null);
   } else {
     return context.getFilterRegistrations();
   }
 }
Exemplo n.º 20
0
 /** Adds the given listener to this ServletContext. */
 @Override
 public <T extends EventListener> void addListener(T t) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     doPrivileged(
         "addListener", new Class[] {EventListener.class}, new Object[] {t.getClass().getName()});
   } else {
     context.addListener(t);
   }
 }
Exemplo n.º 21
0
 /**
  * Gets the session tracking modes that are in effect for this <tt>ServletContext</tt>.
  *
  * @return set of the session tracking modes in effect for this <tt>ServletContext</tt>
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (Set<SessionTrackingMode>) doPrivileged("getEffectiveSessionTrackingModes", null);
   } else {
     return context.getEffectiveSessionTrackingModes();
   }
 }
Exemplo n.º 22
0
 /**
  * Gets the <tt>SessionCookieConfig</tt> object through which various properties of the session
  * tracking cookies created on behalf of this <tt>ServletContext</tt> may be configured.
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public SessionCookieConfig getSessionCookieConfig() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (SessionCookieConfig) doPrivileged("getSessionCookieConfig", null);
   } else {
     return context.getSessionCookieConfig();
   }
 }
Exemplo n.º 23
0
 /** Gets the FilterRegistration corresponding to the filter with the given <tt>filterName</tt>. */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public FilterRegistration getFilterRegistration(String filterName) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (FilterRegistration) doPrivileged("getFilterRegistration", new Object[] {filterName});
   } else {
     return context.getFilterRegistration(filterName);
   }
 }
Exemplo n.º 24
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public RequestDispatcher getNamedDispatcher(String name) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (RequestDispatcher) doPrivileged("getNamedDispatcher", new Object[] {name});
   } else {
     return context.getNamedDispatcher(name);
   }
 }
Exemplo n.º 25
0
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public String getMimeType(String file) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (String) doPrivileged("getMimeType", new Object[] {file});
   } else {
     return context.getMimeType(file);
   }
 }
Exemplo n.º 26
0
 /** @deprecated As of Java Servlet API 2.1, with no direct replacement. */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 @Deprecated
 public Enumeration<Servlet> getServlets() {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (Enumeration<Servlet>) doPrivileged("getServlets", null);
   } else {
     return context.getServlets();
   }
 }
Exemplo n.º 27
0
 /** @deprecated As of Java Servlet API 2.1, use <code>log(String, Throwable)</code> instead */
 @Override
 @Deprecated
 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);
   }
 }
Exemplo n.º 28
0
 /** Adds the filter with the given name and class name to this servlet context. */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public FilterRegistration.Dynamic addFilter(String filterName, String className) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (FilterRegistration.Dynamic)
         doPrivileged("addFilter", new Object[] {filterName, className});
   } else {
     return context.addFilter(filterName, className);
   }
 }
Exemplo n.º 29
0
 /**
  * @return true if the context initialization parameter with the given name and value was set
  *     successfully on this ServletContext, and false if it was not set because this
  *     ServletContext already contains a context initialization parameter with a matching name
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public boolean setInitParameter(String name, String value) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return ((Boolean) doPrivileged("setInitParameter", new Object[] {name, value}))
         .booleanValue();
   } else {
     return context.setInitParameter(name, value);
   }
 }
Exemplo n.º 30
0
 /*
  * Registers the given servlet instance with this ServletContext
  * under the given <tt>servletName</tt>.
  */
 @Override
 @SuppressWarnings("unchecked") // doPrivileged() returns the correct type
 public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
   if (SecurityUtil.isPackageProtectionEnabled()) {
     return (ServletRegistration.Dynamic)
         doPrivileged(
             "addServlet",
             new Class[] {String.class, Servlet.class},
             new Object[] {servletName, servlet});
   } else {
     return context.addServlet(servletName, servlet);
   }
 }