geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r499623 - in /geronimo/server/trunk: configs/cxf/ modules/geronimo-axis/src/main/java/org/apache/geronimo/axis/server/ modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ modules/geronimo-cxf-builder/src/main/java/org/apache/ger...
Date Thu, 25 Jan 2007 00:04:03 GMT
Author: djencks
Date: Wed Jan 24 16:04:01 2007
New Revision: 499623

URL: http://svn.apache.org/viewvc?view=rev&rev=499623
Log:
GERONIMO-2777 expose mandatory jaxws MessageContext properties

Modified:
    geronimo/server/trunk/configs/cxf/pom.xml
    geronimo/server/trunk/modules/geronimo-axis/src/main/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
    geronimo/server/trunk/modules/geronimo-cxf/pom.xml
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainerFactoryGBean.java
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
    geronimo/server/trunk/modules/geronimo-jetty6/pom.xml
    geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java
    geronimo/server/trunk/modules/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java
    geronimo/server/trunk/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/app/MockWebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java

Modified: geronimo/server/trunk/configs/cxf/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/cxf/pom.xml?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/configs/cxf/pom.xml (original)
+++ geronimo/server/trunk/configs/cxf/pom.xml Wed Jan 24 16:04:01 2007
@@ -49,6 +49,13 @@
             <version>${version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>transaction-jta11</artifactId>
+            <version>${version}</version>
+            <type>car</type>
+        </dependency>
+
        <dependency>
             <groupId>org.apache.geronimo.modules</groupId>
             <artifactId>geronimo-cxf</artifactId>

Modified: geronimo/server/trunk/modules/geronimo-axis/src/main/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis/src/main/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis/src/main/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis/src/main/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
Wed Jan 24 16:04:01 2007
@@ -262,6 +262,9 @@
         response.getOutputStream().flush();
     }
 
+    public void destroy() {
+    }
+
     public URI getLocation() {
         return location;
     }

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Wed Jan 24 16:04:01 2007
@@ -343,6 +343,9 @@
         }
     }
     
+    public void destroy() {
+    }
+
     public class Axis2TransportInfo implements OutTransportInfo {
         private Response response;
 

Modified: geronimo/server/trunk/modules/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
Wed Jan 24 16:04:01 2007
@@ -49,6 +49,7 @@
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.cxf.PortInfo;
 import org.apache.geronimo.cxf.CXFWebServiceContainerFactoryGBean;
@@ -186,6 +187,12 @@
 
         targetGBean.setReferencePattern("WebServiceContainerFactory", containerFactoryName);
         targetGBean.setAttribute("pojoClassName", seiClassName);
+
+        if (context instanceof EARContext) {
+            containerFactoryData.setReferencePattern("TransactionManager", 
+                                                     ((EARContext)context).getTransactionManagerName());
+        }
+
         return true;
     }
 

Modified: geronimo/server/trunk/modules/geronimo-cxf/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/pom.xml?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-cxf/pom.xml Wed Jan 24 16:04:01 2007
@@ -47,6 +47,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-transaction</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxws</artifactId>
         </dependency>

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
Wed Jan 24 16:04:01 2007
@@ -99,6 +99,9 @@
         wsdlWriter.writeWSDL(def, response.getOutputStream());
     }
 
