You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/02/08 15:31:47 UTC
svn commit: r1068418 - in /cxf/trunk:
api/src/main/java/org/apache/cxf/service/model/
api/src/main/java/org/apache/cxf/wsdl/
rt/core/src/main/java/org/apache/cxf/binding/
rt/core/src/main/java/org/apache/cxf/transport/
rt/core/src/main/java/org/apache/...
Author: sergeyb
Date: Tue Feb 8 14:31:47 2011
New Revision: 1068418
URL: http://svn.apache.org/viewvc?rev=1068418&view=rev
Log:
[CXF-3021] Dropping a strong dependency on wsdl4j for JAX-RS services
Added:
cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java (with props)
cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java (with props)
cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java (with props)
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java Tue Feb 8 14:31:47 2011
@@ -22,7 +22,7 @@ package org.apache.cxf.service.model;
import javax.xml.namespace.QName;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.cxf.wsdl.WSAEndpointReferenceUtils;
/**
* The EndpointInfo contains the information for a web service 'port' inside of a service.
@@ -87,9 +87,9 @@ public class EndpointInfo extends Abstra
public void setAddress(String addr) {
if (null == address) {
- address = EndpointReferenceUtils.getEndpointReference(addr);
+ address = WSAEndpointReferenceUtils.getEndpointReference(addr);
} else {
- EndpointReferenceUtils.setAddress(address, addr);
+ WSAEndpointReferenceUtils.setAddress(address, addr);
}
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Tue Feb 8 14:31:47 2011
@@ -229,8 +229,8 @@ public final class EndpointReferenceUtil
}
}
- public static final String ANONYMOUS_ADDRESS = "http://www.w3.org/2005/08/addressing/anonymous";
-
+ public static final String ANONYMOUS_ADDRESS = WSAEndpointReferenceUtils.ANONYMOUS_ADDRESS;
+
private static final Logger LOG = LogUtils.getL7dLogger(EndpointReferenceUtils.class);
private static final String NS_WSAW_2005 = "http://www.w3.org/2005/02/addressing/wsdl";
@@ -257,9 +257,6 @@ public final class EndpointReferenceUtil
private static final org.apache.cxf.ws.addressing.wsdl.ObjectFactory WSA_WSDL_OBJECT_FACTORY =
new org.apache.cxf.ws.addressing.wsdl.ObjectFactory();
- private static final org.apache.cxf.ws.addressing.ObjectFactory WSA_OBJECT_FACTORY =
- new org.apache.cxf.ws.addressing.ObjectFactory();
-
private EndpointReferenceUtils() {
// Utility class - never constructed
@@ -276,11 +273,7 @@ public final class EndpointReferenceUtil
String portName) {
if (null != serviceName) {
JAXBElement<ServiceNameType> jaxbElement = getServiceNameType(serviceName, portName);
- MetadataType mt = ref.getMetadata();
- if (null == mt) {
- mt = new MetadataType();
- ref.setMetadata(mt);
- }
+ MetadataType mt = WSAEndpointReferenceUtils.getSetMetadata(ref);
mt.getAny().add(jaxbElement);
}
@@ -417,11 +410,7 @@ public final class EndpointReferenceUtil
JAXBElement<AttributedQNameType> jaxbElement =
WSA_WSDL_OBJECT_FACTORY.createInterfaceName(interfaceNameType);
- MetadataType mt = ref.getMetadata();
- if (null == mt) {
- mt = WSA_OBJECT_FACTORY.createMetadataType();
- ref.setMetadata(mt);
- }
+ MetadataType mt = WSAEndpointReferenceUtils.getSetMetadata(ref);
mt.getAny().add(jaxbElement);
}
}
@@ -495,11 +484,7 @@ public final class EndpointReferenceUtil
public static void setWSDLLocation(EndpointReferenceType ref, String... wsdlLocation) {
- MetadataType metadata = ref.getMetadata();
- if (null == metadata) {
- metadata = WSA_OBJECT_FACTORY.createMetadataType();
- ref.setMetadata(metadata);
- }
+ MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(ref);
//wsdlLocation attribute is a list of anyURI.
StringBuilder strBuf = new StringBuilder();
@@ -541,11 +526,7 @@ public final class EndpointReferenceUtil
throws EndpointUtilsException {
if (null != ref) {
- MetadataType mt = ref.getMetadata();
- if (null == mt) {
- mt = new MetadataType();
- ref.setMetadata(mt);
- }
+ MetadataType mt = WSAEndpointReferenceUtils.getSetMetadata(ref);
List<Object> anyList = mt.getAny();
try {
for (Source source : metadata) {
@@ -819,13 +800,7 @@ public final class EndpointReferenceUtil
* @return String the address of the endpoint
*/
public static String getAddress(EndpointReferenceType ref) {
- AttributedURIType a = ref.getAddress();
-
- if (null != a) {
- return a.getValue();
- }
- // should wsdl be parsed for an address now?
- return null;
+ return WSAEndpointReferenceUtils.getAddress(ref);
}
/**
@@ -834,9 +809,7 @@ public final class EndpointReferenceUtil
* @param address - the address
*/
public static void setAddress(EndpointReferenceType ref, String address) {
- AttributedURIType a = WSA_OBJECT_FACTORY.createAttributedURIType();
- a.setValue(address);
- ref.setAddress(a);
+ WSAEndpointReferenceUtils.setAddress(ref, address);
}
/**
* Create an endpoint reference for the provided wsdl, service and portname.
@@ -848,8 +821,8 @@ public final class EndpointReferenceUtil
public static EndpointReferenceType getEndpointReference(URL wsdlUrl,
QName serviceName,
String portName) {
- EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
- reference.setMetadata(WSA_OBJECT_FACTORY.createMetadataType());
+ EndpointReferenceType reference =
+ WSAEndpointReferenceUtils.createEndpointReferenceWithMetadata();
setServiceAndPortName(reference, serviceName, portName);
//TODO To Ensure it is a valid URI syntax.
setWSDLLocation(reference, wsdlUrl.toString());
@@ -865,11 +838,7 @@ public final class EndpointReferenceUtil
*/
public static EndpointReferenceType duplicate(EndpointReferenceType ref) {
- EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
- reference.setMetadata(ref.getMetadata());
- reference.getAny().addAll(ref.getAny());
- reference.setAddress(ref.getAddress());
- return reference;
+ return WSAEndpointReferenceUtils.duplicate(ref);
}
/**
@@ -879,16 +848,12 @@ public final class EndpointReferenceUtil
*/
public static EndpointReferenceType getEndpointReference(String address) {
- EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
- setAddress(reference, address);
- return reference;
+ return WSAEndpointReferenceUtils.getEndpointReference(address);
}
public static EndpointReferenceType getEndpointReference(AttributedURIType address) {
- EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
- reference.setAddress(address);
- return reference;
+ return WSAEndpointReferenceUtils.getEndpointReference(address);
}
/**
@@ -897,9 +862,7 @@ public final class EndpointReferenceUtil
*/
public static EndpointReferenceType getAnonymousEndpointReference() {
- EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
- setAddress(reference, ANONYMOUS_ADDRESS);
- return reference;
+ return WSAEndpointReferenceUtils.getAnonymousEndpointReference();
}
/**
@@ -1027,8 +990,9 @@ public final class EndpointReferenceUtil
public static Source convertToXML(EndpointReferenceType epr) {
try {
JAXBContext jaxbContext =
- JAXBContext.newInstance(new Class[] {WSA_WSDL_OBJECT_FACTORY.getClass(),
- WSA_OBJECT_FACTORY.getClass()});
+ JAXBContext.newInstance(new Class[] {
+ WSA_WSDL_OBJECT_FACTORY.getClass(),
+ WSAEndpointReferenceUtils.WSA_OBJECT_FACTORY.getClass()});
javax.xml.bind.Marshaller jm = jaxbContext.createMarshaller();
jm.setProperty(Marshaller.JAXB_FRAGMENT, true);
QName qname = new QName("http://www.w3.org/2005/08/addressing", "EndpointReference");
Added: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java?rev=1068418&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java Tue Feb 8 14:31:47 2011
@@ -0,0 +1,128 @@
+/**
+ * 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.wsdl;
+
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.MetadataType;
+
+/**
+ * Provides utility methods for obtaining endpoint references, wsdl definitions, etc.
+ */
+public final class WSAEndpointReferenceUtils {
+
+ public static final String ANONYMOUS_ADDRESS = "http://www.w3.org/2005/08/addressing/anonymous";
+ static final org.apache.cxf.ws.addressing.ObjectFactory WSA_OBJECT_FACTORY =
+ new org.apache.cxf.ws.addressing.ObjectFactory();
+
+
+ private WSAEndpointReferenceUtils() {
+ // Utility class - never constructed
+ }
+
+ public static EndpointReferenceType createEndpointReferenceWithMetadata() {
+ EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+ reference.setMetadata(WSA_OBJECT_FACTORY.createMetadataType());
+ return reference;
+ }
+
+ public static MetadataType getSetMetadata(EndpointReferenceType ref) {
+ MetadataType mt = ref.getMetadata();
+ if (null == mt) {
+ mt = WSA_OBJECT_FACTORY.createMetadataType();
+ ref.setMetadata(mt);
+ }
+ return mt;
+ }
+
+
+ /**
+ * Set the address of the provided endpoint reference.
+ * @param ref - the endpoint reference
+ * @param address - the address
+ */
+ public static void setAddress(EndpointReferenceType ref, String address) {
+ AttributedURIType a = WSA_OBJECT_FACTORY.createAttributedURIType();
+ a.setValue(address);
+ ref.setAddress(a);
+ }
+
+ /**
+ * Get the address from the provided endpoint reference.
+ * @param ref - the endpoint reference
+ * @return String the address of the endpoint
+ */
+ public static String getAddress(EndpointReferenceType ref) {
+ AttributedURIType a = ref.getAddress();
+
+ if (null != a) {
+ return a.getValue();
+ }
+ // should wsdl be parsed for an address now?
+ return null;
+ }
+
+ /**
+ * Create a duplicate endpoint reference sharing all atributes
+ * @param ref the reference to duplicate
+ * @return EndpointReferenceType - the duplicate endpoint reference
+ */
+ public static EndpointReferenceType duplicate(EndpointReferenceType ref) {
+
+ EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+ reference.setMetadata(ref.getMetadata());
+ reference.getAny().addAll(ref.getAny());
+ reference.setAddress(ref.getAddress());
+ return reference;
+ }
+
+ /**
+ * Create an endpoint reference for the provided address.
+ * @param address - address URI
+ * @return EndpointReferenceType - the endpoint reference
+ */
+ public static EndpointReferenceType getEndpointReference(String address) {
+
+ EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+ setAddress(reference, address);
+ return reference;
+ }
+
+ public static EndpointReferenceType getEndpointReference(AttributedURIType address) {
+
+ EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+ reference.setAddress(address);
+ return reference;
+ }
+
+ /**
+ * Create an anonymous endpoint reference.
+ * @return EndpointReferenceType - the endpoint reference
+ */
+ public static EndpointReferenceType getAnonymousEndpointReference() {
+
+ EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+ setAddress(reference, ANONYMOUS_ADDRESS);
+ return reference;
+ }
+
+}
+
+
Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/WSAEndpointReferenceUtils.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java?rev=1068418&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java Tue Feb 8 14:31:47 2011
@@ -0,0 +1,121 @@
+/**
+ * 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.binding;
+
+import java.util.Collection;
+
+import javax.annotation.Resource;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.Destination;
+
+public abstract class AbstractBaseBindingFactory implements BindingFactory {
+
+ protected Collection<String> activationNamespaces;
+
+ protected Bus bus;
+
+ public AbstractBaseBindingFactory() {
+ }
+
+ public AbstractBaseBindingFactory(Collection<String> ns) {
+ activationNamespaces = ns;
+ }
+ public AbstractBaseBindingFactory(Bus b) {
+ bus = b;
+ registerWithBindingManager();
+ }
+
+ public AbstractBaseBindingFactory(Bus b, Collection<String> ns) {
+ activationNamespaces = ns;
+ bus = b;
+ registerWithBindingManager();
+ }
+
+ private void registerWithBindingManager() {
+ if (bus != null && activationNamespaces != null) {
+ BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
+ for (String ns : activationNamespaces) {
+ manager.registerBindingFactory(ns, this);
+ }
+ }
+ }
+
+ /**
+ * Creates a "default" BindingInfo object for the service. Called by
+ * createBindingInfo(Service service, String binding, Object config) to actually
+ * create the BindingInfo. Can return a subclass which can then process
+ * the extensors within the subclass.
+ * @param service
+ * @return
+ */
+ public BindingInfo createBindingInfo(ServiceInfo service, String namespace, Object config) {
+ return new BindingInfo(service, namespace);
+ }
+
+ /**
+ * Creates a "default" BindingInfo object for the service. Can return a subclass
+ * which can then process the extensors within the subclass. By default, just
+ * creates it for the first ServiceInfo in the service
+ */
+ public BindingInfo createBindingInfo(Service service, String namespace, Object config) {
+ BindingInfo bi = createBindingInfo(service.getServiceInfos().get(0), namespace, config);
+ if (bi.getName() == null) {
+ bi.setName(new QName(service.getName().getNamespaceURI(),
+ service.getName().getLocalPart() + "Binding"));
+ }
+ return bi;
+ }
+
+
+ public void addListener(Destination d, Endpoint e) {
+ ChainInitiationObserver observer = new ChainInitiationObserver(e, bus);
+
+ d.setMessageObserver(observer);
+ }
+
+ public Bus getBus() {
+ return bus;
+ }
+
+ @Resource
+ public void setBus(Bus bus) {
+ if (this.bus != bus) {
+ this.bus = bus;
+ registerWithBindingManager();
+ }
+ }
+
+ public Collection<String> getActivationNamespaces() {
+ return activationNamespaces;
+ }
+
+ public void setActivationNamespaces(Collection<String> activationNamespaces) {
+ this.activationNamespaces = activationNamespaces;
+ registerWithBindingManager();
+ }
+
+}
Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBaseBindingFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java Tue Feb 8 14:31:47 2011
@@ -21,7 +21,6 @@ package org.apache.cxf.binding;
import java.util.Collection;
-import javax.annotation.Resource;
import javax.wsdl.Binding;
import javax.wsdl.BindingFault;
import javax.wsdl.BindingInput;
@@ -32,77 +31,33 @@ import javax.wsdl.extensions.Extensibili
import javax.xml.namespace.QName;
import org.apache.cxf.Bus;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.AbstractPropertiesHolder;
import org.apache.cxf.service.model.BindingInfo;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.transport.ChainInitiationObserver;
-import org.apache.cxf.transport.Destination;
import org.apache.cxf.wsdl11.WSDLBindingFactory;
import static org.apache.cxf.helpers.CastUtils.cast;
-public abstract class AbstractBindingFactory implements BindingFactory, WSDLBindingFactory {
-
- protected Collection<String> activationNamespaces;
-
- protected Bus bus;
+public abstract class AbstractBindingFactory extends AbstractBaseBindingFactory
+ implements WSDLBindingFactory {
public AbstractBindingFactory() {
}
public AbstractBindingFactory(Collection<String> ns) {
- activationNamespaces = ns;
+ super(ns);
}
+
public AbstractBindingFactory(Bus b) {
- bus = b;
- registerWithBindingManager();
+ super(b);
}
public AbstractBindingFactory(Bus b, Collection<String> ns) {
- activationNamespaces = ns;
- bus = b;
- registerWithBindingManager();
+ super(b, ns);
}
- private void registerWithBindingManager() {
- if (bus != null && activationNamespaces != null) {
- BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
- for (String ns : activationNamespaces) {
- manager.registerBindingFactory(ns, this);
- }
- }
- }
-
- /**
- * Creates a "default" BindingInfo object for the service. Called by
- * createBindingInfo(Service service, String binding, Object config) to actually
- * create the BindingInfo. Can return a subclass which can then process
- * the extensors within the subclass.
- * @param service
- * @return
- */
- public BindingInfo createBindingInfo(ServiceInfo service, String namespace, Object config) {
- return new BindingInfo(service, namespace);
- }
-
- /**
- * Creates a "default" BindingInfo object for the service. Can return a subclass
- * which can then process the extensors within the subclass. By default, just
- * creates it for the first ServiceInfo in the service
- */
- public BindingInfo createBindingInfo(Service service, String namespace, Object config) {
- BindingInfo bi = createBindingInfo(service.getServiceInfos().get(0), namespace, config);
- if (bi.getName() == null) {
- bi.setName(new QName(service.getName().getNamespaceURI(),
- service.getName().getLocalPart() + "Binding"));
- }
- return bi;
- }
-
-
+
/**
* Copies extensors from the Binding to BindingInfo.
* @param service
@@ -175,31 +130,4 @@ public abstract class AbstractBindingFac
boolean isInput) {
}
- public void addListener(Destination d, Endpoint e) {
- ChainInitiationObserver observer = new ChainInitiationObserver(e, bus);
-
- d.setMessageObserver(observer);
- }
-
- public Bus getBus() {
- return bus;
- }
-
- @Resource
- public void setBus(Bus bus) {
- if (this.bus != bus) {
- this.bus = bus;
- registerWithBindingManager();
- }
- }
-
- public Collection<String> getActivationNamespaces() {
- return activationNamespaces;
- }
-
- public void setActivationNamespaces(Collection<String> activationNamespaces) {
- this.activationNamespaces = activationNamespaces;
- registerWithBindingManager();
- }
-
}
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractDestination.java Tue Feb 8 14:31:47 2011
@@ -26,7 +26,7 @@ import org.apache.cxf.Bus;
import org.apache.cxf.message.Message;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.cxf.wsdl.WSAEndpointReferenceUtils;
/**
* Abstract base class factoring out common Destination logic,
@@ -100,7 +100,7 @@ public abstract class AbstractDestinatio
protected abstract class AbstractBackChannelConduit extends AbstractConduit {
public AbstractBackChannelConduit() {
- super(EndpointReferenceUtils.getAnonymousEndpointReference());
+ super(WSAEndpointReferenceUtils.getAnonymousEndpointReference());
}
/**
Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java?rev=1068418&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java (added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java Tue Feb 8 14:31:47 2011
@@ -0,0 +1,44 @@
+/**
+ * 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.wsdl;
+
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+
+public final class WSDLLibrary {
+ private static final boolean AVAILABLE;
+
+ static {
+ boolean libraryAvailable = true;
+ try {
+ ClassLoaderUtils.loadClass("javax.wsdl.Definition", WSDLLibrary.class);
+ } catch (Throwable ex) {
+ libraryAvailable = false;
+ }
+ AVAILABLE = libraryAvailable;
+ }
+
+ private WSDLLibrary() {
+
+ }
+
+ public static boolean isAvailable() {
+ return AVAILABLE;
+ }
+}
Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl/WSDLLibrary.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java Tue Feb 8 14:31:47 2011
@@ -20,7 +20,7 @@ package org.apache.cxf.jaxrs;
import org.apache.cxf.Bus;
-import org.apache.cxf.binding.AbstractBindingFactory;
+import org.apache.cxf.binding.AbstractBaseBindingFactory;
import org.apache.cxf.binding.Binding;
import org.apache.cxf.binding.xml.XMLBinding;
import org.apache.cxf.binding.xml.interceptor.XMLFaultOutInterceptor;
@@ -31,9 +31,12 @@ import org.apache.cxf.jaxrs.interceptor.
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingInfo;
-
+/**
+ * The CXF BindingFactory implementation which is used to register
+ * CXF JAX-RS interceptors with the runtime.
+ */
@NoJSR250Annotations(unlessNull = { "bus" })
-public class JAXRSBindingFactory extends AbstractBindingFactory {
+public class JAXRSBindingFactory extends AbstractBaseBindingFactory {
public static final String JAXRS_BINDING_ID = "http://apache.org/cxf/binding/jaxrs";
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Tue Feb 8 14:31:47 2011
@@ -73,6 +73,7 @@ import org.apache.cxf.ws.addressing.Endp
import org.apache.cxf.ws.policy.Assertor;
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import org.apache.cxf.wsdl.WSDLLibrary;
/**
* Common base for HTTP Destination implementations.
@@ -369,7 +370,7 @@ public abstract class AbstractHTTPDestin
&& null != endpointInfo.getService()) {
server = PolicyUtils.getServer(engine, endpointInfo, this);
}
- if (null == server) {
+ if (null == server && WSDLLibrary.isAvailable()) {
server = endpointInfo.getTraversedExtensor(
new HTTPServerPolicy(), HTTPServerPolicy.class);
}
@@ -417,8 +418,9 @@ public abstract class AbstractHTTPDestin
}
cacheInput(outMessage);
-
- new Headers(outMessage).setFromServerPolicy(server);
+ if (server != null) {
+ new Headers(outMessage).setFromServerPolicy(server);
+ }
OutputStream responseStream = null;
boolean oneWay = isOneWay(outMessage);
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=1068418&r1=1068417&r2=1068418&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Tue Feb 8 14:31:47 2011
@@ -39,6 +39,7 @@ import org.apache.cxf.transport.http.Abs
import org.apache.cxf.transport.http.DestinationRegistry;
import org.apache.cxf.transports.http.QueryHandler;
import org.apache.cxf.transports.http.QueryHandlerRegistry;
+import org.apache.cxf.wsdl.WSDLLibrary;
import org.apache.cxf.wsdl.http.AddressType;
public class ServletController extends AbstractServletController {
@@ -82,7 +83,8 @@ public class ServletController extends A
request.setAttribute("org.apache.cxf.transport.endpoint.address", base + path);
} else {
d2.getEndpointInfo().setAddress(base + path);
- if (d2.getEndpointInfo().getExtensor(AddressType.class) != null) {
+ if (WSDLLibrary.isAvailable()
+ && d2.getEndpointInfo().getExtensor(AddressType.class) != null) {
d2.getEndpointInfo().getExtensor(AddressType.class).setLocation(base + path);
}
}