import javax.servlet.ServletRequestListener;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
-import javax.servlet.annotation.WebListener;
import javax.servlet.descriptor.JspConfigDescriptor;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionListener;
*
* @param name Name of the context attribute to return
*/
+ @Override
public Object getAttribute(String name) {
return (attributes.get(name));
* Return an enumeration of the names of the context attributes
* associated with this context.
*/
+ @Override
public Enumeration<String> getAttributeNames() {
return new Enumerator<String>(attributes.keySet(), true);
*
* @param uri Absolute URI of a resource on the server
*/
+ @Override
public ServletContext getContext(String uri) {
// Validate the format of the specified argument
/**
* Return the main path associated with this context.
*/
+ @Override
public String getContextPath() {
return context.getPath();
}
*
* @param name Name of the initialization parameter to retrieve
*/
+ @Override
public String getInitParameter(final String name) {
return parameters.get(name);
}
* Return the names of the context's initialization parameters, or an
* empty enumeration if the context has no initialization parameters.
*/
+ @Override
public Enumeration<String> getInitParameterNames() {
return (new Enumerator<String>(parameters.keySet()));
}
/**
* Return the major version of the Java Servlet API that we implement.
*/
+ @Override
public int getMajorVersion() {
return (Constants.MAJOR_VERSION);
/**
* Return the minor version of the Java Servlet API that we implement.
*/
+ @Override
public int getMinorVersion() {
return (Constants.MINOR_VERSION);
*
* @param file Filename for which to identify a MIME type
*/
+ @Override
public String getMimeType(String file) {
if (file == null)
*
* @param name Name of the servlet for which a dispatcher is requested
*/
+ @Override
public RequestDispatcher getNamedDispatcher(String name) {
// Validate the name argument
*
* @param path The path to the desired resource
*/
+ @Override
public String getRealPath(String path) {
return context.getRealPath(path);
}
*
* @param path The path to the desired resource.
*/
+ @Override
public RequestDispatcher getRequestDispatcher(String path) {
// Validate the path argument
* @exception MalformedURLException if the path is not given
* in the correct form
*/
+ @Override
public URL getResource(String path)
throws MalformedURLException {
*
* @param path The path to the desired resource.
*/
+ @Override
public InputStream getResourceAsStream(String path) {
if (path == null)
*
* @param path Collection path
*/
+ @Override
public Set<String> getResourcePaths(String path) {
// Validate the path argument
/**
* Return the name and version of the servlet container.
*/
+ @Override
public String getServerInfo() {
return (ServerInfo.getServerInfo());
/**
* @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
+ @Override
@Deprecated
public Servlet getServlet(String name) {
/**
* Return the display name of this web application.
*/
+ @Override
public String getServletContextName() {
return (context.getDisplayName());
/**
* @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
+ @Override
@Deprecated
public Enumeration<String> getServletNames() {
return (new Enumerator<String>(emptyString));
/**
* @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
+ @Override
@Deprecated
public Enumeration<Servlet> getServlets() {
return (new Enumerator<Servlet>(emptyServlet));
*
* @param message Message to be written
*/
+ @Override
public void log(String message) {
context.getLogger().info(message);
* @deprecated As of Java Servlet API 2.1, use
* <code>log(String, Throwable)</code> instead
*/
+ @Override
@Deprecated
public void log(Exception exception, String message) {
* @param message Message to be written
* @param throwable Exception to be reported
*/
+ @Override
public void log(String message, Throwable throwable) {
context.getLogger().error(message, throwable);
*
* @param name Name of the context attribute to be removed
*/
+ @Override
public void removeAttribute(String name) {
Object value = null;
* @param name Attribute name to be bound
* @param value New attribute value to be bound
*/
+ @Override
public void setAttribute(String name, Object value) {
// Name cannot be null
* @throws UnsupportedOperationException - if this context was passed to the
* {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
* method of a {@link ServletContextListener} that was not declared
- * in web.xml, a web-fragment or annotated with {@link WebListener}.
+ * in web.xml, a web-fragment or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
*/
+ @Override
public FilterRegistration.Dynamic addFilter(String filterName,
String filterClass) throws IllegalStateException {
* @throws UnsupportedOperationException - if this context was passed to the
* {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
* method of a {@link ServletContextListener} that was not declared
- * in web.xml, a web-fragment or annotated with {@link WebListener}.
+ * in web.xml, a web-fragment or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
*/
+ @Override
public FilterRegistration.Dynamic addFilter(String filterName,
Filter filter) throws IllegalStateException {
* @throws UnsupportedOperationException - if this context was passed to the
* {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
* method of a {@link ServletContextListener} that was not declared
- * in web.xml, a web-fragment or annotated with {@link WebListener}.
+ * in web.xml, a web-fragment or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
*/
+ @Override
public FilterRegistration.Dynamic addFilter(String filterName,
Class<? extends Filter> filterClass) throws IllegalStateException {
// throw UnsupportedOperationException - if this context was passed to the
// {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
// method of a {@link ServletContextListener} that was not declared
- // in web.xml, a web-fragment or annotated with {@link WebListener}.
+ // in web.xml, a web-fragment or annotated with
+ // {@link javax.servlet.annotation.WebListener}.
FilterDef filterDef = context.findFilterDef(filterName);
return new ApplicationFilterRegistration(filterDef, context);
}
+ @Override
public <T extends Filter> T createFilter(Class<T> c)
throws ServletException {
try {
}
+ @Override
public FilterRegistration getFilterRegistration(String filterName) {
FilterDef filterDef = context.findFilterDef(filterName);
if (filterDef == null) {
* @throws UnsupportedOperationException - if this context was passed to the
* {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
* method of a {@link ServletContextListener} that was not declared
- * in web.xml, a web-fragment or annotated with {@link WebListener}.
+ * in web.xml, a web-fragment or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
*/
+ @Override
public ServletRegistration.Dynamic addServlet(String servletName,
String servletClass) throws IllegalStateException {
* @throws UnsupportedOperationException - if this context was passed to the
* {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
* method of a {@link ServletContextListener} that was not declared
- * in web.xml, a web-fragment or annotated with {@link WebListener}.
+ * in web.xml, a web-fragment or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
*/
+ @Override
public ServletRegistration.Dynamic addServlet(String servletName,
Servlet servlet) throws IllegalStateException {
* @throws UnsupportedOperationException - if this context was passed to the
* {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
* method of a {@link ServletContextListener} that was not declared
- * in web.xml, a web-fragment or annotated with {@link WebListener}.
+ * in web.xml, a web-fragment or annotated with
+ * {@link javax.servlet.annotation.WebListener}.
*/
+ @Override
public ServletRegistration.Dynamic addServlet(String servletName,
Class<? extends Servlet> servletClass)
throws IllegalStateException {
// throw UnsupportedOperationException - if this context was passed to the
// {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
// method of a {@link ServletContextListener} that was not declared
- // in web.xml, a web-fragment or annotated with {@link WebListener}.
+ // in web.xml, a web-fragment or annotated with
+ // {@link javax.servlet.annotation.WebListener}.
Wrapper wrapper = (Wrapper) context.findChild(servletName);
}
+ @Override
public <T extends Servlet> T createServlet(Class<T> c)
throws ServletException {
try {
}
+ @Override
public ServletRegistration getServletRegistration(String servletName) {
Wrapper wrapper = (Wrapper) context.findChild(servletName);
if (wrapper == null) {
* used by this context has the attribute <code>secure</code> set to
* <code>true</code>.
*/
+ @Override
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
return defaultSessionTrackingModes;
}
* Return the supplied value if one was previously set, else return the
* defaults.
*/
+ @Override
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
if (sessionTrackingModes != null) {
return sessionTrackingModes;
}
+ @Override
public SessionCookieConfig getSessionCookieConfig() {
return sessionCookieConfig;
}
* anything else or if an unsupported
* tracking mode is requested
*/
+ @Override
public void setSessionTrackingModes(
Set<SessionTrackingMode> sessionTrackingModes) {
// throw UnsupportedOperationException - if this context was passed to the
// {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)}
// method of a {@link ServletContextListener} that was not declared
- // in web.xml, a web-fragment or annotated with {@link WebListener}.
+ // in web.xml, a web-fragment or annotated with
+ // {@link javax.servlet.annotation.WebListener}.
boolean match = false;
if (t instanceof ServletContextAttributeListener ||
// ------------------------------------------------- ServletContext Methods
+ @Override
public ServletContext getContext(String uripath) {
ServletContext theContext = null;
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public int getMajorVersion() {
return context.getMajorVersion();
}
+ @Override
public int getMinorVersion() {
return context.getMinorVersion();
}
+ @Override
public String getMimeType(String file) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String)doPrivileged("getMimeType", new Object[]{file});
}
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public Set<String> getResourcePaths(String path) {
if (SecurityUtil.isPackageProtectionEnabled()){
}
+ @Override
public URL getResource(String path)
throws MalformedURLException {
if (Globals.IS_SECURITY_ENABLED) {
}
+ @Override
public InputStream getResourceAsStream(String path) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (InputStream) doPrivileged("getResourceAsStream",
}
+ @Override
public RequestDispatcher getRequestDispatcher(final String path) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (RequestDispatcher) doPrivileged("getRequestDispatcher",
}
+ @Override
public RequestDispatcher getNamedDispatcher(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (RequestDispatcher) doPrivileged("getNamedDispatcher",
/**
* @deprecated
*/
+ @Override
@Deprecated
public Servlet getServlet(String name)
throws ServletException {
/**
* @deprecated
*/
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
@Deprecated
public Enumeration<Servlet> getServlets() {
/**
* @deprecated
*/
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
@Deprecated
public Enumeration<String> getServletNames() {
}
+ @Override
public void log(String msg) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("log", new Object[]{msg} );
/**
* @deprecated
*/
+ @Override
@Deprecated
public void log(Exception exception, String msg) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public void log(String message, Throwable throwable) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("log", new Class[]{String.class, Throwable.class},
}
+ @Override
public String getRealPath(String path) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String) doPrivileged("getRealPath", new Object[]{path});
}
+ @Override
public String getServerInfo() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String) doPrivileged("getServerInfo", null);
}
+ @Override
public String getInitParameter(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String) doPrivileged("getInitParameter",
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public Enumeration<String> getInitParameterNames() {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public Object getAttribute(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return doPrivileged("getAttribute", new Object[]{name});
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public Enumeration<String> getAttributeNames() {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public void setAttribute(String name, Object object) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("setAttribute", new Object[]{name,object});
}
+ @Override
public void removeAttribute(String name) {
if (SecurityUtil.isPackageProtectionEnabled()) {
doPrivileged("removeAttribute", new Object[]{name});
}
+ @Override
public String getServletContextName() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String) doPrivileged("getServletContextName", null);
}
+ @Override
public String getContextPath() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (String) doPrivileged("getContextPath", null);
}
+ @Override
public FilterRegistration.Dynamic addFilter(String filterName,
String className) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public FilterRegistration.Dynamic addFilter(String filterName,
Filter filter) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public FilterRegistration.Dynamic addFilter(String filterName,
Class<? extends Filter> filterClass) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public <T extends Filter> T createFilter(Class<T> c)
throws ServletException {
}
+ @Override
public FilterRegistration getFilterRegistration(String filterName) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (FilterRegistration) doPrivileged(
}
+ @Override
public ServletRegistration.Dynamic addServlet(String servletName,
String className) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public ServletRegistration.Dynamic addServlet(String servletName,
Servlet servlet) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public ServletRegistration.Dynamic addServlet(String servletName,
Class<? extends Servlet> servletClass) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public <T extends Servlet> T createServlet(Class<T> c)
throws ServletException {
}
+ @Override
public ServletRegistration getServletRegistration(String servletName) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (ServletRegistration) doPrivileged(
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
}
+ @Override
@SuppressWarnings("unchecked") // doPrivileged() returns the correct type
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public SessionCookieConfig getSessionCookieConfig() {
if (SecurityUtil.isPackageProtectionEnabled()) {
return (SessionCookieConfig)
}
+ @Override
public void setSessionTrackingModes(
Set<SessionTrackingMode> sessionTrackingModes) {
if (SecurityUtil.isPackageProtectionEnabled()) {
}
+ @Override
public boolean setInitParameter(String name, String value) {
if (SecurityUtil.isPackageProtectionEnabled()) {
return ((Boolean) doPrivileged("setInitParameter",
if (SecurityUtil.isPackageProtectionEnabled()){
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>(){
+ @Override
public Object run() throws IllegalAccessException, InvocationTargetException{
return method.invoke(context, params);
}