这个request对象实际上是个类的实例,这个类它实现了接口javax.servlet.ServletRequest..不同的web服务器,request对象是属于不同的类。
forward的方法定义如下::
public abstract interface javax.servlet.RequestDispatcher {
public abstract void forward(javax.servlet.ServletRequest arg0, javax.servlet.ServletResponse arg1)
#——–
org.apache.catalina.connector.RequestFacade@54a9387
org.apache.catalina.core.ApplicationHttpRequest@a6a435f
这个控制台输出的确实不是同一个对象..因为地址不同…
准确的说是同一类对象,这俩个对象都是同样的ServletRequest接口实现,所以可以理解为可以互相转换的…..
俩个jsp的处理过程不是紧密地连接的,中间有其他的过程代码,所以有有些转换..
是不是同一个对象,,不同的web服务器处理机制不同,tomcat的不是同一个对象,而resin 带struts2框架 的输出 ,是同一个对象….
所以,通常也为了简单,,可以说是同一个对象
#—–tomcat的 RequestFacade , ApplicationHttpRequest都是实现 ServletRequest 接口的…
public class org.apache.catalina.connector.RequestFacade implements javax.servlet.http.HttpServletRequest
>>>public abstract interface javax.servlet.http.HttpServletRequest extends javax.servlet.ServletRequest
class org.apache.catalina.core.ApplicationHttpRequest extends javax.servlet.http.HttpServletRequestWrapper
>>>>>>>>>public class javax.servlet.http.HttpServletRequestWrapper extends javax.servlet.ServletRequestWrapper implements javax.servlet.http.HttpServletRequest
>>>public abstract interface javax.servlet.http.HttpServletRequest extends javax.servlet.ServletRequest
#—–resin 的输出
com.caucho.server.http.HttpServletRequestImpl addr:9381576
com.caucho.server.webapp.ForwardRequest addr:17061149
#——resin 的request继承体系
public final class com.caucho.server.http.HttpServletRequestImpl extends com.caucho.server.http.AbstractCauchoRequest implements com.caucho.server.http.CauchoRequest, com.caucho.websocket.WebSocketServletRequest
>>>public abstract interface com.caucho.server.http.CauchoRequest extends javax.servlet.http.HttpServletRequest
>>>public abstract interface javax.servlet.http.HttpServletRequest extends javax.servlet.ServletRequest
public class com.caucho.server.webapp.ForwardRequest extends com.caucho.server.http.CauchoRequestWrapper
>>>>>public class com.caucho.server.http.CauchoRequestWrapper extends com.caucho.server.http.AbstractCauchoRequest
>>>public abstract class com.caucho.server.http.AbstractCauchoRequest implements com.caucho.server.http.CauchoRequest
>>>public abstract interface com.caucho.server.http.CauchoRequest extends javax.servlet.http.HttpServletRequest
>>>public abstract interface javax.servlet.http.HttpServletRequest extends javax.servlet.ServletRequest
#—-resin 带struts2框架 的输出,是同一个对象..
org.apache.struts2.dispatcher.StrutsRequestWrapper@1bb4f52
org.apache.struts2.dispatcher.StrutsRequestWrapper@1bb4f52
>>>>public class org.apache.struts2.dispatcher.StrutsRequestWrapper extends javax.servlet.http.HttpServletRequestWrapper
>>>>public class javax.servlet.http.HttpServletRequestWrapper extends javax.servlet.ServletRequestWrapper implements javax.servlet.http.HttpServletRequest
>>>public abstract interface javax.servlet.http.HttpServletRequest extends javax.servlet.ServletRequest