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 da...@apache.org on 2007/03/24 14:12:20 UTC

svn commit: r522017 [3/3] - in /webservices/muse/trunk/modules: muse-osgi-soa-axis2/src/org/apache/muse/core/platform/osgi/axis2/ muse-osgi-soa-axis2/src/org/apache/muse/core/platform/osgi/axis2/internal/ muse-osgi-soa-core/src/org/apache/muse/osgi/soa...

Modified: webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java?view=diff&rev=522017&r1=522016&r2=522017
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java (original)
+++ webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/AxisIsolationLayer.java Sat Mar 24 06:12:19 2007
@@ -1,142 +1,146 @@
-/*=============================================================================*
- *  Copyright 2006 The Apache Software Foundation
- *
- *  Licensed 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.axis2;
-
-import java.util.logging.Level;
-
-import org.w3c.dom.Element;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.context.MessageContext;
-
-import org.apache.muse.core.Environment;
-import org.apache.muse.core.platform.AbstractIsolationLayer;
-import org.apache.muse.core.routing.ResourceRouter;
-import org.apache.muse.util.LoggingUtils;
-import org.apache.muse.ws.addressing.MessageHeaders;
-
-/**
- * 
- * AxisIsolationLayer is an Axis2 web service class; that is, it can be 
- * deployed as an Axis2 service using the services.xml file. This class will 
- * be the web service for <b>all</b> Muse applications that run on Axis2. 
- * The deployment descriptor, muse.xml, is used to configure the resource 
- * types that are created and managed by this service.
- * 
- * @author Dan Jemiolo (danj)
- *
- */
-
-public class AxisIsolationLayer extends AbstractIsolationLayer
-{
-    protected Environment createEnvironment()
-    {
-        return new AxisEnvironment();
-    }
-    
-    /**
-     * 
-     * Parses the information in the incoming SOAP envelope and gives it 
-     * to the implied resource router for further processing. The results 
-     * of the operation are added to the outgoing envelope. All faults are 
-     * serialized and added to the outgoing envelope, so no exceptions 
-     * should be thrown from this method.
-     *
-     * @param request
-     *        The contents of the incoming SOAP body.
-     *        
-     * @return The contents of the outgoing SOAP body.
-     *
-     */
-    public final OMElement handleRequest(OMElement request)
-    {
-        //
-        // is this the first time this is being called? initialize!
-        //
-        if (!hasBeenInitialized())
-            initialize();
-        
-        Element soapResponse = null;
-        
-        //
-        // for all requests, we need to save the addressing headers so that 
-        // we can access the SOAP envelope in handleRequest()
-        //
-        if (hasFailedToInitialize())
-            soapResponse = getCauseOfFailure().toXML();
-        
-        else
-            soapResponse = invoke(request);
-
-        //
-        // be sure to handle empty SOAP body in the response
-        //
-        if (soapResponse == null)
-            return null;
-
-        AxisEnvironment env = (AxisEnvironment)getRouter().getEnvironment();
-        return env.convertToAxiom(soapResponse);
-    }
-    
-    public Element invoke(OMElement request)
-    {
-        ResourceRouter router = getRouter();
-        AxisEnvironment env = (AxisEnvironment)router.getEnvironment();
-        
-        //
-        // log incoming SOAP envelope
-        //
-        // NOTE: This is kind of hack-ish, but we check to see if the 
-        //       current log level is 'FINE' before we try and log the 
-        //       message. We don't actually have to do this - the JDK 
-        //       logging API fine() will do this for us - but because 
-        //       we have to translate from Axiom to DOM once already, 
-        //       I don't want to do it twice unless the tracing is being 
-        //       used. If SOAP-level tracing is on, it's likely that this 
-        //       is not being used in a production system, so we can afford 
-        //       the performance hit of an extra conversion.
-        //
-        if (router.getLog().getLevel() == Level.FINE)
-        {
-            SOAPEnvelope soap = MessageContext.getCurrentMessageContext().getEnvelope();
-            Element soapAsDOM = env.convertToDOM(soap);
-            LoggingUtils.logMessage(router.getLog(), soapAsDOM, true);
-        }
-        
-        MessageHeaders wsa = env.convertContext();        
-        env.addAddressingContext(wsa);
-        
-        Element soapBody = null;
-        
-        //
-        // handle empty SOAP bodies
-        //
-        if (request != null)
-            soapBody = env.convertToDOM(request);
-    
-        Element soapResponse = getRouter().invoke(soapBody);
-        
-        //
-        // all done - don't forget to clean up the context or 
-        // we'll have a memory leak
-        //
-        env.removeAddressingContext();
-        
-        return soapResponse;        
-    }
-}
+/* 
+ * 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.axis2;
+
+import java.util.logging.Level;
+
+import org.w3c.dom.Element;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.context.MessageContext;
+
+import org.apache.muse.core.Environment;
+import org.apache.muse.core.platform.AbstractIsolationLayer;
+import org.apache.muse.core.routing.ResourceRouter;
+import org.apache.muse.util.LoggingUtils;
+import org.apache.muse.ws.addressing.MessageHeaders;
+
+/**
+ * 
+ * AxisIsolationLayer is an Axis2 web service class; that is, it can be 
+ * deployed as an Axis2 service using the services.xml file. This class will 
+ * be the web service for <b>all</b> Muse applications that run on Axis2. 
+ * The deployment descriptor, muse.xml, is used to configure the resource 
+ * types that are created and managed by this service.
+ * 
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class AxisIsolationLayer extends AbstractIsolationLayer
+{
+    protected Environment createEnvironment()
+    {
+        return new AxisEnvironment();
+    }
+    
+    /**
+     * 
+     * Parses the information in the incoming SOAP envelope and gives it 
+     * to the implied resource router for further processing. The results 
+     * of the operation are added to the outgoing envelope. All faults are 
+     * serialized and added to the outgoing envelope, so no exceptions 
+     * should be thrown from this method.
+     *
+     * @param request
+     *        The contents of the incoming SOAP body.
+     *        
+     * @return The contents of the outgoing SOAP body.
+     *
+     */
+    public final OMElement handleRequest(OMElement request)
+    {
+        //
+        // is this the first time this is being called? initialize!
+        //
+        if (!hasBeenInitialized())
+            initialize();
+        
+        Element soapResponse = null;
+        
+        //
+        // for all requests, we need to save the addressing headers so that 
+        // we can access the SOAP envelope in handleRequest()
+        //
+        if (hasFailedToInitialize())
+            soapResponse = getCauseOfFailure().toXML();
+        
+        else
+            soapResponse = invoke(request);
+
+        //
+        // be sure to handle empty SOAP body in the response
+        //
+        if (soapResponse == null)
+            return null;
+
+        AxisEnvironment env = (AxisEnvironment)getRouter().getEnvironment();
+        return env.convertToAxiom(soapResponse);
+    }
+    
+    public Element invoke(OMElement request)
+    {
+        ResourceRouter router = getRouter();
+        AxisEnvironment env = (AxisEnvironment)router.getEnvironment();
+        
+        //
+        // log incoming SOAP envelope
+        //
+        // NOTE: This is kind of hack-ish, but we check to see if the 
+        //       current log level is 'FINE' before we try and log the 
+        //       message. We don't actually have to do this - the JDK 
+        //       logging API fine() will do this for us - but because 
+        //       we have to translate from Axiom to DOM once already, 
+        //       I don't want to do it twice unless the tracing is being 
+        //       used. If SOAP-level tracing is on, it's likely that this 
+        //       is not being used in a production system, so we can afford 
+        //       the performance hit of an extra conversion.
+        //
+        if (router.getLog().getLevel() == Level.FINE)
+        {
+            SOAPEnvelope soap = MessageContext.getCurrentMessageContext().getEnvelope();
+            Element soapAsDOM = env.convertToDOM(soap);
+            LoggingUtils.logMessage(router.getLog(), soapAsDOM, true);
+        }
+        
+        MessageHeaders wsa = env.convertContext();        
+        env.addAddressingContext(wsa);
+        
+        Element soapBody = null;
+        
+        //
+        // handle empty SOAP bodies
+        //
+        if (request != null)
+            soapBody = env.convertToDOM(request);
+    
+        Element soapResponse = getRouter().invoke(soapBody);
+        
+        //
+        // all done - don't forget to clean up the context or 
+        // we'll have a memory leak
+        //
+        env.removeAddressingContext();
+        
+        return soapResponse;        
+    }
+}

