CRLF sequences are required by rfc 822 for the headers. They are also used
in MIME as delimiters. In some instances, rfc 2049, it is acceptable to use
system's local representation of new line, but CRLF is preferred. Some
parser out there may understand single LF or just CR, but all are going to
understand CRLF as a delimiter.

http://www.faqs.org/rfcs/rfc822.html
http://www.faqs.org/rfcs/rfc2045.html
http://www.ietf.org/rfc/rfc2049.txt

-----Original Message-----
From: Richard Sitze [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 10:37 AM
To: [EMAIL PROTECTED]
Subject: [axis] LF vs CR/LF in axis generated code


Can someone give us a quick overview of when it is appropriate to HARDCODE
CR/LF or LF in generated output, versus when we should use the system
"line.separator" property?

I'd be happy to summarize the replies and update the developers guide.

<ras>

*******************************************
Richard A. Sitze [EMAIL PROTECTED]
CORBA Interoperability & WebServices
IBM WebSphere Development
[EMAIL PROTECTED]





[EMAIL PROTECTED] 
06/03/2002 08:18 PM
Please respond to axis-dev

To: [EMAIL PROTECTED]
cc: 
Subject: cvs commit: xml-axis/java/src/org/apache/axis/transport/http
SimpleAxisServer.java




tomj 2002/06/03 18:18:29

Modified: java/src/org/apache/axis/transport/http
SimpleAxisServer.java
Log:
Fix interop problems:
- Return the correct cr/lf end of line characters.
- Set the correct hostname, not a hardwired 'localhost',
in the Message context.

Revision Changes Path
1.59 +13 -8
xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.java

Index: SimpleAxisServer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisServer.
java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- SimpleAxisServer.java 29 May 2002 14:30:01 -0000 1.58
+++ SimpleAxisServer.java 4 Jun 2002 01:18:28 -0000 1.59
@@ -136,16 +136,16 @@

// Standard MIME headers for XML payload
private static byte XML_MIME_STUFF[] =
- ( "\nContent-Type: text/xml; charset=utf-8\n" +
+ ( "\r\nContent-Type: text/xml; charset=utf-8\r\n" +
"Content-Length: ").getBytes();

// Standard MIME headers for HTML payload
private static byte HTML_MIME_STUFF[] =
- ( "\nContent-Type: text/html; charset=utf-8\n" +
+ ( "\r\nContent-Type: text/html; charset=utf-8\r\n" +
"Content-Length: ").getBytes();

// Mime/Content separator
- private static byte SEPARATOR[] = "\n\n".getBytes();
+ private static byte SEPARATOR[] = "\r\n\r\n".getBytes();

// Tiddly little response
private static final String responseStr =
@@ -274,8 +274,13 @@
msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
"jwsClasses");

+ // FIXME - we need to get our hostname or IP
+ // This doesn't work (returns 0.0.0.0).
+ String hostname = socket.getInetAddress().getHostName();
+ //String hostname = "localhost";
+
// !!! Fix string concatenation
- String url = "http://localhost:"; +
+ String url = "http://"; + hostname + ":" +
this.getServerSocket().getLocalPort() + "/" +
fileName.toString();
msgContext.setProperty(MessageContext.TRANS_URL, url);
@@ -437,8 +442,8 @@
out.write(HTTP);
out.write(status);
//out.write(XML_MIME_STUFF);
- out.write(("\n" + HTTPConstants.HEADER_CONTENT_TYPE + ": " +
responseMsg.getContentType()).getBytes()); 
- out.write(("\n" + HTTPConstants.HEADER_CONTENT_LENGTH + ": " +
responseMsg.getContentLength()).getBytes()); 
+ out.write(("\r\n" + HTTPConstants.HEADER_CONTENT_TYPE + ": " +
responseMsg.getContentType()).getBytes()); 
+ out.write(("\r\n" + HTTPConstants.HEADER_CONTENT_LENGTH + ": " +
responseMsg.getContentLength()).getBytes()); 
// putInt(out, response.length);

if (doSessions && null != cooky && 0 != cooky.trim().length()) {
@@ -446,9 +451,9 @@
// don't sweat efficiency *too* badly
// optimize at will
StringBuffer cookieOut = new StringBuffer();
- cookieOut.append("\nSet-Cookie: ")
+ cookieOut.append("\r\nSet-Cookie: ")
.append(cooky)
- .append("\nSet-Cookie2: ")
+ .append("\r\nSet-Cookie2: ")
.append(cooky);
// OH, THE HUMILITY! yes this is inefficient.
out.write(cookieOut.toString().getBytes());

Reply via email to