Author: dkulp
Date: Thu Jun 19 13:27:56 2008
New Revision: 669678
URL: http://svn.apache.org/viewvc?rev=669678&view=rev
Log:
Merged revisions 669671 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r669671 | dkulp | 2008-06-19 16:14:28 -0400 (Thu, 19 Jun 2008) | 4 lines
[CXF-1660, CXF-1661] Don't register nested beans as root beans.
Fix problems of trying to use <soap:soapBinding style="rpc"/> configuration
to configure frontend for rpc.
Cache a bunch few things in the RSFB to avoid looking up the same thing
(isWrapped and isRPC) a bunch of times for each method.
........
Modified:
cxf/branches/2.0.x-fixes/ (props changed)
cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingConfiguration.java
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/binding/soap/JaxWsSoapBindingConfiguration.java
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
(original)
+++
cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
Thu Jun 19 13:27:56 2008
@@ -173,13 +173,7 @@
protected void setFirstChildAsProperty(Element element, ParserContext ctx,
BeanDefinitionBuilder bean, String
propertyName) {
- String id = getAndRegisterFirstChild(element, ctx, bean, propertyName);
- bean.addPropertyReference(propertyName, id);
-
- }
- protected String getAndRegisterFirstChild(Element element, ParserContext
ctx,
- BeanDefinitionBuilder bean,
String propertyName) {
Element first = getFirstChild(element);
if (first == null) {
@@ -196,25 +190,22 @@
if (id == null) {
throw new IllegalStateException("<ref> elements must have
a \"bean\" attribute!");
}
- return id;
+ bean.addPropertyReference(propertyName, id);
+ return;
} else if ("bean".equals(name)) {
BeanDefinitionHolder bdh =
ctx.getDelegate().parseBeanDefinitionElement(first);
child = bdh.getBeanDefinition();
- id = bdh.getBeanName();
+ bean.addPropertyValue(propertyName, child);
+ return;
} else {
throw new UnsupportedOperationException("Elements with the
name " + name
+ " are not currently "
+ "supported as sub
elements of "
+
element.getLocalName());
}
-
- } else {
- child = ctx.getDelegate().parseCustomElement(first,
bean.getBeanDefinition());
- id = child.toString();
}
-
- ctx.getRegistry().registerBeanDefinition(id, child);
- return id;
+ child = ctx.getDelegate().parseCustomElement(first,
bean.getBeanDefinition());
+ bean.addPropertyValue(propertyName, child);
}
protected Element getFirstChild(Element element) {
Modified:
cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingConfiguration.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingConfiguration.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingConfiguration.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingConfiguration.java
Thu Jun 19 13:27:56 2008
@@ -28,13 +28,18 @@
public class SoapBindingConfiguration extends BindingConfiguration {
private SoapVersion soapVersion = Soap11.getInstance();
- private String style = "document";
+ private String style;
private String use;
private String transportURI = "http://schemas.xmlsoap.org/soap/http";
private String defaultSoapAction = "";
private boolean mtomEnabled;
private QName bindingName;
private String bindingNamePostfix = "SoapBinding";
+
+ public SoapBindingConfiguration() {
+
+ }
+
@Override
public String getBindingId() {
@@ -63,11 +68,15 @@
this.transportURI = transportURI;
}
- protected String getStyle() {
- return style;
+ public boolean isSetStyle() {
+ return style != null;
+ }
+
+ public String getStyle() {
+ return style == null ? "document" : style;
}
- protected String getStyle(OperationInfo op) {
+ public String getStyle(OperationInfo op) {
return getStyle();
}
Modified:
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Thu Jun 19 13:27:56 2008
@@ -73,7 +73,10 @@
public WSDLQueryHandler(Bus b) {
bus = b;
}
-
+ public WSDLQueryHandler(Bus b) {
+ bus = b;
+ }
+
public String getResponseContentType(String baseUri, String ctx) {
if (baseUri.toLowerCase().contains("?wsdl")
|| baseUri.toLowerCase().contains("?xsd=")) {
Modified:
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/binding/soap/JaxWsSoapBindingConfiguration.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/binding/soap/JaxWsSoapBindingConfiguration.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/binding/soap/JaxWsSoapBindingConfiguration.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/binding/soap/JaxWsSoapBindingConfiguration.java
Thu Jun 19 13:27:56 2008
@@ -41,7 +41,7 @@
}
@Override
- protected String getStyle() {
+ public String getStyle() {
SOAPBinding sb = getServiceClass().getAnnotation(SOAPBinding.class);
if (sb != null) {
if (sb.style().equals(Style.DOCUMENT)) {
@@ -72,6 +72,6 @@
return "encoded";
}
}
- return super.getStyle();
+ return super.getUse();
}
}
Modified:
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
Thu Jun 19 13:27:56 2008
@@ -688,7 +688,7 @@
if (ann != null) {
return ann.style().toString().toLowerCase();
}
- return "document";
+ return super.getStyle();
}
private boolean isDocumentBare(Method method) {
@@ -711,7 +711,7 @@
if (ann != null) {
return ann.style().equals(SOAPBinding.Style.RPC);
}
- return Boolean.FALSE;
+ return super.isRPC(method);
}
Modified:
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
Thu Jun 19 13:27:56 2008
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.jaxws.spring;
+import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
@@ -27,6 +28,7 @@
import junit.framework.Assert;
+import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.anonymous_complex_type.AnonymousComplexType;
import org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names;
@@ -46,6 +48,7 @@
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.jaxws.service.Hello;
+import org.apache.cxf.transport.http.WSDLQueryHandler;
import org.apache.hello_world_soap_http.Greeter;
import org.junit.After;
import org.junit.Test;
@@ -217,16 +220,37 @@
ClassPathXmlApplicationContext ctx =
new ClassPathXmlApplicationContext(new String[]
{"/org/apache/cxf/jaxws/spring/servers.xml"});
- JaxWsServerFactoryBean bean = (JaxWsServerFactoryBean)
ctx.getBean("simple");
+ JaxWsServerFactoryBean bean;
+ BindingConfiguration bc;
+ SoapBindingConfiguration sbc;
+
+ bean = (JaxWsServerFactoryBean) ctx.getBean("inlineSoapBindingRPC");
+ assertNotNull(bean);
+
+ bc = bean.getBindingConfig();
+ assertTrue(bc instanceof SoapBindingConfiguration);
+ sbc = (SoapBindingConfiguration) bc;
+ assertEquals("rpc", sbc.getStyle());
+
+ WSDLQueryHandler handler = new
WSDLQueryHandler((Bus)ctx.getBean("cxf"));
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ handler.writeResponse("http://localhost/test?wsdl", "/test",
+ bean.create().getEndpoint().getEndpointInfo(),
+ bout);
+ String wsdl = bout.toString();
+ assertTrue(wsdl.contains("name=\"stringArray\""));
+ assertTrue(wsdl.contains("name=\"stringArray\""));
+
+ bean = (JaxWsServerFactoryBean) ctx.getBean("simple");
assertNotNull(bean);
bean = (JaxWsServerFactoryBean) ctx.getBean("inlineSoapBinding");
assertNotNull(bean);
- BindingConfiguration bc = bean.getBindingConfig();
+ bc = bean.getBindingConfig();
assertTrue(bc instanceof SoapBindingConfiguration);
- SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
- assertTrue(sbc.getVersion() instanceof Soap12);
+ sbc = (SoapBindingConfiguration) bc;
+ assertTrue("Not soap version 1.2: " + sbc.getVersion(),
sbc.getVersion() instanceof Soap12);
bean = (JaxWsServerFactoryBean) ctx.getBean("inlineDataBinding");
@@ -300,4 +324,5 @@
assertTrue("the soap configure should set isMtomEnabled to be true",
sbc.isMtomEnabled());
}
+
}
Modified:
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/servers.xml
Thu Jun 19 13:27:56 2008
@@ -38,7 +38,7 @@
</list>
</property>
</bean>
-
+
<jaxws:server id="simple" serviceBean="#greeter" xmlns:test="urn:foo"
xmlns="urn:foo"/>
<bean id="greeter" class="org.apache.hello_world_soap_http.GreeterImpl"/>
@@ -109,6 +109,14 @@
</jaxws:binding>
</jaxws:server>
+ <jaxws:server id="inlineSoapBindingRPC"
+ serviceClass="org.apache.cxf.jaxws.service.Hello"
+ address="http://localhost:8080/testrpc">
+ <jaxws:binding>
+ <soap:soapBinding style="rpc"/>
+ </jaxws:binding>
+ </jaxws:server>
+
<jaxws:server id="inlineDataBinding"
serviceClass="org.apache.cxf.jaxws.service.Hello"
address="http://localhost:8080/test">
Modified:
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/support/JaxWsServiceConfigurationTest.java
Thu Jun 19 13:27:56 2008
@@ -84,7 +84,8 @@
JaxWsServiceConfiguration jwsc = (JaxWsServiceConfiguration)
bean.getServiceConfigurations().get(0);
jwsc.setServiceFactory(bean);
- assertEquals("document", jwsc.getStyle());
+ assertNull(jwsc.getStyle());
+ assertEquals("document", bean.getStyle());
assertNull(jwsc.isWrapped());
}
Modified:
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
Thu Jun 19 13:27:56 2008
@@ -34,6 +34,7 @@
import org.apache.cxf.endpoint.EndpointImpl;
import org.apache.cxf.interceptor.AnnotationInterceptors;
import org.apache.cxf.service.Service;
+import org.apache.cxf.service.factory.AbstractServiceConfiguration;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.apache.cxf.service.factory.ServiceConstructionException;
import org.apache.cxf.service.model.BindingInfo;
@@ -54,11 +55,34 @@
protected AbstractWSDLBasedEndpointFactory(ReflectionServiceFactoryBean
sbean) {
serviceFactory = sbean;
+ sbean.getServiceConfigurations().add(new
SoapBindingServiceConfiguration());
}
protected AbstractWSDLBasedEndpointFactory() {
}
+
- protected Endpoint createEndpoint() throws BusException, EndpointException
{
+
+ private class SoapBindingServiceConfiguration extends
AbstractServiceConfiguration {
+ public String getStyle() {
+ if (getBindingConfig() instanceof SoapBindingConfiguration
+ &&
((SoapBindingConfiguration)getBindingConfig()).isSetStyle()) {
+ return
((SoapBindingConfiguration)getBindingConfig()).getStyle();
+ }
+ return null;
+ }
+ public Boolean isWrapped() {
+ if (getBindingConfig() instanceof SoapBindingConfiguration
+ && ((SoapBindingConfiguration)getBindingConfig()).isSetStyle()
+ &&
"rpc".equals(((SoapBindingConfiguration)getBindingConfig()).getStyle())) {
+ return Boolean.FALSE;
+ }
+ return null;
+ }
+ }
+
+ protected Endpoint createEndpoint() throws BusException, EndpointException
{
+ serviceFactory.setFeatures(getFeatures());
+
if (serviceName != null) {
serviceFactory.setServiceName(serviceName);
}
@@ -287,7 +311,8 @@
if (bindingConfig == null) {
bindingConfig = new SoapBindingConfiguration();
}
- if (bindingConfig instanceof SoapBindingConfiguration) {
+ if (bindingConfig instanceof SoapBindingConfiguration
+ &&
!((SoapBindingConfiguration)bindingConfig).isSetStyle()) {
((SoapBindingConfiguration)bindingConfig).setStyle(serviceFactory.getStyle());
}
}
Modified:
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/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=669678&r1=669677&r2=669678&view=diff
==============================================================================
---
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++
cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Thu Jun 19 13:27:56 2008
@@ -140,6 +140,13 @@
private boolean qualifiedSchemas = true;
+ private Map<Method, Boolean> wrappedCache = new HashMap<Method, Boolean>();
+ private Map<Method, Boolean> isRpcCache = new HashMap<Method, Boolean>();
+ private String styleCache;
+ private Boolean defWrappedCache;
+
+
+
public ReflectionServiceFactoryBean() {
getServiceConfigurations().add(0, new DefaultServiceConfiguration());
@@ -559,7 +566,6 @@
setFaultClassInfo(o, method);
}
-
Class<?>[] paramTypes = method.getParameterTypes();
Type[] genericTypes = method.getGenericParameterTypes();
for (int i = 0; i < paramTypes.length; i++) {
@@ -708,7 +714,7 @@
op.setProperty(m.getClass().getName(), m);
op.setProperty("action", getAction(op, m));
- if (isWrapped(m)) {
+ if (!isRPC(m) && isWrapped(m)) {
UnwrappedOperationInfo uOp = new UnwrappedOperationInfo(op);
op.setUnwrappedOperation(uOp);
@@ -1505,13 +1511,25 @@
}
protected boolean isWrapped(final Method method) {
- for (AbstractServiceConfiguration c : serviceConfigurations) {
- Boolean b = c.isWrapped(method);
- if (b != null) {
- return b.booleanValue();
+ Boolean b = wrappedCache.get(method);
+ if (b == null) {
+ if (isRPC(method)) {
+ wrappedCache.put(method, Boolean.FALSE);
+ return false;
}
+
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ b = c.isWrapped(method);
+ if (b != null) {
+ wrappedCache.put(method, b);
+ return b.booleanValue();
+ }
+ }
+
+ wrappedCache.put(method, Boolean.TRUE);
+ return true;
}
- return true;
+ return b;
}
protected boolean isMatchOperation(String methodNameInClass, String
methodNameInWsdl) {
@@ -1927,35 +1945,47 @@
public boolean isWrapped() {
if (this.wrappedStyle != null) {
- return this.wrappedStyle;
+ defWrappedCache = wrappedStyle;
}
- for (AbstractServiceConfiguration c : serviceConfigurations) {
- Boolean b = c.isWrapped();
- if (b != null) {
- return b.booleanValue();
+ if (this.defWrappedCache == null) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ defWrappedCache = c.isWrapped();
+ if (defWrappedCache != null) {
+ return defWrappedCache;
+ }
}
+ defWrappedCache = Boolean.TRUE;
}
- return true;
+ return defWrappedCache;
}
public String getStyle() {
- for (AbstractServiceConfiguration c : serviceConfigurations) {
- String style = c.getStyle();
- if (style != null) {
- return style;
+ if (styleCache == null) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ styleCache = c.getStyle();
+ if (styleCache != null) {
+ return styleCache;
+ }
}
+ styleCache = "document";
}
- return "document";
+ return styleCache;
}
public boolean isRPC(Method method) {
- for (AbstractServiceConfiguration c : serviceConfigurations) {
- Boolean b = c.isRPC(method);
- if (b != null) {
- return b.booleanValue();
+ Boolean b = isRpcCache.get(method);
+ if (b == null) {
+ for (AbstractServiceConfiguration c : serviceConfigurations) {
+ b = c.isRPC(method);
+ if (b != null) {
+ isRpcCache.put(method, b);
+ return b.booleanValue();
+ }
}
+ b = "rpc".equals(getStyle());
+ isRpcCache.put(method, b);
}
- return "rpc".equals(getStyle());
+ return b;
}
public void setWrapped(boolean style) {