tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util StringManager.java
Date Tue, 13 Jun 2000 02:49:52 GMT
craigmcc    00/06/12 19:49:52

  Modified:    proposals/catalina/src/share/org/apache/tomcat/core
                        ApplicationDispatcher.java
               proposals/catalina/src/share/org/apache/tomcat/servlets
                        DefaultServlet.java
               proposals/catalina/src/share/org/apache/tomcat/session
                        StandardSession.java
               proposals/catalina/src/share/org/apache/tomcat/util
                        StringManager.java
  Log:
  In the RequestDispatcher.forward() implementation, commit and close the
  response before returning (per 2.2 spec, Section 8.4).
  
  If a request mapped to the default servlet is a directory, and the
  URI does not end in a "/", redirect the client to the same URI with
  a trailing slash.  This emulates the behavior of Apache and Tomcat,
  and makes relative references on a welcome page resolve correctly
  in a non-root context.
  
  In the HttpSession.setAttribute() implementation, call valueBound()
  if necessary *before* making the attribute visible to getAttribute()
  (per 2.2 spec, Section 7.4).
  
  Skip the garbage stack trace when you ask for a string with an
  unknown key.
  
  Revision  Changes    Path
  1.4       +9 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApplicationDispatcher.java	2000/05/05 05:59:08	1.3
  +++ ApplicationDispatcher.java	2000/06/13 02:49:51	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
1.3 2000/05/05 05:59:08 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/05/05 05:59:08 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ApplicationDispatcher.java,v
1.4 2000/06/13 02:49:51 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/06/13 02:49:51 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * from this resource.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/05/05 05:59:08 $
  + * @version $Revision: 1.4 $ $Date: 2000/06/13 02:49:51 $
    */
   
   final class ApplicationDispatcher
  @@ -199,7 +199,7 @@
   	if (response.isCommitted())
   	    throw new IllegalStateException
   	      (sm.getString("applicationDispatcher.forward.ise"));
  -	response.reset();
  +	((Response) response).resetBuffer();
   
   	// Cast the servlet request and response to our internal objects
   	// FIXME - Depends on internal objects not being separated
  @@ -305,6 +305,10 @@
   		  (sm.getString("applicationDispatcher.forward.throw"), t);
   	    }
   	}
  +
  +	// Commit and close the response before we return
  +	sresponse.finishResponse();
  +
   
       }
   
  
  
  
  1.8       +16 -7     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultServlet.java	2000/06/05 16:22:00	1.7
  +++ DefaultServlet.java	2000/06/13 02:49:51	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
1.7 2000/06/05 16:22:00 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/06/05 16:22:00 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/servlets/DefaultServlet.java,v
1.8 2000/06/13 02:49:51 craigmcc Exp $
  + * $Revision: 1.8 $
  + * $Date: 2000/06/13 02:49:51 $
    *
    * ====================================================================
    *
  @@ -101,7 +101,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.7 $ $Date: 2000/06/05 16:22:00 $
  + * @version $Revision: 1.8 $ $Date: 2000/06/13 02:49:51 $
    */
   
   public final class DefaultServlet
  @@ -552,12 +552,21 @@
   	if (!content)
   	    return;
   
  -	// Remember the servlet path that got us here (plus a trailing slash)
  +	// Remember the servlet path that got us here
   	String servletPath = request.getServletPath();
   	if (servletPath == null)
   	    servletPath = "/";
  -	if (!servletPath.endsWith("/"))
  -	    servletPath += "/";
  +
  +	// Redirect if this path does not end with a trailing slash
  +	// (Otherwise, relative references will not work correctly)
  +	if (!servletPath.endsWith("/")) {
  +	    String path = request.getContextPath();
  +	    if (path == null)
  +		path = "";
  +	    path += servletPath + "/";
  +	    response.sendRedirect(path);
  +	    return;
  +	}
   
   	// Serve a welcome resource or file if one exists
   	// FIXME - update the welcome files list?
  
  
  
  1.5       +5 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardSession.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardSession.java	2000/05/30 21:29:48	1.4
  +++ StandardSession.java	2000/06/13 02:49:52	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardSession.java,v
1.4 2000/05/30 21:29:48 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/05/30 21:29:48 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardSession.java,v
1.5 2000/06/13 02:49:52 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/06/13 02:49:52 $
    *
    * ====================================================================
    *
  @@ -95,7 +95,7 @@
    * HttpSession view of this instance back to a Session view.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/05/30 21:29:48 $
  + * @version $Revision: 1.5 $ $Date: 2000/06/13 02:49:52 $
    */
   
   final class StandardSession
  @@ -739,10 +739,10 @@
   
   	synchronized (attributes) {
   	    removeAttribute(name);
  -	    attributes.put(name, value);
   	    if (value instanceof HttpSessionBindingListener)
   		((HttpSessionBindingListener) value).valueBound
   		    (new HttpSessionBindingEvent((HttpSession) this, name));
  +	    attributes.put(name, value);
   	}
   
       }
  
  
  
  1.2       +4 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util/StringManager.java
  
  Index: StringManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util/StringManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringManager.java	2000/05/16 19:30:24	1.1
  +++ StringManager.java	2000/06/13 02:49:52	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util/StringManager.java,v
1.1 2000/05/16 19:30:24 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/05/16 19:30:24 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util/StringManager.java,v
1.2 2000/06/13 02:49:52 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/06/13 02:49:52 $
    *
    * ====================================================================
    *
  @@ -133,8 +133,7 @@
           try {
   	    str = bundle.getString(key);
           } catch (MissingResourceException mre) {
  -            str = "cannot find message associated with key : " + key;
  -	    mre.printStackTrace();
  +            str = "Cannot find message associated with key '" + key + "'";
           }
   
           return str;
  
  
  

Mime
View raw message