You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by du...@apache.org on 2001/05/22 06:00:02 UTC

cvs commit: xml-soap/java/src/org/apache/soap/encoding SOAPMappingRegistry.java

duftler     01/05/21 21:00:02

  Modified:    java/src/org/apache/soap/encoding SOAPMappingRegistry.java
  Log:
  Added a serializer that spits out content without going through
    Utils.cleanString(...).
  The cleanString-using serializer is only used for String, and all the
    numbers go through the non-cleanString-using one.
  
  Revision  Changes    Path
  1.21      +58 -27    xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java
  
  Index: SOAPMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SOAPMappingRegistry.java	2001/05/21 01:22:32	1.20
  +++ SOAPMappingRegistry.java	2001/05/22 04:00:02	1.21
  @@ -227,8 +227,13 @@
       javax.activation.DataHandler.class,
       Object.class,
     };
  -  
  -  Serializer ser = new Serializer()
  +
  +  /*
  +    This serializer runs its content through a mechanism to replace
  +    the characters {&, ", ', <, >} with their appropriate escape
  +    sequences.
  +  */
  +  Serializer cleanSer = new Serializer()
     {
       public void marshall(String inScopeEncStyle, Class javaType, Object src,
                            Object context, Writer sink, NSStack nsStack,
  @@ -249,33 +254,59 @@
       }
     };
   
  +  /*
  +    This serializer does not apply escape sequences to its content.
  +    This serializer should be used for numbers and other things that
  +    will not have any of the following characters: {&, ", ', <, >}
  +  */
  +  Serializer ser = new Serializer()
  +  {
  +    public void marshall(String inScopeEncStyle, Class javaType, Object src,
  +                         Object context, Writer sink, NSStack nsStack,
  +                         XMLJavaMappingRegistry xjmr, SOAPContext ctx)
  +      throws IllegalArgumentException, IOException {
  +      nsStack.pushScope();
  +
  +      SoapEncUtils.generateStructureHeader(inScopeEncStyle,
  +                                           javaType,
  +                                           context,
  +                                           sink,
  +                                           nsStack,
  +                                           xjmr);
  +
  +      sink.write(src + "</" + context + '>');
  +
  +      nsStack.popScope();
  +    }
  +  };
  +
     Serializer serializers [] = {
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    ser,
  -    qNameSer,
  -    calSer,
  -    dateSer,
  -    partSer,
  -    partSer,
  -    partSer,
  -    partSer,
  -    null,
  +    cleanSer,  // String
  +    ser,       // Integer
  +    ser,       // int
  +    ser,       // BigDecimal
  +    ser,       // Float
  +    ser,       // float
  +    ser,       // Double
  +    ser,       // double
  +    ser,       // Boolean
  +    ser,       // boolean
  +    ser,       // Long
  +    ser,       // long
  +    ser,       // Short
  +    ser,       // short
  +    ser,       // Byte
  +    ser,       // byte
  +    qNameSer,  // QName
  +    calSer,    // GregorianCalendar
  +    dateSer,   // Date
  +    partSer,   // MimeBodyPart
  +    partSer,   // InputStream
  +    partSer,   // DataSource
  +    partSer,   // DataHandler
  +    null,      // Object
     };
  -  
  +
     Deserializer deserializers [] = {
       stringDeser,
       null,