Here is a small patch for Tomcat 3.2.
The constructor was calling recycle, which caused me
some problems when extending the class.
It separates the request initialization done in the constructor
out of the recycle method.
This fixes a "XXX" marked piece of code and resolves a
problem that I had when extending the RequestImpl class
and overriding recycle().
Please consider this patch for inclusion in Tomcat 3.2.
It should have no real functional impact on the standard Tomcat,
but fixes a potential problem with embedding Tomcat.
Thanks.
Shawn
PS: Hopefully the patch will come through ok, since I was having trouble with
ftp access to my development machine, I had to cut and past it into this
message.  Let me know if you have trouble with it.


*** RequestImpl.java.old        Sun Nov 19 15:22:28 2000
--- RequestImpl.java    Sun Nov 19 15:29:53 2000
***************
*** 167,173 ****
      public RequestImpl() {
        //      System.out.println("XXX new ri " );
        headers = new MimeHeaders();
!       recycle(); // XXX need better placement-super()
      }

      public void setContext(Context context) {
--- 167,173 ----
      public RequestImpl() {
        //      System.out.println("XXX new ri " );
        headers = new MimeHeaders();
!       initRequest();
      }

      public void setContext(Context context) {
***************
*** 694,705 ****
        }
      }

!     // -------------------- End utils
!     public void recycle() {
!         if( requestFacade != null && context!=null ) {
!             context.getFacadeManager().recycle(this);
!         }
!
          context = null;
          attributes.clear();
          parameters.clear();
--- 694,700 ----
        }
      }

!     public void initRequest() {
          context = null;
          attributes.clear();
          parameters.clear();
***************
*** 748,753 ****
--- 743,757 ----
        reqRoles=null;
      }

+     // -------------------- End utils
+     public void recycle() {
+         if( requestFacade != null && context!=null ) {
+             context.getFacadeManager().recycle(this);
+         }
+
+       initRequest();
+     }
+
      public MimeHeaders getMimeHeaders() {
        return headers;
      }



--
Shawn McMurdo              mailto:[EMAIL PROTECTED]
Lutris Technologies        http://www.lutris.com
Enhydra.Org                http://www.enhydra.org


Reply via email to