1 52 53 package com.go.teaservlet.util; 54 55 import java.util.Enumeration ; 56 import java.util.Set ; 57 import java.net.URL ; 58 import java.net.MalformedURLException ; 59 import java.io.InputStream ; 60 import javax.servlet.Servlet ; 61 import javax.servlet.ServletException ; 62 import javax.servlet.ServletContext ; 63 import javax.servlet.RequestDispatcher ; 64 65 74 public class FilteredServletContext implements ServletContext { 75 protected final ServletContext mContext; 76 77 public FilteredServletContext(ServletContext context) { 78 mContext = context; 79 } 80 81 public void log(String message) { 82 mContext.log(message); 83 } 84 85 public void log(String message, Throwable t) { 86 mContext.log(message, t); 87 } 88 89 public String getRealPath(String path) { 90 return mContext.getRealPath(path); 91 } 92 93 public String getMimeType(String file) { 94 return mContext.getMimeType(file); 95 } 96 97 public String getServerInfo() { 98 return mContext.getServerInfo(); 99 } 100 101 public Object getAttribute(String name) { 102 return mContext.getAttribute(name); 103 } 104 105 public void setAttribute(String name, Object value) { 106 mContext.setAttribute(name, value); 107 } 108 109 public void removeAttribute(String name) { 110 mContext.removeAttribute(name); 111 } 112 113 public Enumeration getAttributeNames() { 114 return mContext.getAttributeNames(); 115 } 116 117 public ServletContext getContext(String uripath) { 118 return mContext.getContext(uripath); 119 } 120 121 public RequestDispatcher getRequestDispatcher(String uripath) { 122 return mContext.getRequestDispatcher(uripath); 123 } 124 125 public int getMajorVersion() { 126 return mContext.getMajorVersion(); 127 } 128 129 public int getMinorVersion() { 130 return mContext.getMinorVersion(); 131 } 132 133 public Set getResourcePaths() { 134 return mContext.getResourcePaths(); 135 } 136 137 public URL getResource(String uripath) throws MalformedURLException { 138 return mContext.getResource(uripath); 139 } 140 141 public InputStream getResourceAsStream(String uripath) { 142 return mContext.getResourceAsStream(uripath); 143 } 144 145 public RequestDispatcher getNamedDispatcher(String name) { 146 return mContext.getNamedDispatcher(name); 147 } 148 149 public Enumeration getInitParameterNames() { 150 return mContext.getInitParameterNames(); 151 } 152 153 public String getInitParameter(String name) { 154 return mContext.getInitParameter(name); 155 } 156 157 public String getServletContextName() { 158 return mContext.getServletContextName(); 159 } 160 161 164 public void log(Exception e, String message) { 165 log(message, e); 166 } 167 168 171 public Servlet getServlet(String name) throws ServletException { 172 return mContext.getServlet(name); 173 } 174 175 178 public Enumeration getServlets() { 179 return mContext.getServlets(); 180 } 181 182 185 public Enumeration getServletNames() { 186 return mContext.getServletNames(); 187 } 188 } 189 | Popular Tags |