cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craft...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp SOAPHelper.java
Date Mon, 09 Sep 2002 15:48:46 GMT
crafterm    2002/09/09 08:48:46

  Modified:    .        changes.xml
               lib      jars.xml
               src/java/org/apache/cocoon/components/language/markup/xsp
                        SOAPHelper.java
  Added:       lib/optional commons-httpclient-20020909.jar
  Removed:     lib/optional commons-httpclient.jar
  Log:
  Updated Jakarta Commons HTTP client jar. Fixes problems with SOAP XSP
  taglib. Modified SOAPHelper class due to recent interface changes in the
  HTTP client jar.
  PR: 12236
  
  Revision  Changes    Path
  1.243     +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.242
  retrieving revision 1.243
  diff -u -r1.242 -r1.243
  --- changes.xml	9 Sep 2002 13:25:38 -0000	1.242
  +++ changes.xml	9 Sep 2002 15:48:46 -0000	1.243
  @@ -40,6 +40,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="MC" type="update" fixes-bug="12236">
  +    Updated Jakarta Commons HTTP client jar. Fixes problems with SOAP XSP
  +    taglib.
  +  </action>
     <action dev="MC" type="add" fixes-bug="12122">
       Added new ComposerReader class with various Reader refactorings.
     </action>
  
  
  
  1.36      +1 -1      xml-cocoon2/lib/jars.xml
  
  Index: jars.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/lib/jars.xml,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jars.xml	3 Sep 2002 10:24:33 -0000	1.35
  +++ jars.xml	9 Sep 2002 15:48:46 -0000	1.36
  @@ -251,7 +251,7 @@
         and feature-rich package implementing the client side of the most recent
         HTTP standards and recommendations.</description>
   	<used-by>SOAP logicsheet, WebServiceProxyGenerator</used-by>
  -	<lib>optional/commons-httpclient.jar</lib>
  +	<lib>optional/commons-httpclient-20020909.jar</lib>
   	<homepage>http://jakarta.apache.org/commons/httpclient/</homepage>
    </file>
    <file>
  
  
  
  1.1                  xml-cocoon2/lib/optional/commons-httpclient-20020909.jar
  
  	<<Binary file>>
  
  
  1.9       +35 -37    xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java
  
  Index: SOAPHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/SOAPHelper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SOAPHelper.java	20 Jun 2002 04:30:03 -0000	1.8
  +++ SOAPHelper.java	9 Sep 2002 15:48:46 -0000	1.9
  @@ -115,51 +115,49 @@
                   conn = new HttpConnection(host, port);
               }
   
  -            PostMethod method = new PostMethod(url.getFile()) {
  -                protected String generateRequestBody(HashMap params) {
  -                    try {
  -                        StringBuffer bodyBuffer
  -                                = new StringBuffer(super.generateRequestBody(params));
  +            PostMethod method = new PostMethod(url.getFile());
  +            String request;
   
  -                        // Write the SOAP request body
  -                        if (xscriptObject instanceof XScriptObjectInlineXML) {
  -                            // Skip overhead
  -                            bodyBuffer.append(((XScriptObjectInlineXML) xscriptObject).getContent());
  -                        } else {
  -                            InputSource saxSource = xscriptObject.getInputSource();
  -
  -                            Reader r = null;
  -                            // Byte stream or character stream?
  -                            if (saxSource.getByteStream() != null) {
  -                                r = new InputStreamReader(saxSource.getByteStream());
  -                            } else {
  -                                r = saxSource.getCharacterStream();
  -                            }
  -
  -                            try {
  -                                char[] buffer = new char[1024];
  -                                int len;
  -                                while ((len = r.read(buffer)) > 0)
  -                                    bodyBuffer.append(buffer, 0, len);
  -                            } finally {
  -                                if (r != null) {
  -                                    r.close();
  -                                }
  -                            }
  -                        }
  +            try {
  +                // Write the SOAP request body
  +                if (xscriptObject instanceof XScriptObjectInlineXML) {
  +                    // Skip overhead
  +                    request = ((XScriptObjectInlineXML) xscriptObject).getContent();
  +                } else {
  +                    StringBuffer bodyBuffer = new StringBuffer();
  +                    InputSource saxSource = xscriptObject.getInputSource();
  +
  +                    Reader r = null;
  +                    // Byte stream or character stream?
  +                    if (saxSource.getByteStream() != null) {
  +                        r = new InputStreamReader(saxSource.getByteStream());
  +                    } else {
  +                        r = saxSource.getCharacterStream();
  +                    }
   
  -                        return bodyBuffer.toString();
  -                    } catch (Exception ex) {
  -                        // FIXME (VG): Will result in NPE in httpClient code
  -                        return null;
  +                    try {
  +                        char[] buffer = new char[1024];
  +                        int len;
  +                        while ((len = r.read(buffer)) > 0)
  +                            bodyBuffer.append(buffer, 0, len);
  +                    } finally {
  +                        if (r != null) {
  +                            r.close();
  +                        }
                       }
  +
  +                    request = bodyBuffer.toString();
                   }
  -            };
  +
  +            } catch (Exception ex) {
  +                throw new ProcessingException("Error assembling request", ex);
  +            }
   
               method.setRequestHeader(
                       new Header("Content-type", "text/xml; charset=\"utf-8\""));
               method.setRequestHeader(new Header("SOAPAction", action));
               method.setUseDisk(false);
  +            method.setRequestBody(request);
   
               method.execute(new HttpState(), conn);
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message