+    public void destroy() {
+    }
+
     private  EndpointImpl publishEndpoint(Object target) {
 
         assert target != null : "null target received";

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainerFactoryGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainerFactoryGBean.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainerFactoryGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainerFactoryGBean.java
Wed Jan 24 16:04:01 2007
@@ -20,8 +20,10 @@
 import java.util.Map;
 import java.util.logging.Logger;
 import java.util.logging.Level;
+
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.transaction.TransactionManager;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.cxf.CXFBusFactory;
@@ -30,6 +32,7 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
+import org.apache.geronimo.transaction.GeronimoUserTransaction;
 import org.apache.geronimo.webservices.WebServiceContainer;
 import org.apache.geronimo.webservices.WebServiceContainerFactory;
 
@@ -38,25 +41,29 @@
  */
 public class CXFWebServiceContainerFactoryGBean implements WebServiceContainerFactory {
 
-    private static final Logger LOG = 
-        Logger.getLogger(CXFWebServiceContainerFactoryGBean.class.getName());
+    private static final Logger LOG =
+            Logger.getLogger(CXFWebServiceContainerFactoryGBean.class.getName());
 
     private final PortInfo portInfo;
     private final Bus bus;
     private final Object endpointInstance;
     private Context context;
- 
-    public CXFWebServiceContainerFactoryGBean(PortInfo portInfo, 
-                                              String endpointClassName, 
-                                              ClassLoader classLoader,
-                                              Map componentContext,
-                                              Kernel kernel)
-        throws ClassNotFoundException, IllegalAccessException, InstantiationException {
-        
-        // TODO: get access to the transaction manager
+
+    public CXFWebServiceContainerFactoryGBean(PortInfo portInfo,
+            String endpointClassName,
+            ClassLoader classLoader,
+            Map componentContext,
+            Kernel kernel,
+            TransactionManager transactionManager)
+            throws ClassNotFoundException, IllegalAccessException, InstantiationException
{
+
+        GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
         if (componentContext != null) {
             try {
-                this.context = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext,
null, kernel, classLoader);
+                this.context = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext,
+                        userTransaction,
+                        kernel,
+                        classLoader);
             } catch (NamingException e) {
                 LOG.log(Level.WARNING, "Failed to create naming context", e);
             }
@@ -81,9 +88,10 @@
         infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
         infoBuilder.addAttribute("componentContext", Map.class, true, true);
         infoBuilder.addAttribute("kernel", Kernel.class, false);
+        infoBuilder.addReference("TransactionManager", TransactionManager.class, NameFactory.TRANSACTION_MANAGER);
 
-        infoBuilder.setConstructor(new String[] {"portInfo", "endpointClassName", "classLoader",

-                                                 "componentContext", "kernel"});
+        infoBuilder.setConstructor(new String[]{"portInfo", "endpointClassName", "classLoader",
+                "componentContext", "kernel", "TransactionManager"});
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }
 

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
Wed Jan 24 16:04:01 2007
@@ -19,11 +19,19 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.Serializable;
-import java.lang.reflect.Field;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.util.Iterator;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Enumeration;
 import java.util.StringTokenizer;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.handler.MessageContext;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.message.Exchange;
@@ -37,6 +45,7 @@
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.geronimo.webservices.WebServiceContainer;
 import org.apache.geronimo.webservices.WebServiceContainer.Request;
 import org.apache.geronimo.webservices.WebServiceContainer.Response;
 
@@ -45,7 +54,9 @@
 
     private MessageObserver messageObserver;
 
-    public GeronimoDestination(Bus bus, ConduitInitiator conduitInitiator, EndpointInfo endpointInfo)
throws IOException {
+    public GeronimoDestination(Bus bus, 
+                               ConduitInitiator conduitInitiator, 
+                               EndpointInfo endpointInfo) throws IOException {
         super(bus, conduitInitiator, endpointInfo);
     }
 
@@ -55,75 +66,92 @@
 
     public void invoke(Request request, Response response) throws Exception {
         MessageImpl message = new MessageImpl();
-        message.setContent(java.io.InputStream.class, request.getInputStream());
+        message.setContent(InputStream.class, request.getInputStream());
         message.setDestination(this);
 
         message.put(Request.class, request);
         message.put(Response.class, response);
 
+        HttpServletRequest servletRequest = 
+            (HttpServletRequest)request.getAttribute(WebServiceContainer.SERVLET_REQUEST);
+        message.put(MessageContext.SERVLET_REQUEST, servletRequest);
+        
+        HttpServletResponse servletResponse =
+            (HttpServletResponse)request.getAttribute(WebServiceContainer.SERVLET_RESPONSE);
+        message.put(MessageContext.SERVLET_RESPONSE, servletResponse);
+        
+        ServletContext servletContext = 
+            (ServletContext)request.getAttribute(WebServiceContainer.SERVLET_CONTEXT);
+        message.put(MessageContext.SERVLET_CONTEXT, servletContext);
+        
+        // this calls copyRequestHeaders()
+        setHeaders(message);
+        
+        message.put(Message.HTTP_REQUEST_METHOD, servletRequest.getMethod());
+        message.put(Message.PATH_INFO, servletRequest.getPathInfo());
+        message.put(Message.QUERY_STRING, servletRequest.getQueryString());
+        message.put(Message.CONTENT_TYPE, servletRequest.getContentType());
+        message.put(Message.ENCODING, servletRequest.getCharacterEncoding());
+        
         messageObserver.onMessage(message);
     }
 
-    public Conduit getBackChannel(Message inMessage, Message partialResponse, EndpointReferenceType
address) throws IOException {
-        Response response = inMessage.get(Response.class);
-        Conduit backChannel;
-        Exchange ex = inMessage.getExchange();
-        EndpointReferenceType target = address != null
-                ? address
-                : ex.get(EndpointReferenceType.class);
-        if (target == null) {
-            backChannel = new BackChannelConduit(response);
-        } else {
-            throw new IllegalArgumentException("RM not yet implemented");
-        }
-        return backChannel;
-    }
-
-    public void shutdown() {
-    }
-
-    @Override
     protected void copyRequestHeaders(Message message, Map<String, List<String>>
headers) {
-        Request req = message.get(Request.class);
-
-        // no map of headers so just find all static field constants that begin with HEADER_,
get
-        // its value and get the corresponding header.
-        for (Field field : Request.class.getFields()) {
-            if (field.getName().startsWith("HEADER_")) {
-                try {
-                    assert field.getType().equals(String.class) : "unexpected field type";
-                    String headerName = (String) field.get(null);
-                    String headerValue = req.getHeader(headerName);
-                    if (headerValue != null) {
-                        List<String> values = headers.get(headerName);
-                        if (values == null) {
-                            values = new LinkedList<String>();
-                            headers.put(headerName, values);
-                        }
-                        values.addAll(splitMultipleHeaderValues(headerValue));
-                    }
-                } catch (IllegalAccessException ex) {
-                    // ignore 
+        HttpServletRequest servletRequest = (HttpServletRequest)message.get(MessageContext.SERVLET_REQUEST);
+        if (servletRequest != null) {
+            Enumeration names = servletRequest.getHeaderNames();
+            while(names.hasMoreElements()) {
+                String name = (String)names.nextElement();
+                
+                List<String> headerValues = headers.get(name);
+                if (headerValues == null) {
+                    headerValues = new ArrayList<String>();
+                    headers.put(name, headerValues);
+                }
+                
+                Enumeration values = servletRequest.getHeaders(name);
+                while(values.hasMoreElements()) {
+                    String value = (String)values.nextElement();
+                    headerValues.add(value);
                 }
             }
         }
     }
 
-    private List<String> splitMultipleHeaderValues(String value) {
-
-        List<String> allValues = new LinkedList<String>();
-        if (value.contains(",")) {
-            StringTokenizer st = new StringTokenizer(value, ",");
-            while (st.hasMoreTokens()) {
-                allValues.add(st.nextToken().trim());
-            }
-
+    public Conduit getBackChannel(Message inMessage,
+                                  Message partialResponse,
+                                  EndpointReferenceType address) throws IOException {
+        Conduit backChannel = null;
+        if (address == null) {
+            backChannel = new BackChannelConduit(address, inMessage);
         } else {
-            allValues.add(value);
+            if (partialResponse != null) {
+                // setup the outbound message to for 202 Accepted
+                partialResponse.put(Message.RESPONSE_CODE,
+                                    HttpURLConnection.HTTP_ACCEPTED);
+                backChannel = new BackChannelConduit(address, inMessage);
+            } else {
+                backChannel = conduitInitiator.getConduit(endpointInfo, address);
+                // ensure decoupled back channel input stream is closed
+                backChannel.setMessageObserver(new MessageObserver() {
+                    public void onMessage(Message m) {
+                        if (m.getContentFormats().contains(InputStream.class)) {
+                            InputStream is = m.getContent(InputStream.class);
+                            try {
+                                is.close();
+                            } catch (Exception e) {
+                                // ignore
+                            }
+                        }
+                    }
+                });
+            }
         }
-        return allValues;
+        return backChannel;
     }
 
+    public void shutdown() {
+    }
 
     public void setMessageObserver(MessageObserver messageObserver) {
         this.messageObserver = messageObserver;
@@ -131,15 +159,12 @@
 
     protected class BackChannelConduit implements Conduit {
 
-        //TODO this will soon be publically available from somewhere in CXF
-        private static final String ANONYMOUS_ADDRESS =
-                "http://www.w3.org/2005/08/addressing/anonymous";
-        protected Response response;
+        protected Message request;
         protected EndpointReferenceType target;
 
-        BackChannelConduit(Response resp) {
-            response = resp;
-            target = EndpointReferenceUtils.getEndpointReference(ANONYMOUS_ADDRESS);
+        BackChannelConduit(EndpointReferenceType target, Message request) {
+            this.target = target;
+            this.request = request;
         }
 
         public void close(Message msg) throws IOException {
@@ -162,12 +187,46 @@
          * @param message the message to be sent.
          */
         public void send(Message message) throws IOException {
-            message.put(Response.class, response);
+            Response response = (Response)request.get(Response.class);
+
+            // 1. handle response code
+            Integer i = (Integer)message.get(Message.RESPONSE_CODE);
+            if (i != null) {
+                response.setStatusCode(i.intValue());
+            }
+
+            // 2. handle response headers
+            updateResponseHeaders(message);
+
+            Map<String, List<String>> protocolHeaders =
+                (Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS);
+
+            // set headers of the HTTP response object
+            Iterator headers = protocolHeaders.entrySet().iterator();
+            while(headers.hasNext()) {
+                Map.Entry entry = (Map.Entry)headers.next();
+                String headerName = (String)entry.getKey();
+                String headerValue = getHeaderValue((List)entry.getValue());
+                response.setHeader(headerName, headerValue);
+            }
+
             //TODO gregw says this should work: current cxf-jetty code wraps output stream.
             //if this doesn't work, we'd see an error from jetty saying you cant write headers
to the output stream.
             message.setContent(OutputStream.class, response.getOutputStream());
         }
 
+        private String getHeaderValue(List<String> values) {
+            Iterator iter = values.iterator();
+            StringBuffer buf = new StringBuffer();
+            while(iter.hasNext()) {
+                buf.append(iter.next());
+                if (iter.hasNext()) {
+                    buf.append(", ");
+                }
+            }
+            return buf.toString();
+        }
+        
         /**
          * @return the reference associated with the target Destination
          */

Modified: geronimo/server/trunk/modules/geronimo-jetty6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6/pom.xml?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6/pom.xml (original)
+++ geronimo/server/trunk/modules/geronimo-jetty6/pom.xml Wed Jan 24 16:04:01 2007
@@ -73,7 +73,12 @@
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty</artifactId>
         </dependency>
-        
+
+        <!--<dependency>-->
+            <!--<groupId>org.mortbay.jetty</groupId>-->
+            <!--<artifactId>jetty-plus</artifactId>-->
+        <!--</dependency>-->
+
         <dependency>
             <groupId>org.apache.tomcat</groupId>
             <artifactId>jasper</artifactId>

Modified: geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyEJBWebServiceContext.java
Wed Jan 24 16:04:01 2007
@@ -137,6 +137,11 @@
         RequestAdapter request = new RequestAdapter(jettyRequest);
         ResponseAdapter response = new ResponseAdapter(jettyResponse);
 
+        request.setAttribute(WebServiceContainer.SERVLET_REQUEST, req);
+        request.setAttribute(WebServiceContainer.SERVLET_RESPONSE, res);
+        // TODO: add support for context
+        request.setAttribute(WebServiceContainer.SERVLET_CONTEXT, null);
+
         if (req.getParameter("wsdl") != null) {
             try {
                 webServiceContainer.getWsdl(request, response);
@@ -325,5 +330,5 @@
             response.setStatus(response.getStatus(), responseString);
         }
     }
-
+    
 }

Modified: geronimo/server/trunk/modules/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java
Wed Jan 24 16:04:01 2007
@@ -30,4 +30,7 @@
     
     }
 
+    public void destroy() {
+    }
+
 }

Modified: geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatEJBWebServiceContext.java
Wed Jan 24 16:04:01 2007
@@ -24,7 +24,10 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 import org.apache.catalina.authenticator.BasicAuthenticator;
 import org.apache.catalina.authenticator.DigestAuthenticator;
@@ -130,6 +133,12 @@
             req.setContentType("text/xml");
             RequestAdapter request = new RequestAdapter(req);
             ResponseAdapter response = new ResponseAdapter(res);
+
+            request.setAttribute(WebServiceContainer.SERVLET_REQUEST, (HttpServletRequest)req);
+            request.setAttribute(WebServiceContainer.SERVLET_RESPONSE, (HttpServletResponse)res);
+            // TODO: add support for context
+            request.setAttribute(WebServiceContainer.SERVLET_CONTEXT, null);
+
             req.finishRequest();
             if (req.getParameter("wsdl") != null) {
                 try {

Modified: geronimo/server/trunk/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/app/MockWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/app/MockWebServiceContainer.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/app/MockWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/app/MockWebServiceContainer.java
Wed Jan 24 16:04:01 2007
@@ -30,4 +30,7 @@
    
    }
 
+    public void destroy() {
+    }
+
 }

Modified: geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainer.java
Wed Jan 24 16:04:01 2007
@@ -43,6 +43,24 @@
     public static final String MESSAGE_CONTEXT = WebServiceContainer.class.getName()+"@MessageContext";
 
     /**
+     * Used for JAX-WS MessageContext. MessageContext must expose HttpServletRequest. 
+     */
+    public static final String SERVLET_REQUEST = 
+        WebServiceContainer.class.getName()+"@ServletRequest";
+    
+    /**
+     * Used for JAX-WS MessageContext. MessageContext must expose HttpServletResponse.
+     */
+    public static final String SERVLET_RESPONSE = 
+        WebServiceContainer.class.getName()+"@ServletResponse";
+    
+    /**
+     * Used for JAX-WS MessageContext. MessageContext must expose ServletContext.
+     */
+    public static final String SERVLET_CONTEXT = 
+        WebServiceContainer.class.getName()+"@ServletContext";
+    
+    /**
      * Token inserted into wsdl where location should be replaced with the real location
      */
     public String LOCATION_REPLACEMENT_TOKEN = "LOCATIONREPLACEMENTTOKEN";
@@ -50,6 +68,8 @@
     void invoke(Request request, Response response) throws Exception;
 
     void getWsdl(Request req, Response res) throws Exception;
+
+    void destroy();
 
     public interface Request {
         /** the HTTP OPTIONS type */

Modified: geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java?view=diff&rev=499623&r1=499622&r2=499623
==============================================================================
--- geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java
(original)
+++ geronimo/server/trunk/modules/geronimo-webservices/src/main/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java
Wed Jan 24 16:04:01 2007
@@ -40,19 +40,21 @@
 
     private final Object pojo;
     private WebServiceContainer service;
+    private ServletConfig config;
 
     public WebServiceContainerInvoker(Object pojo) {
         this.pojo = pojo;
     }
 
     public void init(ServletConfig config) throws ServletException {
+        this.config = config;
         ServletContext context = config.getServletContext();
         String webServiceContainerID = config.getInitParameter(WEBSERVICE_CONTAINER);
         service = (WebServiceContainer) context.getAttribute(webServiceContainerID);
     }
 
     public ServletConfig getServletConfig() {
-        return null;
+        return config;
     }
 
     public void service(ServletRequest req, ServletResponse res) throws ServletException,
IOException {
@@ -63,6 +65,10 @@
         // This is the guy the WebServiceContainer should invoke
         req.setAttribute(WebServiceContainer.POJO_INSTANCE, pojo);
 
+        req.setAttribute(WebServiceContainer.SERVLET_REQUEST, (HttpServletRequest) req);
+        req.setAttribute(WebServiceContainer.SERVLET_RESPONSE, (HttpServletResponse) res);
+        req.setAttribute(WebServiceContainer.SERVLET_CONTEXT, config.getServletContext());
+
         if (req.getParameter("wsdl") != null || req.getParameter("WSDL") != null) {
             try {
                 service.getWsdl(request, response);
@@ -91,6 +97,7 @@
     }
 
     public void destroy() {
+        service.destroy();
     }
 
     private static class RequestAdapter implements WebServiceContainer.Request {
@@ -141,7 +148,6 @@
             return request.getParameterMap();
         }
 
-
         private static final Map methods = new HashMap();
 
         static {
@@ -175,7 +181,7 @@
         public ResponseAdapter(HttpServletResponse response) {
             this.response = response;
         }
-
+        
         public void setHeader(String name, String value) {
             response.setHeader(name, value);
         }



Mime
View raw message