Author: dkulp
Date: Mon Mar 10 19:57:11 2008
New Revision: 635786
URL: http://svn.apache.org/viewvc?rev=635786&view=rev
Log:
Merged revisions 634052 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r634052 | dkulp | 2008-03-05 17:09:05 -0500 (Wed, 05 Mar 2008) | 2 lines
Be a little more defensive against null addresses in the Conduit. Create
invoker up front to avoid it being created twice.
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=635786&r1=635785&r2=635786&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Mon Mar 10 19:57:11 2008
@@ -104,6 +104,11 @@
if (serviceBean != null && getServiceClass() == null) {
setServiceClass(serviceBean.getClass());
}
+ if (invoker != null) {
+ getServiceFactory().setInvoker(invoker);
+ } else if (serviceBean != null) {
+ getServiceFactory().setInvoker(createInvoker());
+ }
Endpoint ep = createEndpoint();
server = new ServerImpl(getBus(),
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=635786&r1=635785&r2=635786&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Mon Mar 10 19:57:11 2008
@@ -657,6 +657,10 @@
}
}
protected Invoker createInvoker() {
+ Class<?> cls = getServiceClass();
+ if (cls.isInterface()) {
+ return null;
+ }
return new FactoryInvoker(new LocalFactory(getServiceClass()), new
ApplicationScopePolicy());
}
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=635786&r1=635785&r2=635786&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Mon Mar 10 19:57:11 2008
@@ -192,17 +192,13 @@
*/
private final EndpointInfo endpointInfo;
- /**
- * This field holds the "default" address for this particular conduit,
which
- * is set at construction.
- */
- private final String defaultEndpointAddress;
/**
* This field holds the "default" URL for this particular conduit, which
* is created on demand.
*/
private URL defaultEndpointURL;
+ private boolean fromEndpointReferenceType;
private Destination decoupledDestination;
private MessageObserver decoupledObserver;
@@ -290,9 +286,9 @@
bus = b;
endpointInfo = ei;
- defaultEndpointAddress = t == null
- ? ei.getAddress()
- : t.getAddress().getValue();
+ if (t != null) {
+ fromEndpointReferenceType = true;
+ }
initializeConfig();
}
@@ -666,11 +662,13 @@
* @throws MalformedURLException
*/
private URL setupURL(Message message) throws MalformedURLException {
- String value = (String)message.get(Message.ENDPOINT_ADDRESS);
+ String result = (String)message.get(Message.ENDPOINT_ADDRESS);
String pathInfo = (String)message.get(Message.PATH_INFO);
String queryString = (String)message.get(Message.QUERY_STRING);
-
- String result = value != null ? value : getURL().toString();
+ if (result == null) {
+ result = getURL().toString();
+
+ }
// REVISIT: is this really correct?
if (null != pathInfo && !result.endsWith(pathInfo)) {
@@ -724,7 +722,12 @@
* @return the default target address
*/
protected String getAddress() throws MalformedURLException {
- return defaultEndpointAddress;
+ if (defaultEndpointURL != null) {
+ return defaultEndpointURL.toExternalForm();
+ } else if (fromEndpointReferenceType) {
+ return getTarget().getAddress().getValue();
+ }
+ return endpointInfo.getAddress();
}
/**
@@ -741,7 +744,14 @@
protected synchronized URL getURL(boolean createOnDemand)
throws MalformedURLException {
if (defaultEndpointURL == null && createOnDemand) {
- defaultEndpointURL = new URL(defaultEndpointAddress);
+ if (fromEndpointReferenceType &&
getTarget().getAddress().getValue() != null) {
+ defaultEndpointURL = new
URL(this.getTarget().getAddress().getValue());
+ return defaultEndpointURL;
+ }
+ if (endpointInfo.getAddress() == null) {
+ throw new MalformedURLException("Invalid address. Endpoint
address cannot be null.");
+ }
+ defaultEndpointURL = new URL(endpointInfo.getAddress());
}
return defaultEndpointURL;
}