Wednesday, 19 December
2012
Wed, 19 Dec
'12
9:08 a.m.
Author: alessio.soldano(a)jboss.com
Date: 2012-12-19 03:08:14 -0500 (Wed, 19 Dec 2012)
New Revision: 17135
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFServiceObjectFactoryJAXWS.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
Log:
[JBWS-3551] Impl and use failsafe methods
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFServiceObjectFactoryJAXWS.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFServiceObjectFactoryJAXWS.java 2012-12-19
07:58:54 UTC (rev 17134)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFServiceObjectFactoryJAXWS.java 2012-12-19
08:08:14 UTC (rev 17135)
@@ -93,24 +93,14 @@
private URL getCXFConfiguration(final UnifiedVirtualFile vfsRoot)
{
- URL url = null;
- try
- {
- url = vfsRoot.findChild("WEB-INF/" +
Constants.JBOSSWS_CXF_SPRING_DD).toURL();
- }
- catch (Exception e)
- {
- }
+ UnifiedVirtualFile uvf = vfsRoot.findChildFailSafe("WEB-INF/" +
Constants.JBOSSWS_CXF_SPRING_DD);
+ URL url = (uvf != null) ? uvf.toURL() : null;
if (url == null)
{
- try
- {
- url = vfsRoot.findChild("META-INF/" +
Constants.JBOSSWS_CXF_SPRING_DD).toURL();
- }
- catch (Exception e)
- {
- }
+ uvf = vfsRoot.findChildFailSafe("META-INF/" +
Constants.JBOSSWS_CXF_SPRING_DD);
+ if (uvf != null)
+ url = uvf.toURL();
}
return url;
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2012-12-19
07:58:54 UTC (rev 17134)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2012-12-19
08:08:14 UTC (rev 17135)
@@ -99,8 +99,8 @@
if (jbosswsCxfXml != null)
{
// Spring available and jbossws-cxf.xml provided
- final URL cxfServletUrl = getResourceUrl(deploymentResolver,
"WEB-INF/cxf-servlet.xml", false); // TODO: decide not to support this?
- final URL jbosswsCxfUrl = getResourceUrl(deploymentResolver, jbosswsCxfXml,
true);
+ final URL cxfServletUrl =
deploymentResolver.resolveFailSafe("WEB-INF/cxf-servlet.xml"); // TODO: decide
not to support this?
+ final URL jbosswsCxfUrl = getResourceUrl(deploymentResolver, jbosswsCxfXml);
holder = new SpringBusHolder(cxfServletUrl, jbosswsCxfUrl);
}
else
@@ -135,16 +135,16 @@
}
}
- private static URL getResourceUrl(final ResourceResolver resolver, final String
resourcePath, final boolean fail) {
- try {
- return resolver.resolve(resourcePath);
- } catch (final IOException e) {
- if (fail) {
- throw new RuntimeException(e);
- } else {
- return null;
- }
- }
+ private static URL getResourceUrl(final ResourceResolver resolver, final String
resourcePath)
+ {
+ try
+ {
+ return resolver.resolve(resourcePath);
+ }
+ catch (final IOException e)
+ {
+ throw new RuntimeException(e);
+ }
}
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java 2012-12-19
07:58:54 UTC (rev 17134)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/CXFInstanceProviderDeploymentAspect.java 2012-12-19
08:08:14 UTC (rev 17135)
@@ -41,11 +41,12 @@
@Override
public void start(final Deployment dep)
{
+ boolean springAvailable = SpringUtils.isSpringAvailable();
for (final Endpoint ep : dep.getService().getEndpoints())
{
final ServerFactoryBean factory = ep.getAttachment(ServerFactoryBean.class);
//TODO: remove this after JBWS-3396 resolved
- if (factory == null && SpringUtils.isSpringAvailable())
+ if (factory == null && springAvailable)
{
throw Messages.MESSAGES.endpointNotDefineInJbwsCxf(ep.getTargetBeanName());
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2012-12-19
07:58:54 UTC (rev 17134)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2012-12-19
08:08:14 UTC (rev 17135)
@@ -27,7 +27,6 @@
import static org.jboss.ws.common.integration.WSHelper.isWarArchive;
import static org.jboss.wsf.stack.cxf.Loggers.DEPLOYMENT_LOGGER;
-import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -121,17 +120,11 @@
}
URL cxfURL = null;
- try
- {
- // get resource URL
- ArchiveDeployment archDep = (ArchiveDeployment)dep;
- cxfURL = archDep.getResourceResolver().resolve(metadir + "/" +
Constants.JBOSSWS_CXF_SPRING_DD);
+ //get resource URL
+ ArchiveDeployment archDep = (ArchiveDeployment)dep;
+ cxfURL = archDep.getResourceResolver().resolveFailSafe(metadir + "/" +
Constants.JBOSSWS_CXF_SPRING_DD);
+ if (cxfURL != null)
DEPLOYMENT_LOGGER.jbwscxfConfFound(cxfURL);
- }
- catch (IOException ignore)
- {
- // resource not found
- }
return cxfURL;
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2012-12-19
07:58:54 UTC (rev 17134)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2012-12-19
08:08:14 UTC (rev 17135)
@@ -276,24 +276,23 @@
wsdlLocation = ddep.getAnnotationWsdlLocation();
}
if (wsdlLocation != null) {
- try {
- URL wsdlUrl = dep.getResourceResolver().resolve(wsdlLocation);
-
- SOAPAddressWSDLParser parser = getCurrentSOAPAddressWSDLParser(wsdlUrl,
soapAddressWsdlParsers);
- //do not try rewriting addresses for not-http binding
- String wsdlAddress = parser.filterSoapAddress(ddep.getServiceName(),
ddep.getPortName(), SOAPAddressWSDLParser.SOAP_HTTP_NS);
-
- final ServerConfig sc =
AbstractServerConfig.getServerIntegrationServerConfig();
- String rewrittenWsdlAddress =
SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(),
sc);
- //If "auto rewrite", leave "publishedEndpointUrl" unset so
that CXF do not force host/port values for
- //wsdl imports and auto-rewrite them too; otherwise set the new address into
"publishedEndpointUrl",
- //which causes CXF to override any address in the published wsdl.
- if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
- ddep.setPublishedEndpointUrl(rewrittenWsdlAddress);
+ URL wsdlUrl = dep.getResourceResolver().resolveFailSafe(wsdlLocation);
+ if (wsdlUrl != null) {
+ SOAPAddressWSDLParser parser = getCurrentSOAPAddressWSDLParser(wsdlUrl,
soapAddressWsdlParsers);
+ //do not try rewriting addresses for not-http binding
+ String wsdlAddress = parser.filterSoapAddress(ddep.getServiceName(),
ddep.getPortName(), SOAPAddressWSDLParser.SOAP_HTTP_NS);
+
+ final ServerConfig sc =
AbstractServerConfig.getServerIntegrationServerConfig();
+ String rewrittenWsdlAddress =
SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(),
sc);
+ //If "auto rewrite", leave "publishedEndpointUrl" unset
so that CXF do not force host/port values for
+ //wsdl imports and auto-rewrite them too; otherwise set the new address into
"publishedEndpointUrl",
+ //which causes CXF to override any address in the published wsdl.
+ if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
+ ddep.setPublishedEndpointUrl(rewrittenWsdlAddress);
+ }
+ } else {
+ METADATA_LOGGER.abortSoapAddressRewrite(wsdlLocation, null);
}
- } catch (IOException e) {
- METADATA_LOGGER.abortSoapAddressRewrite(wsdlLocation, e);
- }
}
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java 2012-12-19
07:58:54 UTC (rev 17134)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java 2012-12-19
08:08:14 UTC (rev 17135)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -65,16 +65,10 @@
public <T> T resolve(String resourcePath, Class<T> resourceType)
{
- URL url = null;
- try
- {
- url = resolver.resolve(resourcePath);
+ URL url = resolver.resolveFailSafe(resourcePath);
+ if (url == null && Loggers.ROOT_LOGGER.isDebugEnabled()) {
+
Loggers.ROOT_LOGGER.cannotResolveResource(JBossWSResourceResolver.class.getSimpleName(),
resourcePath);
}
- catch (IOException ioe)
- {
- if (Loggers.ROOT_LOGGER.isDebugEnabled())
-
Loggers.ROOT_LOGGER.cannotResolveResource(JBossWSResourceResolver.class.getSimpleName(),
resourcePath);
- }
if (url != null && resourceType.isInstance(url))
{
return resourceType.cast(url);