patrickl 2002/08/01 10:21:41 Modified: catalina/src/share/org/apache/catalina/connector ResponseBase.java ResponseFacade.java Log: Servlet 2.4 spec says that ServletResponse now gets two more methods, (from sections 5.4, 14.2.22) Namely; String getContentType(); void setCharacterEncoding(String charset) Submitted by: Bob Herrmann ([EMAIL PROTECTED]) Revision Changes Path 1.2 +36 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ResponseBase.java Index: ResponseBase.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ResponseBase.java 18 Jul 2002 16:47:57 -0000 1.1 +++ ResponseBase.java 1 Aug 2002 17:21:41 -0000 1.2 @@ -877,6 +877,38 @@ } + /* + * 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) { + + if (isCommitted()) + return; + + if (included) + return; // Ignore any call from an included servlet + + this.encoding = charset; + + int start = contentType.indexOf("charset="); + if ( start != -1 ) { + + int end = contentType.indexOf(';', start+8); + if (end >= 0) + contentType = contentType.substring(0,start+8) + +charset+contentType.substring(end-1); + else + contentType = contentType.substring(0,start+8) + +charset; + + } + } + + /** * Set the Locale that is appropriate for this response, including 1.2 +18 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ResponseFacade.java Index: ResponseFacade.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ResponseFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ResponseFacade.java 18 Jul 2002 16:47:57 -0000 1.1 +++ ResponseFacade.java 1 Aug 2002 17:21:41 -0000 1.2 @@ -188,6 +188,15 @@ } + public void setCharacterEncoding(String charset) { + + if (isCommitted()) + return; + + response.setCharacterEncoding(charset); + + } + public void setContentType(String type) { @@ -198,6 +207,11 @@ } + public String getContentType() { + + return response.getContentType(); + + } public void setBufferSize(int size) {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>