cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r505266 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/transports/http/ rt/core/src/main/java/org/apache/cxf/transport/http/ rt/core/src/main/resources/META-INF/ rt/core/src/main/resources/META-INF/cxf/ rt/transports/http/src/m...
Date Fri, 09 Feb 2007 12:16:55 GMT
Author: seanoc
Date: Fri Feb  9 04:16:54 2007
New Revision: 505266

URL: http://svn.apache.org/viewvc?view=rev&rev=505266
Log:
Moved files from cxf-rt-transport-http to cxf-rt-core.
Added method to allow QueryHandlers to be added in specific order within QueryHandlerRegistry

Added:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Removed:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandler.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandlerRegistry.java
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandler.java?view=diff&rev=505266&r1=505265&r2=505266
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandler.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandler.java
Fri Feb  9 04:16:54 2007
@@ -26,7 +26,7 @@
 public interface QueryHandler {
     
     /**
-     * @param URI the target URI
+     * @param uri the target URI
      * @param endpoint the current endpoint for this context (e.g. the endpoint this
      * Destination was activated for). Null if no current endpoint.
      * @return true iff the URI is a recognized WSDL query

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandlerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandlerRegistry.java?view=diff&rev=505266&r1=505265&r2=505266
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandlerRegistry.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transports/http/QueryHandlerRegistry.java
Fri Feb  9 04:16:54 2007
@@ -27,6 +27,11 @@
      * Register QueryHandler with registry
      */ 
     void registerHandler(QueryHandler handler);
+
+    /**
+    * Register QueryHandler with registry in a specified position in the list
+    */ 
+    void regsisterHandler(QueryHandler handler, int position);
     
     /**
      * Returns list of QueryHandlers

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java?view=auto&rev=505266
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
Fri Feb  9 04:16:54 2007
@@ -0,0 +1,73 @@
+/**
+ * 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.cxf.transport.http;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.transports.http.QueryHandler;
+import org.apache.cxf.transports.http.QueryHandlerRegistry;
+
+public class QueryHandlerRegistryImpl implements QueryHandlerRegistry {
+    
+    List<QueryHandler> queryHandlers;
+    Bus bus;
+    
+    @PostConstruct
+    public void register() {
+        if (null != bus) {
+            bus.setExtension(this, QueryHandlerRegistry.class);
+        }
+    }
+    
+    @PostConstruct
+    public void init() {
+        queryHandlers = new ArrayList<QueryHandler>();
+        registerHandler(new WSDLQueryHandler());
+    }
+
+
+    public List<QueryHandler> getHandlers() {
+        return queryHandlers;
+    }
+
+    public void registerHandler(QueryHandler handler) {
+        queryHandlers.add(handler);
+    }
+
+    public void regsisterHandler(QueryHandler handler, int position) {
+        queryHandlers.add(position, handler);
+    }
+    
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+
+    public Bus getBus() {
+        return bus;
+    }
+
+}
+

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?view=auto&rev=505266
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Fri Feb  9 04:16:54 2007
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.transport.http;
+
+import java.io.OutputStream;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transports.http.QueryHandler;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+
+public class WSDLQueryHandler implements QueryHandler {
+
+    public String getResponseContentType(String uri) {
+        if (uri.toLowerCase().endsWith("?wsdl")) {
+            return "text/xml";
+        }
+        return null;
+    }
+
+    public boolean isRecognizedQuery(String uri, EndpointInfo endpointInfo) {
+        if (uri != null && uri.toLowerCase().endsWith("?wsdl")) {
+            String addressContext = uri.substring(0, uri.length() - 5);            
+            return endpointInfo.getAddress().contains(addressContext);
+        }
+        return false;
+    }
+
+    public void writeResponse(String queryURI, EndpointInfo endpointInfo, OutputStream os)
{
+        try {
+            WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
+            Definition def = new ServiceWSDLBuilder(endpointInfo.getService()).build();
+            wsdlWriter.writeWSDL(def, os);
+        } catch (WSDLException wex) {
+            wex.printStackTrace();
+        }
+    }
+
+}

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=505266&r1=505265&r2=505266
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/bus-extensions.xml Fri Feb  9
04:16:54 2007
@@ -35,5 +35,7 @@
        	   interface="org.apache.cxf.buslifecycle.BusLifeCycleManager"/>   	   
     <extension class="org.apache.cxf.endpoint.ServerRegistryImpl"
        	   interface="org.apache.cxf.endpoint.ServerRegistry"/>
+    <extension class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl"
+       	   interface="org.apache.cxf.transports.http.QueryHandlerRegistry"/> 
            
 </extensions>

Modified: incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?view=diff&rev=505266&r1=505265&r2=505266
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ incubator/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Fri Feb  9 04:16:54
2007
@@ -90,5 +90,9 @@
     <bean id="org.apache.cxf.endpoint.ServerLifeCycleManager" class="org.apache.cxf.endpoint.ServerLifeCycleManagerImpl">
         <property name="bus" ref="cxf"/>
     </bean>
+
+    <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry" class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
+        <property name="bus" ref="cxf"/>
+    </bean>
     
 </beans>

Modified: incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=505266&r1=505265&r2=505266
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/bus-extensions.xml
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/bus-extensions.xml
Fri Feb  9 04:16:54 2007
@@ -27,6 +27,4 @@
         <namespace>http://cxf.apache.org/transports/http/configuration</namespace>
         <namespace>http://cxf.apache.org/bindings/xformat</namespace>
     </extension>
-    <extension class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl"
-       	   interface="org.apache.cxf.transports.http.QueryHandlerRegistry"/>   
 </extensions>

Modified: incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml?view=diff&rev=505266&r1=505265&r2=505266
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
Fri Feb  9 04:16:54 2007
@@ -36,7 +36,4 @@
             </list>
         </property>
     </bean>
-    <bean id="org.apache.cxf.transports.http.QueryHandlerRegistry" class="org.apache.cxf.transport.http.QueryHandlerRegistryImpl">
-        <property name="bus" ref="cxf"/>
-    </bean>
 </beans>



Mime
View raw message