geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r689648 - in /geronimo/server/trunk/plugins/cxf: geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/ geronimo-cxf/src/main/java/org/apache/geronimo/cxf/ geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/
Date Wed, 27 Aug 2008 22:53:16 GMT
Author: gawor
Date: Wed Aug 27 15:53:15 2008
New Revision: 689648

URL: http://svn.apache.org/viewvc?rev=689648&view=rev
Log:
Make sure WebServiceContext.getEPR() returns right service address (part of GERONIMO-4263)

Modified:
    geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBEndpoint.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceContainer.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBEndpoint.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBEndpoint.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBEndpoint.java
Wed Aug 27 15:53:15 2008
@@ -23,7 +23,6 @@
 
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.WebServiceException;
 
@@ -43,8 +42,6 @@
 import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.openejb.DeploymentInfo;
 
-import org.w3c.dom.Element;
-
 public class EJBEndpoint extends CXFEndpoint {
     
     public EJBEndpoint(Bus bus,
@@ -73,10 +70,12 @@
         service = serviceFactory.create();        
     }
     
+    @Override
     protected Class getImplementorClass() {
         return (Class)this.implementor;
     }
     
+    @Override
     protected void init() {
         // configure handlers
         try {
@@ -118,6 +117,7 @@
         } 
     }
     
+    @Override
     public synchronized void injectHandlers() {
         if (this.annotationProcessor != null) {
             // assume injection was already done
@@ -136,6 +136,7 @@
         super.injectHandlers();
     }
     
+    @Override
     public void stop() {
         // call handler preDestroy
         destroyHandlers();
@@ -143,14 +144,5 @@
         // shutdown server
         super.stop();
     }
-
-    public EndpointReference getEndpointReference(Element... referenceParameters) {
-        throw new UnsupportedOperationException();
-    }
-
-    public <T extends EndpointReference> T getEndpointReference(Class<T> clazz,
-                                                                Element... referenceParameters)
{
-        throw new UnsupportedOperationException();
-    }
     
 }

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceContainer.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceContainer.java
Wed Aug 27 15:53:15 2008
@@ -33,7 +33,7 @@
         assert target != null : "null target received";
 
         EJBEndpoint ep = new EJBEndpoint(bus, configurationBaseUrl, (Class)target);
-        ep.publish("http://nopath");
+        ep.publish(null);
         return ep;
     }
 

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
Wed Aug 27 15:53:15 2008
@@ -19,14 +19,12 @@
 package org.apache.geronimo.cxf;
 
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.Executor;
 
-import javax.xml.transform.Source;
 import javax.xml.ws.Binding;
-import javax.xml.ws.Endpoint;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.http.HTTPBinding;
@@ -48,7 +46,7 @@
 import org.apache.geronimo.jaxws.handler.GeronimoHandlerResolver;
 import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
 
