patrickl 2002/08/01 10:22:06
Modified: src/share/javax/servlet ServletResponse.java
ServletResponseWrapper.java
src/share/javax/servlet/http HttpServlet.java
Log:
Servlet 2.4 spec says that ServletResponse now gets two more methods, (from sect
ions 5.4, 14.2.22) Namely;
String getContentType();
void setCharacterEncoding(String charset)
Submitted by: Bob Herrmann (bob@jadn.com)
Revision Changes Path
1.2 +28 -0 jakarta-servletapi-5/src/share/javax/servlet/ServletResponse.java
Index: ServletResponse.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/src/share/javax/servlet/ServletResponse.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServletResponse.java 16 Jul 2002 16:38:40 -0000 1.1
+++ ServletResponse.java 1 Aug 2002 17:22:05 -0000 1.2
@@ -122,6 +122,16 @@
public String getCharacterEncoding();
+ /**
+ * Overrides the name of the character encoding used in the body
+ * of the request. This method must be called prior to reading
+ * request parameters or reading input using getReader().
+ *
+ * @param charset String containing the name of the chararacter encoding.
+ *
+ */
+
+ public void setCharacterEncoding(String charset);
/**
@@ -223,6 +233,24 @@
*/
public void setContentType(String type);
+
+ /**
+ * Returns the MIME type of the body of the request, or null if
+ * the type is not known. For HTTP servlets, same as the value of
+ * the CGI variable CONTENT_TYPE.
+ *
+ * @return a String containing the name of the MIME type of the
+ * request, or null if the type is not known
+ *
+ * <p> The content type may include the type of character
+ * encoding used, for example, <code>text/html; charset=ISO-8859-4</code>.
+ *
+ * @see #getOutputStream
+ * @see #getWriter
+ *
+ */
+
+ public String getContentType();
/**
1.2 +21 -3 jakarta-servletapi-5/src/share/javax/servlet/ServletResponseWrapper.java
Index: ServletResponseWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/src/share/javax/servlet/ServletResponseWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServletResponseWrapper.java 16 Jul 2002 16:38:40 -0000 1.1
+++ ServletResponseWrapper.java 1 Aug 2002 17:22:05 -0000 1.2
@@ -74,7 +74,7 @@
*
* @author Various
* @version $Version$
- * @since v 2.3
+ * @since v 2.3
*
* @see javax.servlet.ServletResponse
*
@@ -117,16 +117,25 @@
this.response = response;
}
- /**
- * The default behavior of this method is to return getCharacterEncoding()
+ /**
+ * The default behavior of this method is to call setCharacterEncoding(String charset)
* on the wrapped response object.
*/
+ public void setCharacterEncoding(String charset) {
+ this.response.setCharacterEncoding(charset);
+ }
+
+ /**
+ * The default behavior of this method is to return getCharacterEncoding()
+ * on the wrapped response object.
+ */
public String getCharacterEncoding() {
return this.response.getCharacterEncoding();
}
+
/**
* The default behavior of this method is to return getOutputStream()
* on the wrapped response object.
@@ -162,6 +171,15 @@
public void setContentType(String type) {
this.response.setContentType(type);
+ }
+
+ /**
+ * The default behavior of this method is to return getContentType()
+ * on the wrapped response object.
+ */
+
+ public String getContentType() {
+ return this.response.getContentType();
}
/**
1.2 +6 -0 jakarta-servletapi-5/src/share/javax/servlet/http/HttpServlet.java
Index: HttpServlet.java
===================================================================
RCS file: /home/cvs/jakarta-servletapi-5/src/share/javax/servlet/http/HttpServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpServlet.java 16 Jul 2002 16:38:40 -0000 1.1
+++ HttpServlet.java 1 Aug 2002 17:22:06 -0000 1.2
@@ -890,8 +890,14 @@
didSetContentLength = true;
}
+ public void setCharacterEncoding(String charset)
+ { resp.setCharacterEncoding(charset); }
+
public void setContentType(String type)
{ resp.setContentType(type); }
+
+ public String getContentType()
+ { return resp.getContentType(); }
public ServletOutputStream getOutputStream() throws IOException
{ return noBody; }
--
To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>
|