Modified: webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/ResponseActionHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/ResponseActionHandler.java?view=diff&rev=522017&r1=522016&r2=522017
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/ResponseActionHandler.java (original)
+++ webservices/muse/trunk/modules/muse-platform-axis2/src/org/apache/muse/core/platform/axis2/ResponseActionHandler.java Sat Mar 24 06:12:19 2007
@@ -1,86 +1,90 @@
-/*=============================================================================*
- *  Copyright 2006 The Apache Software Foundation
- *
- *  Licensed 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.axis2;
-
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.muse.ws.addressing.WsaConstants;
-import org.apache.muse.ws.addressing.soap.SoapConstants;
-
-/**
- * 
- * This is an Axis2 handler that provides a WS-A Action URI for the response 
- * message based on the one that was included in the request message. Axis2 
- * does not provide a response URI that differs from the request URI. In cases 
- * where the operation results in a fault, the standard WS-A fault URI is used.
- *  
- * @author Mohammad Fakhar
- * @author Dan Jemiolo (danj)
- *
- */
-
-public class ResponseActionHandler extends AbstractHandler
-{
-    private static final String _REQUEST = "Request";
-    private static final String _RESPONSE = "Response";
-    
-    private void handleFault(MessageContext msgContext)
-    {
-        msgContext.setWSAAction(WsaConstants.FAULT_URI);
-    }
-    
-    private void handleResponse(MessageContext msgContext)
-    {
-        String currentResponseAction = msgContext.getWSAAction();
-        String realResponseAction = null;
-        
-        //
-        // replace "Request" with "Response" if needed - if "Request" is 
-        // not found, just tack on a "Response"
-        //
-        // NOTE: this logic is based on MessageHeaders.createReplyHeaders()
-        //
-        
-        int requestSuffix = currentResponseAction.lastIndexOf(_REQUEST);
-        
-        if (requestSuffix >= 0)
-            realResponseAction = currentResponseAction.substring(0, requestSuffix) + _RESPONSE;
-        
-        else
-            realResponseAction = currentResponseAction + _RESPONSE;
-
-        msgContext.setWSAAction(realResponseAction);
-    }
-
-    public InvocationResponse invoke(MessageContext msgContext)
-    {
-        SOAPBody soapBody = msgContext.getEnvelope().getBody();
-        
-        //
-        // if the operation was a fault, there will always be 
-        // a SOAP 1.2 Fault element in the response body
-        //
-    	if ((soapBody.getFirstChildWithName(SoapConstants.FAULT_QNAME) != null))
-    		handleFault(msgContext);
-        
-    	else
-    		handleResponse(msgContext);
-        
-        return InvocationResponse.CONTINUE;
-    }
-}
+/* 
+ * 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.axis2;
+
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.muse.ws.addressing.WsaConstants;
+import org.apache.muse.ws.addressing.soap.SoapConstants;
+
+/**
+ * 
+ * This is an Axis2 handler that provides a WS-A Action URI for the response 
+ * message based on the one that was included in the request message. Axis2 
+ * does not provide a response URI that differs from the request URI. In cases 
+ * where the operation results in a fault, the standard WS-A fault URI is used.
+ *  
+ * @author Mohammad Fakhar
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class ResponseActionHandler extends AbstractHandler
+{
+    private static final String _REQUEST = "Request";
+    private static final String _RESPONSE = "Response";
+    
+    private void handleFault(MessageContext msgContext)
+    {
+        msgContext.setWSAAction(WsaConstants.FAULT_URI);
+    }
+    
+    private void handleResponse(MessageContext msgContext)
+    {
+        String currentResponseAction = msgContext.getWSAAction();
+        String realResponseAction = null;
+        
+        //
+        // replace "Request" with "Response" if needed - if "Request" is 
+        // not found, just tack on a "Response"
+        //
+        // NOTE: this logic is based on MessageHeaders.createReplyHeaders()
+        //
+        
+        int requestSuffix = currentResponseAction.lastIndexOf(_REQUEST);
+        
+        if (requestSuffix >= 0)
+            realResponseAction = currentResponseAction.substring(0, requestSuffix) + _RESPONSE;
+        
+        else
+            realResponseAction = currentResponseAction + _RESPONSE;
+
+        msgContext.setWSAAction(realResponseAction);
+    }
+
+    public InvocationResponse invoke(MessageContext msgContext)
+    {
+        SOAPBody soapBody = msgContext.getEnvelope().getBody();
+        
+        //
+        // if the operation was a fault, there will always be 
+        // a SOAP 1.2 Fault element in the response body
+        //
+    	if ((soapBody.getFirstChildWithName(SoapConstants.FAULT_QNAME) != null))
+    		handleFault(msgContext);
+        
+    	else
+    		handleResponse(msgContext);
+        
+        return InvocationResponse.CONTINUE;
+    }
+}

Modified: webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniEnvironment.java?view=diff&rev=522017&r1=522016&r2=522017
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniEnvironment.java (original)
+++ webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniEnvironment.java Sat Mar 24 06:12:19 2007
@@ -1,65 +1,69 @@
-/*=============================================================================*
- *  Copyright 2006 The Apache Software Foundation
- *
- *  Licensed 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.File;
-import java.net.URI;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.muse.core.AbstractEnvironment;
-import org.apache.muse.util.FileUtils;
-import org.apache.muse.ws.addressing.EndpointReference;
-
-/**
- * 
- * @author Dan Jemiolo (danj)
- *
- */
-
-public class MiniEnvironment extends AbstractEnvironment
-{
-    private static final String _DIRECTORY_PATH = "/WEB-INF/classes";
-    
-    private File _realDirectory = null;
-    
-    public MiniEnvironment(HttpServletRequest httpRequest, ServletContext servletContext)
-    {
-        String realDirectoryPath = servletContext.getRealPath(_DIRECTORY_PATH);
-        
-        if (realDirectoryPath == null)
-            _realDirectory = FileUtils.CURRENT_DIR;
-        
-        else
-            _realDirectory = new File(realDirectoryPath);
-        
-        setDefaultURI(httpRequest.getRequestURL().toString());
-    }
-    
-    public EndpointReference getDeploymentEPR()
-    {
-        String defaultString = getDefaultURI();
-        URI defaultURI = URI.create(defaultString);
-        return new EndpointReference(defaultURI);
-    }
-
-    public File getRealDirectory()
-    {
-        return _realDirectory;
-    }
-}
+/* 
+ * 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.File;
+import java.net.URI;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.muse.core.AbstractEnvironment;
+import org.apache.muse.util.FileUtils;
+import org.apache.muse.ws.addressing.EndpointReference;
+
+/**
+ * 
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public class MiniEnvironment extends AbstractEnvironment
+{
+    private static final String _DIRECTORY_PATH = "/WEB-INF/classes";
+    
+    private File _realDirectory = null;
+    
+    public MiniEnvironment(HttpServletRequest httpRequest, ServletContext servletContext)
+    {
+        String realDirectoryPath = servletContext.getRealPath(_DIRECTORY_PATH);
+        
+        if (realDirectoryPath == null)
+            _realDirectory = FileUtils.CURRENT_DIR;
+        
+        else
+            _realDirectory = new File(realDirectoryPath);
+        
+        setDefaultURI(httpRequest.getRequestURL().toString());
+    }
+    
+    public EndpointReference getDeploymentEPR()
+    {
+        String defaultString = getDefaultURI();
+        URI defaultURI = URI.create(defaultString);
+        return new EndpointReference(defaultURI);
+    }
+
+    public File getRealDirectory()
+    {
+        return _realDirectory;
+    }
+}

Modified: webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniIsolationLayer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniIsolationLayer.java?view=diff&rev=522017&r1=522016&r2=522017
==============================================================================
--- webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniIsolationLayer.java (original)
+++ webservices/muse/trunk/modules/muse-platform-mini/src/org/apache/muse/core/platform/mini/MiniIsolationLayer.java Sat Mar 24 06:12:19 2007
@@ -1,160 +1,167 @@
-// ========================================================================
-//
-// Licensed Materials - Property of IBM
-//
-// PRODUCT_NO
-//
-// (c) Copyright IBM Corp. 2005.    All Rights Reserved.
-//
-// US Government Users Restricted Rights - Use, duplication or
-// disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
-//
-// =========================================================================
-
-package org.apache.muse.core.platform.mini;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.apache.muse.core.Environment;
-import org.apache.muse.core.platform.AbstractIsolationLayer;
-import org.apache.muse.core.routing.ResourceRouter;
-import org.apache.muse.util.LoggingUtils;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.addressing.MessageHeaders;
-import org.apache.muse.ws.addressing.soap.SoapConstants;
-import org.apache.muse.ws.addressing.soap.SoapUtils;
-
-/**
- * 
- * @author Dan Jemiolo (danjemiolo)
- *  
- */
-
-public class MiniIsolationLayer extends AbstractIsolationLayer
-{
-    private ServletContext _initialContext = null;
-    
-    private HttpServletRequest _initialRequest = null;
-    
-    public MiniIsolationLayer(HttpServletRequest initialRequest, ServletContext initialContext)
-    {
-        _initialRequest = initialRequest;
-        _initialContext = initialContext;
-    }
-    
-    protected Environment createEnvironment()
-    {
-        return new MiniEnvironment(getInitialRequest(), getInitialContext());
-    }
-    
-    protected ServletContext getInitialContext()
-    {
-        return _initialContext;
-    }
-    
-    protected HttpServletRequest getInitialRequest()
-    {
-        return _initialRequest;
-    }
-
-    public Document handleRequest(Document request)
-    {
-        Element soap = XmlUtils.getFirstElement(request);
-        Element header = XmlUtils.getElement(soap, SoapConstants.HEADER_QNAME);
-        Element body = XmlUtils.getElement(soap, SoapConstants.BODY_QNAME);
-
-        if (header == null)
-            throw new RuntimeException("Invalid SOAP envelope: no header element.");        
-
-        if (body == null)
-            throw new RuntimeException("Invalid SOAP envelope: no body element.");
-
-        Element requestData = XmlUtils.getFirstElement(body);
-        
-        ResourceRouter router = getRouter();
-        Environment env = router.getEnvironment();
-
-        MessageHeaders addressing = null;
-
-        try
-        {
-            //
-            // WS-A info provides resource context for this request
-            //
-            addressing = new MessageHeaders(header);
-            env.addAddressingContext(addressing);
-        }
-
-        catch (Throwable error)
-        {
-            LoggingUtils.logError(router.getLog(), error);
-        }
-
-        if (!hasFailedToInitialize())
-            LoggingUtils.logMessage(router.getLog(), request, true);
-
-        //
-        // actually perform the operation with the given parameters
-        //
-        Element result = router.invoke(requestData);
-        
-        //
-        // the standard response wsa:Action name is Action + "Response"
-        //
-        MessageHeaders replyAddressing = null;
-
-        //
-        // send back fault headers on exception
-        //
-        if (SoapUtils.isFault(result))
-            replyAddressing = addressing.createFaultHeaders();
-
-        else
-            replyAddressing = addressing.createReplyHeaders();
-
-        //
-        // DONE - must be sure to remove the request context, or 
-        // we'll have a memory leak
-        //
-        env.removeAddressingContext();
-
-        //
-        // import all of the headers into the response envelope...
-        //        
-        Element replyXML = replyAddressing.toXML();
-        Element[] children = XmlUtils.getAllElements(replyXML);
-
-        Document response = XmlUtils.createDocument();
-
-        soap = XmlUtils.createElement(response, SoapConstants.ENVELOPE_QNAME);
-        response.appendChild(soap);
-
-        header = XmlUtils.createElement(response, SoapConstants.HEADER_QNAME);
-        soap.appendChild(header);
-
-        for (int n = 0; n < children.length; ++n)
-        {
-            Node next = response.importNode(children[n], true);
-            header.appendChild(next);
-        }
-
-        //
-        // add the result (valid or fault) to the SOAP body...
-        //
-        body = XmlUtils.createElement(response, SoapConstants.BODY_QNAME);
-        soap.appendChild(body);
-
-        result = (Element)response.importNode(result, true);
-        body.appendChild(result);
-
-        if (!hasFailedToInitialize())
-            LoggingUtils.logMessage(router.getLog(), response, false);
-
-        return response;
-    }
-}
+/* 
+ * 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 javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.muse.core.Environment;
+import org.apache.muse.core.platform.AbstractIsolationLayer;
+import org.apache.muse.core.routing.ResourceRouter;
+import org.apache.muse.util.LoggingUtils;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.MessageHeaders;
+import org.apache.muse.ws.addressing.soap.SoapConstants;
+import org.apache.muse.ws.addressing.soap.SoapUtils;
+
+/**
+ * 
+ * @author Dan Jemiolo (danjemiolo)
+ *  
+ */
+
+public class MiniIsolationLayer extends AbstractIsolationLayer
+{
+    private ServletContext _initialContext = null;
+    
+    private HttpServletRequest _initialRequest = null;
+    
+    public MiniIsolationLayer(HttpServletRequest initialRequest, ServletContext initialContext)
+    {
+        _initialRequest = initialRequest;
+        _initialContext = initialContext;
+    }
+    
+    protected Environment createEnvironment()
+    {
+        return new MiniEnvironment(getInitialRequest(), getInitialContext());
+    }
+    
+    protected ServletContext getInitialContext()
+    {
+        return _initialContext;
+    }
+    
+    protected HttpServletRequest getInitialRequest()
+    {
+        return _initialRequest;
+    }
+
+    public Document handleRequest(Document request)
+    {
+        Element soap = XmlUtils.getFirstElement(request);
+        Element header = XmlUtils.getElement(soap, SoapConstants.HEADER_QNAME);
+        Element body = XmlUtils.getElement(soap, SoapConstants.BODY_QNAME);
+
+        if (header == null)
+            throw new RuntimeException("Invalid SOAP envelope: no header element.");        
+
+        if (body == null)
+            throw new RuntimeException("Invalid SOAP envelope: no body element.");
+
+        Element requestData = XmlUtils.getFirstElement(body);
+        
+        ResourceRouter router = getRouter();
+        Environment env = router.getEnvironment();
+
+        MessageHeaders addressing = null;
+
+        try
+        {
+            //
+            // WS-A info provides resource context for this request
+            //
+            addressing = new MessageHeaders(header);
+            env.addAddressingContext(addressing);
+        }
+
+        catch (Throwable error)
+        {
+            LoggingUtils.logError(router.getLog(), error);
+        }
+
+        if (!hasFailedToInitialize())
+            LoggingUtils.logMessage(router.getLog(), request, true);
+
+        //
+        // actually perform the operation with the given parameters
+        //
+        Element result = router.invoke(requestData);
+        
+        //
+        // the standard response wsa:Action name is Action + "Response"
+        //
+        MessageHeaders replyAddressing = null;
+
+        //
+        // send back fault headers on exception
+        //
+        if (SoapUtils.isFault(result))
+            replyAddressing = addressing.createFaultHeaders();
+
+        else
+            replyAddressing = addressing.createReplyHeaders();
+
+        //
+        // DONE - must be sure to remove the request context, or 
+        // we'll have a memory leak
+        //
+        env.removeAddressingContext();
+
+        //
+        // import all of the headers into the response envelope...
+        //        
+        Element replyXML = replyAddressing.toXML();
+        Element[] children = XmlUtils.getAllElements(replyXML);
+
+        Document response = XmlUtils.createDocument();
+
+        soap = XmlUtils.createElement(response, SoapConstants.ENVELOPE_QNAME);
+        response.appendChild(soap);
+
+        header = XmlUtils.createElement(response, SoapConstants.HEADER_QNAME);
+        soap.appendChild(header);
+
+        for (int n = 0; n < children.length; ++n)
+        {
+            Node next = response.importNode(children[n], true);
+            header.appendChild(next);
+        }
+
+        //
+        // add the result (valid or fault) to the SOAP body...
+        //
+        body = XmlUtils.createElement(response, SoapConstants.BODY_QNAME);
+        soap.appendChild(body);
+
+        result = (Element)response.importNode(result, true);
+        body.appendChild(result);
+
+        if (!hasFailedToInitialize())
+            LoggingUtils.logMessage(router.getLog(), response, false);
+
+        return response;
+    }
+}

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?view=diff&rev=522017&r1=522016&r2=522017
==============================================================================
--- 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 Mar 24 06:12:19 2007
@@ -1,73 +1,92 @@
-
-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);
+
+        response.setContentType("text/xml");
+
+        PrintWriter writer = response.getWriter();
+        writer.write(XmlUtils.toString(soapResponse));
+        writer.flush();
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org