axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/encoding TypeMappingRegistryImpl.java
Date Wed, 01 Jun 2005 22:36:57 GMT
tomj        2005/06/01 15:36:57

  Modified:    java/src/org/apache/axis/encoding
                        TypeMappingRegistryImpl.java
  Log:
  Fix a problem in the type mapping registry: We were unconditionally setting
  the type mapping for the SOAP encoding.  This would overwrite any type
  mappings for that encoding defined in the WSDD files, which wasn't very nice
  
  Check for the existance of a type mapping, and if we find one, make sure
  its default TM points to the one we want - specifically the JAXRPC 1.1 default
  type mapping.
  
  Revision  Changes    Path
  1.36      +37 -2     ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
  
  Index: TypeMappingRegistryImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- TypeMappingRegistryImpl.java	26 Feb 2005 21:37:33 -0000	1.35
  +++ TypeMappingRegistryImpl.java	1 Jun 2005 22:36:57 -0000	1.36
  @@ -317,8 +317,43 @@
        * @param mapping
        */
       private void registerSOAPENCDefault(TypeMappingDelegate mapping) {
  -        mapTM.put(Constants.URI_SOAP11_ENC, mapping);
  -        mapTM.put(Constants.URI_SOAP12_ENC, mapping);
  +        // This get a bit ugly as we do not want to just overwrite
  +        // an existing type mapping for SOAP encodings.  This happens
  +        // when {client,server}-config.wsdd defines a type mapping for
  +        // instance.
  +        if (!mapTM.containsKey(Constants.URI_SOAP11_ENC)) {
  +            mapTM.put(Constants.URI_SOAP11_ENC, mapping);
  +        } else {
  +            // We have to make sure the default type mapping is
  +            // at the end of the chain.
  +            // This is important if the default is switched to
  +            // the JAX_RPC 1.1 default type mapping!
  +            TypeMappingDelegate del =
  +                    (TypeMappingDelegate) mapTM.get(Constants.URI_SOAP11_ENC);
  +            while (del.getNext() != null && ! (del.delegate instanceof DefaultTypeMappingImpl))
{
  +                del = del.getNext();
  +            }
  +            del.setNext(defaultDelTM);
  +        }
  +
  +        if (!mapTM.containsKey(Constants.URI_SOAP12_ENC)) {
  +            mapTM.put(Constants.URI_SOAP12_ENC, mapping);
  +        } else {
  +            // We have to make sure the default type mapping is
  +            // at the end of the chain.
  +            // This is important if the default is switched to
  +            // the JAX_RPC 1.1 default type mapping!
  +            TypeMappingDelegate del =
  +                    (TypeMappingDelegate) mapTM.get(Constants.URI_SOAP12_ENC);
  +            while (del.getNext() != null && ! (del.delegate instanceof DefaultTypeMappingImpl))
{
  +                del = del.getNext();
  +            }
  +            del.setNext(defaultDelTM);
  +        }
  +        
  +        // Just do this unconditionally in case we used mapping.
  +        // This is important if the default is switched to
  +        // the JAX_RPC 1.1 default type mapping!
           mapping.setNext(defaultDelTM);
       }
   
  
  
  

Mime
View raw message