You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/07/18 20:21:49 UTC
cvs commit: xml-axis/java/src/org/apache/axis/server server-config.xml
gdaniels 01/07/18 11:21:49
Modified: java/src/org/apache/axis AxisEngine.java
java/src/org/apache/axis/encoding
SOAPTypeMappingRegistry.java
SerializationContext.java
java/src/org/apache/axis/server server-config.xml
Log:
Two changes:
1) trim() all content in the BasicDeserializer
2) Output xml declarations by default. Can be switched off with a
property in the engine.
Revision Changes Path
1.25 +14 -2 xml-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- AxisEngine.java 2001/07/12 15:02:44 1.24
+++ AxisEngine.java 2001/07/18 18:21:48 1.25
@@ -79,6 +79,12 @@
*/
public abstract class AxisEngine extends BasicHandler
{
+ // Engine property names
+ public static final String PROP_XML_DECL = "sendXMLDeclaration";
+ public static final String PROP_DEBUG_LEVEL = "debugLevel";
+ public static final String PROP_DEBUG_FILE = "debugFile";
+
+
protected String engineConfigFilename = "engine-config.xml";
/** The handler registry this Engine uses. */
@@ -140,11 +146,17 @@
e.printStackTrace();
}
- String propVal = props.getProperty("debugLevel", "0");
+ String propVal = props.getProperty(PROP_DEBUG_LEVEL, "0");
Debug.setDebugLevel(Integer.parseInt(propVal));
- propVal = props.getProperty("debugFile");
+ propVal = props.getProperty(PROP_DEBUG_FILE);
Debug.setToFile(propVal != null);
+
+ // Should we send XML declarations in our messages?
+ // default is true, and currently the only accepted true value is
+ // "true".
+ propVal = props.getProperty(PROP_XML_DECL, "true");
+ addOption(PROP_XML_DECL, new Boolean(propVal.equals("true")));
_typeMappingRegistry.setParent(SOAPTypeMappingRegistry.getSingleton());
1.30 +1 -1 xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
Index: SOAPTypeMappingRegistry.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- SOAPTypeMappingRegistry.java 2001/07/16 17:36:59 1.29
+++ SOAPTypeMappingRegistry.java 2001/07/18 18:21:48 1.30
@@ -140,7 +140,7 @@
throws SAXException
{
try {
- value = makeValue(val.toString());
+ value = makeValue(val.toString().trim());
valueComplete();
} catch (InvocationTargetException ite) {
Throwable realException = ite.getTargetException();
1.17 +16 -0 xml-axis/java/src/org/apache/axis/encoding/SerializationContext.java
Index: SerializationContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContext.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SerializationContext.java 2001/07/16 18:02:01 1.16
+++ SerializationContext.java 2001/07/18 18:21:48 1.17
@@ -59,6 +59,7 @@
import java.util.*;
import org.xml.sax.*;
import org.xml.sax.helpers.AttributesImpl;
+import org.apache.axis.AxisEngine;
import org.apache.axis.Constants;
import org.apache.axis.message.*;
import org.apache.axis.utils.*;
@@ -79,6 +80,7 @@
public NSStack nsStack = new NSStack();
boolean writingStartTag = false;
+ boolean startOfDocument = true;
Stack elementStack = new Stack();
Writer writer;
@@ -98,6 +100,11 @@
private boolean doMultiRefs = false;
/**
+ * Should I send an XML declaration?
+ */
+ private boolean sendXMLDecl = true;
+
+ /**
* A place to hold objects we cache for multi-ref serialization, and
* remember the IDs we assigned them.
*/
@@ -118,6 +125,10 @@
this.writer = writer;
this.msgContext = msgContext;
if (msgContext==null) throw new NullPointerException();
+ Boolean shouldSendDecl = (Boolean)msgContext.getAxisEngine().
+ getOption(AxisEngine.PROP_XML_DECL);
+ if (shouldSendDecl != null)
+ sendXMLDecl = shouldSendDecl.booleanValue();
}
public ServiceDescription getServiceDescription()
@@ -256,6 +267,11 @@
{
if (DEBUG_LOG) {
System.out.println("Out: Starting element [" + qName.getNamespaceURI() + "]:" + qName.getLocalPart());
+ }
+
+ if (startOfDocument && sendXMLDecl) {
+ writer.write("<?xml version=\"1.0\" encoding=\"UTF8\"?>");
+ startOfDocument = false;
}
if (writingStartTag) {
1.5 +2 -1 xml-axis/java/src/org/apache/axis/server/server-config.xml
Index: server-config.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/server-config.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- server-config.xml 2001/07/10 22:53:06 1.4
+++ server-config.xml 2001/07/18 18:21:49 1.5
@@ -14,7 +14,8 @@
</handlers>
<transports>
- <transport name="http" pivot="HTTPSender"/>
+ <transport name="http" request="URLMapper"/>
+ <transport name="SimpleHttp" request="URLMapper"/>
<transport name="local" response="LocalResponder"/>
</transports>