You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by ct...@apache.org on 2009/01/03 17:12:36 UTC

svn commit: r731008 - /webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniServlet.java

Author: ctwiner
Date: Sat Jan  3 08:12:36 2009
New Revision: 731008

URL: http://svn.apache.org/viewvc?rev=731008&view=rev
Log:
MUSE-275

Modified:
    webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniServlet.java

Modified: webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniServlet.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniServlet.java?rev=731008&r1=731007&r2=731008&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniServlet.java (original)
+++ webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniServlet.java Sat Jan  3 08:12:36 2009
@@ -1,92 +1,93 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.muse.core.platform.mini;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import org.apache.muse.util.xml.XmlUtils;
-
-/**
- * 
- * @author Dan Jemiolo (danjemiolo)
- *  
- */
-
-public class MiniServlet extends HttpServlet
-{
-    private static final long serialVersionUID = 685701350365490390L;
-    
-    //
-    // the touchpoint runtime that handles all resource management
-    //
-    private MiniIsolationLayer _isolationLayer = null;
-    
-    protected MiniIsolationLayer createIsolationLayer(HttpServletRequest request, ServletContext context)
-    {
-        MiniIsolationLayer isolationLayer = new MiniIsolationLayer(request, context);
-        isolationLayer.initialize();
-        return isolationLayer;
-    }
-    
-    /**
-     * 
-     * POST handles all SOAP requests. The HTTP POST data is converted into 
-     * a SOAP envelope and processed by MiniIsolationLayer.
-     * 
-     */
-    public void doPost(HttpServletRequest request, HttpServletResponse response) 
-        throws IOException
-    {
-        if (_isolationLayer == null)
-            _isolationLayer = createIsolationLayer(request, getServletContext());
-            
-        InputStream input = request.getInputStream();
-        Document soapRequest = null;
-
-        try
-        {
-            soapRequest = XmlUtils.createDocument(input);
-        }
-
-        catch (SAXException error)
-        {
-            throw new IOException(error.getMessage());
-        }
-
-        Document soapResponse = _isolationLayer.handleRequest(soapRequest);
-
-        response.setContentType("text/xml");
-
-        PrintWriter writer = response.getWriter();
-        writer.write(XmlUtils.toString(soapResponse));
-        writer.flush();
-    }
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.muse.core.platform.mini;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import org.apache.muse.util.xml.XmlUtils;
+
+/**
+ * 
+ * @author Dan Jemiolo (danjemiolo)
+ *  
+ */
+
+public class MiniServlet extends HttpServlet
+{
+    private static final long serialVersionUID = 685701350365490390L;
+    
+    //
+    // the touchpoint runtime that handles all resource management
+    //
+    private MiniIsolationLayer _isolationLayer = null;
+    
+    protected MiniIsolationLayer createIsolationLayer(HttpServletRequest request, ServletContext context)
+    {
+        MiniIsolationLayer isolationLayer = new MiniIsolationLayer(request, context);
+        isolationLayer.initialize();
+        return isolationLayer;
+    }
+    
+    /**
+     * 
+     * POST handles all SOAP requests. The HTTP POST data is converted into 
+     * a SOAP envelope and processed by MiniIsolationLayer.
+     * 
+     */
+    public void doPost(HttpServletRequest request, HttpServletResponse response) 
+        throws IOException
+    {
+        if (_isolationLayer == null)
+            _isolationLayer = createIsolationLayer(request, getServletContext());
+            
+        InputStream input = request.getInputStream();
+        Document soapRequest = null;
+
+        try
+        {
+            soapRequest = XmlUtils.createDocument(input);
+        }
+
+        catch (SAXException error)
+        {
+            throw new IOException(error.getMessage());
+        }
+
+        Document soapResponse = _isolationLayer.handleRequest(soapRequest);
+
+        // MUSE-275, note the XmlUtils spits out UTF-8 only, so this must match.
+        response.setContentType("application/soap+xml; charset=UTF-8;");
+
+        PrintWriter writer = response.getWriter();
+        writer.write(XmlUtils.toString(soapResponse));
+        writer.flush();
+    }
+}