I don't think this is a very good thing either...  so I'm -1 on catching the
Sun MessageException. Freeman, can you please change this so we aren't
dependent on the Sun SAAJ impl?

Thanks!
- Dan

On 5/3/07, Peter Jones <[EMAIL PROTECTED]> wrote:


Hi there,

I had a question about this commit 532651.  The SAAJOutInterceptor.javanow
uses an internal sun saaj class, i.e., it catches

com.sun.xml.messaging.saaj.packaging.mime.MessagingException

I'm not sure if this is a "good thing".  The reason is you can't use the
ibm
jdk with the sun saaj implementation, because it has dependencies on some
sun jaxp classes - classes which can be found in the sun jdk, but are
missing from the ibm jdk.  Before this commit, I could compile with the
ibm
jdk and run the tests (although some tests would fail), by replacing the
sun
saaj dependencies with the axis2 saaj implementation for instance.  I'm
just
wondering if it would be better if we didn't add a hard dependency on the
sun saaj implementation like this - especially since it seems to be just
an
exception class we are catching...

Does anyone have any thoughts?

Cheers,
Peter

On Thu, Apr 26, 2007 at 08:21:06AM -0000, [EMAIL PROTECTED] wrote:
> Author: ffang
> Date: Thu Apr 26 01:21:05 2007
> New Revision: 532651
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=532651
> Log:
> [CXF-605] extract boundary from message body in AttachmentDeserializer
>
>
> Modified:
>
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
>
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
>
incubator/cxf/trunk/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentDeserializerTest.java
>
> Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
> URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java?view=diff&rev=532651&r1=532650&r2=532651
>
==============================================================================
> ---
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
(original)
> +++
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
Thu Apr 26 01:21:05 2007
> @@ -30,6 +30,8 @@
>  import javax.xml.soap.SOAPMessage;
>  import javax.xml.soap.SOAPPart;
>  import javax.xml.stream.XMLStreamWriter;
> +import com.sun.xml.messaging.saaj.packaging.mime.MessagingException;
> +
>
>  import org.apache.cxf.binding.soap.SoapFault;
>  import org.apache.cxf.binding.soap.SoapMessage;
> @@ -41,6 +43,8 @@
>  import org.apache.cxf.phase.Phase;
>  import org.apache.cxf.staxutils.W3CDOMStreamWriter;
>
> +
> +
>  /**
>   * Sets up the outgoing chain to build a SAAJ tree instead of writing
>   * directly to the output stream. First it will replace the
XMLStreamWriter
> @@ -89,8 +93,10 @@
>              SOAPMessage soapMessage = message.getContent(
SOAPMessage.class);
>
>              if (soapMessage != null) {
> +
>                  OutputStream os = message.getContent(OutputStream.class
);
>                  try {
> +                    setMessageContent(message, soapMessage);
>                      soapMessage.writeTo(os);
>                      os.flush();
>                  } catch (IOException e) {
> @@ -99,8 +105,28 @@
>                  } catch (SOAPException e) {
>                      throw new SoapFault(new Message("SOAPEXCEPTION",
BUNDLE), e, message.getVersion()
>                          .getSender());
> +                } catch (MessagingException e) {
> +                    throw new SoapFault(new Message("SOAPEXCEPTION",
BUNDLE), e, message.getVersion()
> +                        .getSender());
> +                }
> +            }
> +        }
> +
> +        private void setMessageContent(SoapMessage message, SOAPMessage
soapMessage)
> +            throws MessagingException, SOAPException {
> +
> +            if (soapMessage.getAttachments().hasNext()) {
> +                StringBuffer sb = new StringBuffer();
> +                for (String str : 
soapMessage.getMimeHeaders().getHeader("Content-Type"))
{
> +                    sb.append(str);
> +                }
> +                String contentType = sb.toString();
> +                if (contentType != null && contentType.length() > 0) {
> +                    message.put(
org.apache.cxf.message.Message.CONTENT_TYPE, contentType);
>                  }
> +
>              }
> +
>          }
>
>      }
> [...]

--
Peter Jones
IONA Technologies Inc.
E-Mail: mailto:[EMAIL PROTECTED]
Tel: (w) 709-738-3725 x22 | Fax: 709-738-3745
84-86 Elizabeth Ave. St. John's, NL A1A 1W7 Canada




--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to