axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Russell Butek" <bu...@us.ibm.com>
Subject Re: [axis] LF vs CR/LF in axis generated code
Date Tue, 04 Jun 2002 17:47:52 GMT
I think we should let the system do it.  Always.  If I've coded "\n" in the
WSDL2java code, feel free to slap me around a bit.

Russell Butek
butek@us.ibm.com


Richard Sitze/Charlotte/IBM@IBMUS on 06/04/2002 12:37:12 PM

Please respond to axis-dev@xml.apache.org

To:    axis-dev@xml.apache.org
cc:
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
[IMAGE]tomj@apache.org


                                                                           
  [IMA   [IMAGE]              [IMAGE]                                      
  GE]                                                                      
         tomj@apache.            To:   xml-axis-cvs@apache.org             
         org                     cc:                                       
                                 Subject:    cvs commit: xml-              
         06/03/2002           axis/java/src/org/apache/axis/transport/http 
         08:18 PM             SimpleAxisServer.java                        
         Please                                                            
         respond to                                                        
         axis-dev                                                          
                                                                           
                                                                           
                                                                           



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());






Mime
View raw message