001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.net.rpc.server; 020 021import javax.xml.namespace.QName; 022 023import org.apache.axis.encoding.SerializationContext; 024import org.apache.axis.encoding.ser.SimpleSerializer; 025 026public class StringSerializer extends SimpleSerializer { 027 /*protected static String xmlCodeForChar(char c) { 028 StringBuilder buff = new StringBuilder(); 029 buff.append("&#x"); 030 buff.append(StringUtils.leftPad(Integer.toHexString(c), 4, "0")); 031 buff.append(";"); 032 033 return buff.toString(); 034 }*/ 035 036 public StringSerializer(Class javaType, QName xmlType) { 037 super(javaType, xmlType); 038 } 039 040 public String getValueAsString(Object value, SerializationContext context) { 041 //return escapeNonPrintableChars(super.getValueAsString(value, context)); 042 return super.getValueAsString(value, context); 043 } 044 045 /*private String escapeNonPrintableChars(String val) { 046 StringBuilder buff = new StringBuilder(); 047 for (int idx = 0; idx < val.length(); ++idx) { 048 char c = val.charAt(idx); 049 buff.append(charIsNonPrintable(c) ? xmlCodeForChar(c) : c); 050 } 051 052 return buff.toString(); 053 } 054 055 private boolean charIsNonPrintable(char c) { 056 //0x00 to 0x1F and 0x7F are ASCII control characters 057 return c < 0x1F || c == 0x7F; 058 }*/ 059}