cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Diephouse <...@envoisolutions.com>
Subject Contextual Properties [was Re: svn commit: r450715 - in /incubator/cxf/trunk/rt: bindings/soap/src/main/java/org/apache/cxf/binding/soap/ databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/]
Date Thu, 28 Sep 2006 17:12:18 GMT
Hi Tom,

You probably didn't see it as I didn't really make a big deal out of it, 
but you can use message.getContextualProperty(foo) to get a property 
from the message, exchange, endpoint, operation and service at all the 
same time. This would allow people to just enable MTOM at the operation 
level if they wanted.

- Dan

tli@apache.org wrote:
> Author: tli
> Date: Wed Sep 27 23:10:12 2006
> New Revision: 450715
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=450715
> Log:
> CXF-76 minor fix
>
> Modified:
>     incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
>     incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
>     incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
>
> Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java?view=diff&rev=450715&r1=450714&r2=450715
> ==============================================================================
> --- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
(original)
> +++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
Wed Sep 27 23:10:12 2006
> @@ -48,6 +48,9 @@
>      }
>  
>      public Message createMessage(Message m) {
> +        if (mtomEnabled) {
> +            m.put(Message.MTOM_ENABLED, Boolean.TRUE);
> +        }
>          return new SoapMessage(m);
>      }
>  
>
> Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=450715&r1=450714&r2=450715
> ==============================================================================
> --- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
(original)
> +++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
Wed Sep 27 23:10:12 2006
> @@ -74,9 +74,15 @@
>  
>      private Map cachedBinding = new HashMap<BindingInfo, Binding>();
>  
> +    private boolean mtomEnabled = true;
> +    
>      private Bus bus;
>      private Collection<String> activationNamespaces;    
>      
> +    public SoapBindingFactory() {
> +        System.out.println("Called create soap binding");
> +    }
> +    
>      @Resource
>      public void setBus(Bus b) {
>          bus = b;
> @@ -282,5 +288,14 @@
>          }
>  
>          bmsg.addExtensor(bodyInfo);
> +    }
> +    
> +    @Resource
> +    public void setMtomEnabled(boolean mtomEnabled) {
> +        this.mtomEnabled = mtomEnabled;
> +    }
> +
> +    public boolean isMtomEnabled() {
> +        return mtomEnabled;
>      }    
>  }
>
> Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java?view=diff&rev=450715&r1=450714&r2=450715
> ==============================================================================
> --- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
(original)
> +++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
Wed Sep 27 23:10:12 2006
> @@ -47,10 +47,10 @@
>      public void write(Object obj, QName elName, Message output) {
>          // if the mtom is enabled, we need to create the attachment mashaller
>          JAXBAttachmentMarshaller am = null;
> -        // if (output.containsKey(Message.MTOM_ENABLED)) {
> -        am = new JAXBAttachmentMarshaller(output);
> -        am.setXOPPackage(true);
> -        // }
> +        if (output.containsKey(Message.MTOM_ENABLED)) {
> +            am = new JAXBAttachmentMarshaller(output);
> +            am.setXOPPackage(true);
> +        }
>          Object source = null;
>          XMLStreamWriter xsw = (XMLStreamWriter) output.getContent(XMLStreamWriter.class);
>          if (xsw != null) {
>
>
>   


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


Mime
View raw message