axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Jordahl <t...@macromedia.com>
Subject RE: [axis] LF vs CR/LF in axis generated code
Date Tue, 04 Jun 2002 18:19:45 GMT
 
You always need to use \r\n in HTTP code, which is what SimpleAxisServer is trying to do.
 
--
Tom Jordahl
Macromedia
 

-----Original Message-----
From: Richard Sitze [mailto:rsitze@us.ibm.com]
Sent: Tuesday, June 04, 2002 10:37 AM
To: axis-dev@xml.apache.org
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 rsitze@us.ibm.com
CORBA Interoperability & WebServices
IBM WebSphere Development
tomj@apache.org




	



	tomj@apache.org 

	06/03/2002 08:18 PM
Please respond to axis-dev



To: xml-axis-cvs@apache.org
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: <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());







Mime
View raw message