You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/10/17 00:44:19 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java ApplicationRequest.java ApplicationResponse.java
craigmcc 00/10/16 15:44:19
Modified: catalina/src/share/org/apache/catalina/connector
LocalStrings.properties ResponseBase.java
catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java ApplicationRequest.java
ApplicationResponse.java
Log:
Reflect the following changes in the 2.3 API that have been added:
* New method ServletResponse.resetBuffer() added.
* Old method ServletRequest.setCharacterEncoding() now throws
UnsupportedEncodingException.
As a side effect of the first change, the implementation of
RequestDispatcher.forward() now clears the buffer, but not the headers, in
conformance to the spec's requirements.
Revision Changes Path
1.3 +1 -0 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocalStrings.properties 2000/08/19 01:49:41 1.2
+++ LocalStrings.properties 2000/10/16 22:44:16 1.3
@@ -8,6 +8,7 @@
responseBase.getOutputStream.ise=getWriter() has already been called for this response
responseBase.getWriter.ise=getOutputStream() has already been called for this response
responseBase.reset.ise=Cannot reset after response has been committed
+responseBase.resetBuffer.ise=Cannot reset buffer after response has been committed
responseBase.setBufferSize.ise=Buffer size cannot be changed after data has been written
responseStream.close.closed=This output stream has already been closed
responseStream.flush.closed=Cannot flush a closed output stream
1.5 +21 -14 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java
Index: ResponseBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ResponseBase.java 2000/10/07 05:27:34 1.4
+++ ResponseBase.java 2000/10/16 22:44:16 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v 1.4 2000/10/07 05:27:34 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/10/07 05:27:34 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v 1.5 2000/10/16 22:44:16 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/10/16 22:44:16 $
*
* ====================================================================
*
@@ -88,7 +88,7 @@
* the connector-specific methods need to be implemented.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/10/07 05:27:34 $
+ * @version $Revision: 1.5 $ $Date: 2000/10/16 22:44:16 $
*/
public abstract class ResponseBase
@@ -465,16 +465,6 @@
}
- /**
- * Reset the data buffer but not any status or header information.
- */
- public void resetBuffer() {
-
- bufferCount = 0;
-
- }
-
-
// -------------------------------------------------------- Package Methods
@@ -675,6 +665,23 @@
bufferCount = 0;
contentLength = -1;
contentType = "text/plain";
+
+ }
+
+
+ /**
+ * Reset the data buffer but not any status or header information.
+ *
+ * @exception IllegalStateException if the response has already
+ * been committed
+ */
+ public void resetBuffer() {
+
+ if (committed)
+ throw new IllegalStateException
+ (sm.getString("responseBase.resetBuffer.ise"));
+
+ bufferCount = 0;
}
1.7 +5 -5 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
Index: ApplicationDispatcher.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ApplicationDispatcher.java 2000/10/06 00:50:30 1.6
+++ ApplicationDispatcher.java 2000/10/16 22:44:17 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v 1.6 2000/10/06 00:50:30 craigmcc Exp $
- * $Revision: 1.6 $
- * $Date: 2000/10/06 00:50:30 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v 1.7 2000/10/16 22:44:17 craigmcc Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/10/16 22:44:17 $
*
* ====================================================================
*
@@ -94,7 +94,7 @@
* <code>javax.servlet.ServletResponseWrapper</code>.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2000/10/06 00:50:30 $
+ * @version $Revision: 1.7 $ $Date: 2000/10/16 22:44:17 $
*/
final class ApplicationDispatcher
@@ -214,7 +214,7 @@
if (response.isCommitted())
throw new IllegalStateException
(sm.getString("applicationDispatcher.forward.ise"));
- ; // FIXME - No API call to reset just the buffer
+ response.resetBuffer();
// Identify the HTTP-specific request and response objects (if any)
HttpServletRequest hrequest = null;
1.2 +34 -31 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationRequest.java
Index: ApplicationRequest.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ApplicationRequest.java 2000/08/23 01:07:11 1.1
+++ ApplicationRequest.java 2000/10/16 22:44:17 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationRequest.java,v 1.1 2000/08/23 01:07:11 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/08/23 01:07:11 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationRequest.java,v 1.2 2000/10/16 22:44:17 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/10/16 22:44:17 $
*
* ====================================================================
*
@@ -88,7 +88,7 @@
* keep these two classes in synchronization when making changes!
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/08/23 01:07:11 $
+ * @version $Revision: 1.2 $ $Date: 2000/10/16 22:44:17 $
*/
class ApplicationRequest extends ServletRequestWrapper {
@@ -194,6 +194,36 @@
}
+ // ------------------------------------------ ServletRequestWrapper Methods
+
+
+ /**
+ * Set the request that we are wrapping.
+ *
+ * @param request The new wrapped request
+ *
+ * @exception IllegalArgumentException if a parent Request implementation
+ * cannot be identified
+ */
+ public void setRequest(ServletRequest request) {
+
+ super.setRequest(request);
+ calculateParent();
+
+ // Initialize the attributes for this request
+ synchronized (attributes) {
+ attributes.clear();
+ Enumeration names = request.getAttributeNames();
+ while (names.hasMoreElements()) {
+ String name = (String) names.nextElement();
+ Object value = request.getAttribute(name);
+ attributes.put(name, value);
+ }
+ }
+
+ }
+
+
// -------------------------------------------------------- Package Methods
@@ -237,33 +267,6 @@
Request getParent() {
return (this.parent);
-
- }
-
-
- /**
- * Set the request that we are wrapping.
- *
- * @param request The new wrapped request
- *
- * @exception IllegalArgumentException if a parent Request implementation
- * cannot be identified
- */
- void setRequest(ServletRequest request) {
-
- ; // FIXME - cannot change the private "request" variable
- calculateParent();
-
- // Initialize the attributes for this request
- synchronized (attributes) {
- attributes.clear();
- Enumeration names = request.getAttributeNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- Object value = request.getAttribute(name);
- attributes.put(name, value);
- }
- }
}
1.2 +23 -20 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationResponse.java
Index: ApplicationResponse.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationResponse.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ApplicationResponse.java 2000/08/23 01:07:11 1.1
+++ ApplicationResponse.java 2000/10/16 22:44:18 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationResponse.java,v 1.1 2000/08/23 01:07:11 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/08/23 01:07:11 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationResponse.java,v 1.2 2000/10/16 22:44:18 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/10/16 22:44:18 $
*
* ====================================================================
*
@@ -88,7 +88,7 @@
* keep these two classes in synchronization when making changes!
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/08/23 01:07:11 $
+ * @version $Revision: 1.2 $ $Date: 2000/10/16 22:44:18 $
*/
class ApplicationResponse extends ServletResponseWrapper {
@@ -195,6 +195,25 @@
}
+ // ----------------------------------------- ServletResponseWrapper Methods
+
+
+ /**
+ * Set the response that we are wrapping.
+ *
+ * @param response The new wrapped response
+ *
+ * @exception IllegalArgumentException if a parent Response implementation
+ * cannot be identified
+ */
+ public void setResponse(ServletResponse response) {
+
+ super.setResponse(response);
+ calculateParent();
+
+ }
+
+
// -------------------------------------------------------- Package Methods
@@ -259,22 +278,6 @@
void setIncluded(boolean included) {
this.included = included;
-
- }
-
-
- /**
- * Set the response that we are wrapping.
- *
- * @param response The new wrapped response
- *
- * @exception IllegalArgumentException if a parent Response implementation
- * cannot be identified
- */
- void setResponse(ServletResponse response) {
-
- ; // FIXME - cannot change the private "response" variable
- calculateParent();
}