发布网友 发布时间:2022-04-23 05:31
共1个回答
热心网友 时间:2023-11-07 14:23
package javax.servlet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
public class ServletRequestWrapper
implements ServletRequest
{
private ServletRequest request;
public ServletRequestWrapper(ServletRequest request)
{
if (request == null) {
throw new IllegalArgumentException("Request cannot be null");
}
this.request = request;
}
public ServletRequest getRequest()
{
return this.request;
}
public void setRequest(ServletRequest request)
{
if (request == null) {
throw new IllegalArgumentException("Request cannot be null");
}
this.request = request;
}
public Object getAttribute(String name)
{
return this.request.getAttribute(name);
}
public Enumeration getAttributeNames()
{
return this.request.getAttributeNames();
}
public String getCharacterEncoding()
{
return this.request.getCharacterEncoding();
}
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException
{
this.request.setCharacterEncoding(enc);
}
public int getContentLength()
{
return this.request.getContentLength();
}
public String getContentType()
{
return this.request.getContentType();
}
public ServletInputStream getInputStream()
throws IOException
{
return this.request.getInputStream();
}
public String getParameter(String name)
{
return this.request.getParameter(name);
}
public Map getParameterMap()
{
return this.request.getParameterMap();
}
public Enumeration getParameterNames()
{
return this.request.getParameterNames();
}
public String[] getParameterValues(String name)
{
return this.request.getParameterValues(name);
}
public String getProtocol()
{
return this.request.getProtocol();
}
public String getScheme()
{
return this.request.getScheme();
}
public String getServerName()
{
return this.request.getServerName();
}
public int getServerPort()
{
return this.request.getServerPort();
}
public BufferedReader getReader()
throws IOException
{
return this.request.getReader();
}
public String getRemoteAddr()
{
return this.request.getRemoteAddr();
}
public String getRemoteHost()
{
return this.request.getRemoteHost();
}
public void setAttribute(String name, Object o)
{
this.request.setAttribute(name, o);
}
public void removeAttribute(String name)
{
this.request.removeAttribute(name);
}
public Locale getLocale()
{
return this.request.getLocale();
}
public Enumeration getLocales()
{
return this.request.getLocales();
}
public boolean isSecure()
{
return this.request.isSecure();
}
public RequestDispatcher getRequestDispatcher(String path)
{
return this.request.getRequestDispatcher(path);
}
public String getRealPath(String path)
{
return this.request.getRealPath(path);
}
public int getRemotePort()
{
return this.request.getRemotePort();
}
public String getLocalName()
{
return this.request.getLocalName();
}
public String getLocalAddr()
{
return this.request.getLocalAddr();
}
public int getLocalPort()
{
return this.request.getLocalPort();
}
}
横线表示链接,可以链接找到相应的类
追问这就直接返回this. request. setAttribute (),还是没看到实现细节啊