You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@hyperreal.org on 1999/11/22 19:36:47 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/service/http HttpResponseAdapter.java
costin 99/11/22 10:36:45
Modified: src/share/org/apache/tomcat/service/http
HttpResponseAdapter.java
Log:
Fix for tomcat on EBCDIC machines, thanks to Preston L. Bannister <pr...@home.com>.
We need more work on this area - check/fix other adapters ( is AJP working ?),
change Response ( headers can have different encoding than body ), add support
for setting the default encoding based on user request ( Servlet will be able to
override it, but the default should be chosen based on Accept: header - needed
for DefaultServlet )
Submitted by: "Preston L. Bannister" <pr...@home.com>
Revision Changes Path
1.2 +13 -5 jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponseAdapter.java
Index: HttpResponseAdapter.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponseAdapter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpResponseAdapter.java 1999/11/01 22:24:23 1.1
+++ HttpResponseAdapter.java 1999/11/22 18:36:44 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponseAdapter.java,v 1.1 1999/11/01 22:24:23 costin Exp $
- * $Revision: 1.1 $
- * $Date: 1999/11/01 22:24:23 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpResponseAdapter.java,v 1.2 1999/11/22 18:36:44 costin Exp $
+ * $Revision: 1.2 $
+ * $Date: 1999/11/22 18:36:44 $
*
* ====================================================================
*
@@ -87,6 +87,14 @@
protected StringBuffer statusSB;
protected StringBuffer headersSB;
+ // XXX Temporary fix for encoding - it should be at a higher level
+ // ( i.e. connector)
+ // Also, we need to resolve few other problems in this are - header
+ // encoding != body encoding, default should _not_ be platform def., etc.
+ // Any reason this should be a soft setting?
+ final static String encoding = "ISO-8859-1"; // as called for by HTTP standard?
+ // final static String encoding = "UTF8"; // more useful?
+
public HttpResponseAdapter() {
super();
statusSB=new StringBuffer();
@@ -104,7 +112,7 @@
statusSB.append("HTTP/1.0 ").append(status);
if(message!=null) statusSB.append(" ").append(message);
statusSB.append("\r\n");
- sout.write(statusSB.toString().getBytes());
+ sout.write(statusSB.toString().getBytes(encoding));
statusSB.setLength(0);
}
@@ -115,7 +123,7 @@
public void addHeader(String name, String value) throws IOException{
headersSB.setLength(0);
headersSB.append(name).append(": ").append(value).append("\r\n");
- sout.write( headersSB.toString().getBytes() );
+ sout.write( headersSB.toString().getBytes(encoding) );
}
public void addMimeHeaders(MimeHeaders headers) throws IOException {
@@ -125,7 +133,7 @@
MimeHeaderField h = headers.getField(i);
headersSB.append(h).append("\r\n");
}
- sout.write( headersSB.toString().getBytes() );
+ sout.write( headersSB.toString().getBytes(encoding) );
}
static final byte CRLF[]= { (byte)'\r', (byte)'\n' };