[Httpunit-commit] CVS: httpunit/src/com/meterware/servletunit RequestDispatcherImpl.java,1.4,1.5 Ser
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-02-27 18:40:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory sc8-pr-cvs1:/tmp/cvs-serv26851/src/com/meterware/servletunit
Modified Files:
RequestDispatcherImpl.java ServletUnitHttpResponse.java
Log Message:
Implemented resetBuffer, setBufferSize, reset
Index: RequestDispatcherImpl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/RequestDispatcherImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RequestDispatcherImpl.java 21 Feb 2003 15:44:00 -0000 1.4
+++ RequestDispatcherImpl.java 27 Feb 2003 18:40:39 -0000 1.5
@@ -50,7 +50,7 @@
public void forward( ServletRequest request, ServletResponse response ) throws ServletException, IOException {
- ((ServletUnitHttpResponse) response).restartResponse();
+ response.reset();
_servletMetaData.getServlet().service( DispatchedRequestWrapper.createForwardRequestWrapper( (HttpServletRequest) request, this ), response );
}
Index: ServletUnitHttpResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpResponse.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ServletUnitHttpResponse.java 6 Feb 2003 02:55:32 -0000 1.17
+++ ServletUnitHttpResponse.java 27 Feb 2003 18:40:39 -0000 1.18
@@ -3,7 +3,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000-2001, Russell Gold
+* Copyright (c) 2000-2003, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -364,8 +364,8 @@
* will use a buffer at least as large as the size requested. The actual buffer size
* used can be found using getBufferSize.
**/
- public void setBufferSize( int size ) { // XXX throw IllegalStateException if anything has been written
- throw new RuntimeException( "setBufferSize not implemented" );
+ public void setBufferSize( int size ) {
+ if (getContents().length != 0) throw new IllegalStateException( "May not set buffer size after data is written" );
}
@@ -400,7 +400,10 @@
* If the response has been committed, this method throws an IllegalStateException.
**/
public void reset() {
- throw new RuntimeException( "reset not implemented" );
+ resetBuffer();
+ _headers = new Hashtable();
+ _headersComplete = false;
+ _status = SC_OK;
}
@@ -432,23 +435,14 @@
* @since 1.3
*/
public void resetBuffer() {
- // XXX implement me
- }
-
-
-//---------------------------------------------- package methods --------------------------------------------------
-
- /**
- * Clears all headers and content.
- */
- void restartResponse() {
- _headers = new Hashtable();
- _headersComplete = false;
+ if (_committed) throw new IllegalStateException( "May not resetBuffer after response is committed" );
_outputStream = null;
_servletStream = null;
- _status = SC_OK;
_writer = null;
}
+
+
+//---------------------------------------------- package methods --------------------------------------------------
/**
* Returns the content type defined for this response.
|