[Httpunit-commit] CVS: httpunit/src/com/meterware/servletunit ServletUnitHttpRequest.java,1.5,1.6 Se
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-11-14 14:40:35
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory usw-pr-cvs1:/tmp/cvs-serv10709/src/com/meterware/servletunit
Modified Files:
ServletUnitHttpRequest.java ServletUnitHttpResponse.java
ServletUnitHttpSession.java ServletUnitServletContext.java
Log Message:
Support Servlet 2.3 API
Index: ServletUnitHttpRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpRequest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ServletUnitHttpRequest.java 2001/11/12 19:48:35 1.5
+++ ServletUnitHttpRequest.java 2001/11/14 14:40:31 1.6
@@ -24,12 +24,14 @@
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import java.util.StringTokenizer;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Cookie;
@@ -569,7 +571,52 @@
throw new RuntimeException( "getContextPath not implemented" );
}
-
+
+//--------------------------------------- methods added to ServletRequest in JSDK 2.3 ----------------------------
+
+ /**
+ * Returns a java.util.Map of the parameters of this request.
+ * Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained
+ * in the query string or posted form data.
+ *
+ * @since 1.3
+ **/
+ public Map getParameterMap() {
+ return null; // XXX implement me!
+ }
+
+
+ /**
+ * Overrides the name of the character encoding used in the body of this request.
+ * This method must be called prior to reading request parameters or reading input using getReader().
+ *
+ * @since 1.3
+ **/
+ public void setCharacterEncoding( String s ) throws UnsupportedEncodingException {
+ // XXX implement me!
+ }
+
+
+//--------------------------------------- methods added to HttpServletRequest in JSDK 2.3 ----------------------------
+
+
+ /**
+ * Reconstructs the URL the client used to make the request.
+ * The returned URL contains a protocol, server name, port number, and server path, but
+ * it does not include query string parameters.
+ *
+ * Because this method returns a StringBuffer, not a string, you can modify the URL easily, for example,
+ * to append query parameters.
+ *
+ * This method is useful for creating redirect messages and for reporting errors.
+ *
+ * @since 1.3
+ */
+ public StringBuffer getRequestURL() {
+ return null;
+ }
+
+
//--------------------------------------------- package members ----------------------------------------------
Index: ServletUnitHttpResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpResponse.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ServletUnitHttpResponse.java 2001/11/12 19:48:35 1.7
+++ ServletUnitHttpResponse.java 2001/11/14 14:40:31 1.8
@@ -389,8 +389,21 @@
}
-
-//---------------------------------------- package methods ---------------------------------------
+//----------------------------- methods added to ServletResponse in JSDK 2.3 --------------------------------------
+
+
+ /**
+ * Clears the content of the underlying buffer in the response without clearing headers or status code.
+ * If the response has been committed, this method throws an IllegalStateException.
+ *
+ * @since 1.3
+ */
+ public void resetBuffer() {
+ // XXX implement me
+ }
+
+
+//---------------------------------------------- package methods --------------------------------------------------
/**
Index: ServletUnitHttpSession.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpSession.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletUnitHttpSession.java 2001/11/12 19:48:35 1.3
+++ ServletUnitHttpSession.java 2001/11/14 14:40:31 1.4
@@ -25,6 +25,7 @@
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionContext;
+import javax.servlet.ServletContext;
class ServletUnitHttpSession implements HttpSession {
@@ -187,7 +188,19 @@
}
-//------------------------------------- package members ---------------------------------------
+//---------------------------- methods added to HttpSession in JSDK 2.3 ----------------------------------------
+
+
+ /**
+ * Returns the ServletContext to which this session belongs.
+ *
+ * @since 1.3
+ **/
+ public ServletContext getServletContext() {
+ return null; // XXX implement me
+ }
+
+//-------------------------------------------- package members -------------------------------------------------
/**
Index: ServletUnitServletContext.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitServletContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletUnitServletContext.java 2001/08/21 19:55:16 1.3
+++ ServletUnitServletContext.java 2001/11/14 14:40:31 1.4
@@ -27,6 +27,7 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
+import java.util.Set;
import javax.servlet.*;
@@ -52,7 +53,7 @@
/**
* Returns the major version of the Java Servlet API that this servlet container supports.
- * All implementations that comply with Version 2.2 must have this method return the integer 2.
+ * All implementations that comply with Version 2.3 must have this method return the integer 2.
**/
public int getMajorVersion() {
return 2;
@@ -61,7 +62,7 @@
/**
* Returns the minor version of the Servlet API that this servlet container supports.
- * All implementations that comply with Version 2.2 must have this method return the integer 2.
+ * All implementations that comply with Version 2.3 must have this method return the integer 2.
**/
public int getMinorVersion() {
return 2;
@@ -268,6 +269,51 @@
_attributes.remove( name );
}
+
+
+//----------------------------- methods added to ServletContext in JSDK 2.3 --------------------------------------
+
+ /**
+ * Returns a directory-like listing of all the paths to resources within the web application
+ * whose longest sub-path matches the supplied path argument. Paths indicating subdirectory paths end with a '/'.
+ * The returned paths are all relative to the root of the web application and have a leading '/'.
+ * For example, for a web application containing
+ * <p>
+ * /welcome.html<br />
+ * /catalog/index.html<br /><br />
+ * /catalog/products.html<br />
+ * /catalog/offers/books.html<br />
+ * /catalog/offers/music.html<br />
+ * /customer/login.jsp<br />
+ * /WEB-INF/web.xml<br />
+ * /WEB-INF/classes/com.acme.OrderServlet.class,<br />
+ * <br />
+ * getResourcePaths("/") returns {"/welcome.html", "/catalog/", "/customer/", "/WEB-INF/"}<br />
+ * getResourcePaths("/catalog/") returns {"/catalog/index.html", "/catalog/products.html", "/catalog/offers/"}.
+ *
+ * @param path partial path used to match the resources, which must start with a /
+ * @return a Set containing the directory listing, or null if there are no resources
+ * in the web application whose path begins with the supplied path.
+ * @since HttpUnit 1.3
+ */
+ public Set getResourcePaths( String path ) {
+ return null;
+ }
+
+
+ /**
+ * Returns the name of this web application correponding to this ServletContext as specified
+ * in the deployment descriptor for this web application by the display-name element.
+ *
+ * @return The name of the web application or null if no name has been declared in the deployment descriptor
+ * @since HttpUnit 1.3
+ */
+ public String getServletContextName() {
+ return null;
+ }
+
+
+//------------------------------------------- private members ----------------------------------------------------
private final static Vector EMPTY_VECTOR = new Vector();
private Hashtable _attributes = new Hashtable();
|