-public abstract class CXFEndpoint extends Endpoint {
+public abstract class CXFEndpoint {
 
     protected Bus bus;
 
@@ -65,6 +63,8 @@
     protected PortInfo portInfo;
     
     protected AnnotationProcessor annotationProcessor;
+    
+    private String address; 
 
     public CXFEndpoint(Bus bus, Object implementor) {
         this.bus = bus;
@@ -129,47 +129,18 @@
         return service.getExecutor();
     }
 
-    @Override
     public Object getImplementor() {
         return implementor;
     }
 
-    @Override
-    public List<Source> getMetadata() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Map<String, Object> getProperties() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public boolean isPublished() {
         return server != null;
     }
 
-    @Override
-    public void publish(Object arg0) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
     public void publish(String address) {
         doPublish(address);
     }
 
-    public void setMetadata(List<Source> arg0) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void setProperties(Map<String, Object> arg0) {
-        // TODO Auto-generated method stub
-    }
-
     private static class GeronimoJaxWsServerFactoryBean extends JaxWsServerFactoryBean {
         public GeronimoJaxWsServerFactoryBean() {
             // disable CXF resource injection
@@ -177,10 +148,13 @@
         }
     }
     
-    protected void doPublish(String address) {
+    protected void doPublish(String baseAddress) {      
+        // XXX: assume port 8080 by default since we don't know the actual port at startup
+        String address = (baseAddress == null) ? "http://localhost:8080" : baseAddress;
+        
         JaxWsServerFactoryBean svrFactory = new GeronimoJaxWsServerFactoryBean();
         svrFactory.setBus(bus);
-        svrFactory.setAddress(address);
+        svrFactory.setAddress(address + this.portInfo.getLocation());
         svrFactory.setServiceFactory(serviceFactory);
         svrFactory.setStart(false);
         svrFactory.setServiceBean(implementor);
@@ -199,13 +173,6 @@
             ((SOAPBinding)getBinding()).setMTOMEnabled(this.portInfo.isMTOMEnabled());
         }
         
-        /**
-        if (endpoint.getEnableSchemaValidation()) {
-            endpoint.ge
-            endpoint.put(Message.SCHEMA_VALIDATION_ENABLED, 
-                         endpoint.getEnableSchemaValidation());
-        }
-        **/
         server.start();
     }
 
@@ -213,6 +180,18 @@
     }
           
     /*
+     * Update service's address on the very first invocation. The address 
+     * assumed at start up might not be valid.
+     */
+    synchronized void updateAddress(URI request) {
+        if (this.address == null) {
+            String requestAddress = request.getScheme() + "://" + request.getHost() + ":"
+ request.getPort() + request.getPath();
+            getEndpoint().getEndpointInfo().setAddress(requestAddress);
+            this.address = requestAddress;
+        }
+    }
+    
+    /*
      * Set appropriate handlers for the port/service/bindings.
      */
     protected void initHandlers() throws Exception {        
@@ -258,7 +237,7 @@
             }
         }
     }
-    
+        
     public void stop() {        
         // shutdown server
         if (this.server != null) {

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
Wed Aug 27 15:53:15 2008
@@ -77,6 +77,7 @@
     }
 
     public void invoke(Request request, Response response) throws Exception {
+        this.endpoint.updateAddress(request.getURI());
         if (request.getMethod() == Request.GET) {
             processGET(request, response);
         } else {

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
Wed Aug 27 15:53:15 2008
@@ -57,7 +57,7 @@
     public GeronimoDestination(Bus bus, 
                                ConduitInitiator conduitInitiator, 
                                EndpointInfo endpointInfo) throws IOException {
-        super(bus, conduitInitiator, endpointInfo, true);
+        super(bus, conduitInitiator, endpointInfo, false);
     }
 
     public void setPassSecurityContext(boolean passSecurityContext) {

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
Wed Aug 27 15:53:15 2008
@@ -21,11 +21,8 @@
 import java.net.URL;
 
 import javax.naming.Context;
-import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceException;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.cxf.Bus;
 import org.apache.cxf.jaxws.JAXWSMethodInvoker;
 import org.apache.cxf.jaxws.context.WebServiceContextImpl;
@@ -36,8 +33,8 @@
 import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
 import org.apache.geronimo.jaxws.JNDIResolver;
 import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
-
-import org.w3c.dom.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class POJOEndpoint extends CXFEndpoint {
 
@@ -89,6 +86,7 @@
         this.annotationProcessor = new JAXWSAnnotationProcessor(jndiResolver, new WebServiceContextImpl());
     }
     
+    @Override
     protected void init() {        
         // configure and inject handlers
         try {
@@ -99,6 +97,7 @@
         }
     }
 
+    @Override
     public void stop() {
         // call handler preDestroy
         destroyHandlers();
@@ -116,13 +115,4 @@
         super.stop();
     }
 
-    public EndpointReference getEndpointReference(Element... referenceParameters) {
-        throw new UnsupportedOperationException();
-    }
-
-    public <T extends EndpointReference> T getEndpointReference(Class<T> clazz,
-                                                                Element... referenceParameters)
{
-        throw new UnsupportedOperationException();
-    }
-
 }

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java?rev=689648&r1=689647&r2=689648&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
Wed Aug 27 15:53:15 2008
@@ -35,7 +35,7 @@
         assert target != null : "null target received";
 
         POJOEndpoint ep = new POJOEndpoint(bus, configurationBaseUrl, (Class)target);
-        ep.publish("http://nopath");
+        ep.publish(null);
         return ep;
     }
 



Mime
View raw message