JBossWS SVN: r18852 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-08-20 12:15:57 -0400 (Wed, 20 Aug 2014)
New Revision: 18852
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
Log:
Catch specific exceptions only to avoid swallowing errors that should result in deployment failures instead
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-20 14:16:42 UTC (rev 18851)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-20 16:15:57 UTC (rev 18852)
@@ -23,7 +23,9 @@
import static org.jboss.wsf.stack.cxf.Loggers.ADDRESS_REWRITE_LOGGER;
+import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.Map;
@@ -100,7 +102,7 @@
return address;
}
}
- catch (Exception e)
+ catch (MalformedURLException e)
{
ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(address, "");
return address;
@@ -145,7 +147,7 @@
{
new URL(s);
}
- catch (Exception e)
+ catch (MalformedURLException e)
{
return true;
}
@@ -187,7 +189,7 @@
ADDRESS_REWRITE_LOGGER.addressRewritten(origAddress, urlStr);
return urlStr;
}
- catch (Exception e)
+ catch (MalformedURLException e)
{
ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(newAddress, origAddress);
return origAddress;
@@ -223,7 +225,7 @@
String scheme = addrURI.getScheme();
return scheme != null ? scheme : HTTP;
}
- catch (Exception e)
+ catch (URISyntaxException e)
{
return HTTP;
}
10 years, 4 months
JBossWS SVN: r18851 - in stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf: configuration and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-08-20 10:16:42 -0400 (Wed, 20 Aug 2014)
New Revision: 18851
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3785] Refactoring Jim's changes: simplifying SoapAddressRewriteHelper, fixing WSDLSoapAddressRewriteUtils and preparing bunch of code sections for [JBWS-3805]
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-19 08:39:45 UTC (rev 18850)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-20 14:16:42 UTC (rev 18851)
@@ -25,9 +25,9 @@
import java.net.URI;
import java.net.URL;
+import java.util.Map;
import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.stack.cxf.client.Constants;
/**
@@ -50,7 +50,7 @@
* @param serverConfig The current ServerConfig
* @return The rewritten soap:address to be used in the wsdl
*/
- public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String epAddress, ServerConfig serverConfig, JBossWebservicesMetaData wsmd) {
+ public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String epAddress, ServerConfig serverConfig, Map<String, String> props) {
if (wsdlAddress == null) {
return null;
}
@@ -58,14 +58,7 @@
{
final String origUriScheme = getUriScheme(wsdlAddress); //will be https if the user wants a https address in the wsdl
final String newUriScheme = getUriScheme(epAddress); //will be https if the user set confidential transport for the endpoint
- String uriScheme = (origUriScheme.equals(HTTPS) || newUriScheme.equals(HTTPS)) ? HTTPS : HTTP;
- if (serverConfig.getWebServiceUriScheme() != null) {
- uriScheme = serverConfig.getWebServiceUriScheme();
- }
- if (uriScheme == null) {
- uriScheme = wsmd.getProperty(Constants.JBWS_CXF_WSDL_URI_SCHEME);
- }
- return rewriteSoapAddress(serverConfig, wsdlAddress, epAddress, uriScheme);
+ return rewriteSoapAddress(serverConfig, wsdlAddress, epAddress, rewriteUriScheme(origUriScheme, newUriScheme, serverConfig, props));
}
else
{
@@ -73,11 +66,6 @@
}
}
- public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig) {
- return getRewrittenPublishedEndpointUrl(address, serverConfig, null);
- }
-
-
/**
* Rewrite and get address to be used for CXF published endpoint url prop (rewritten wsdl address).
* This method is to be used for code-first endpoints, when no wsdl is provided by the user.
@@ -86,49 +74,22 @@
* @param serverConfig The current ServerConfig
* @return
*/
- public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig, JBossWebservicesMetaData wsmd)
+ public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig, Map<String, String> props)
{
try
{
- final URL tmpurl = new URL(address);
- String uriScheme = serverConfig.getWebServiceUriScheme();
- if (uriScheme == null && wsmd != null) {
- uriScheme = wsmd.getProperty(Constants.JBWS_CXF_WSDL_URI_SCHEME);
- }
- if (uriScheme != null) {
- String port = "";
- if (HTTPS.equals(uriScheme))
- {
- int portNo = serverConfig.getWebServiceSecurePort();
- if (portNo != 443)
- {
- port = ":" + portNo;
- }
- }
- else
- {
- int portNo = serverConfig.getWebServicePort();
- if (portNo != 80)
- {
- port = ":" + portNo;
- }
- }
-
- StringBuilder addressBuilder = new StringBuilder();
- addressBuilder.append(uriScheme);
- addressBuilder.append("://");
- addressBuilder.append(tmpurl.getHost());
- addressBuilder.append(port);
- addressBuilder.append(tmpurl.getPath());
- address = addressBuilder.toString();
-
- }
- final URL url = new URL(address);
- if (isPathRewriteRequired(serverConfig))
- {
+ if (isPathRewriteRequired(serverConfig) || isSchemeRewriteRequired(serverConfig, props)) {
+ final URL url = new URL(address);
+ final String uriScheme = rewriteUriScheme(getUriScheme(address), null, serverConfig, props);
+ final String port = getDotPortNumber(uriScheme, serverConfig);
+ final StringBuilder builder = new StringBuilder();
+ builder.append(uriScheme);
+ builder.append("://");
+ builder.append(url.getHost());
+ builder.append(port);
final String path = url.getPath();
- final String tmpPath = SEDProcessor.newInstance(serverConfig.getWebServicePathRewriteRule()).processLine(path);
- final String newUrl=url.toString().replace(path, tmpPath);
+ builder.append(isPathRewriteRequired(serverConfig) ? SEDProcessor.newInstance(serverConfig.getWebServicePathRewriteRule()).processLine(path) : path);
+ final String newUrl = builder.toString();
ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl);
return newUrl;
@@ -207,23 +168,7 @@
URL url = new URL(newAddress);
String path = url.getPath();
String host = serverConfig.getWebServiceHost();
- String port = "";
- if (HTTPS.equals(uriScheme))
- {
- int portNo = serverConfig.getWebServiceSecurePort();
- if (portNo != 443)
- {
- port = ":" + portNo;
- }
- }
- else
- {
- int portNo = serverConfig.getWebServicePort();
- if (portNo != 80)
- {
- port = ":" + portNo;
- }
- }
+ String port = getDotPortNumber(uriScheme, serverConfig);
StringBuilder sb = new StringBuilder(uriScheme);
sb.append("://");
@@ -249,6 +194,27 @@
}
}
+ private static String getDotPortNumber(String uriScheme, ServerConfig serverConfig) {
+ String port = "";
+ if (HTTPS.equals(uriScheme))
+ {
+ int portNo = serverConfig.getWebServiceSecurePort();
+ if (portNo != 443)
+ {
+ port = ":" + portNo;
+ }
+ }
+ else
+ {
+ int portNo = serverConfig.getWebServicePort();
+ if (portNo != 80)
+ {
+ port = ":" + portNo;
+ }
+ }
+ return port;
+ }
+
private static String getUriScheme(String address)
{
try
@@ -271,4 +237,27 @@
final String pathRewriteRule = sc.getWebServicePathRewriteRule();
return pathRewriteRule != null && !pathRewriteRule.isEmpty();
}
+
+ public static boolean isSchemeRewriteRequired(ServerConfig sc, Map<String, String> props) {
+ if (!sc.isModifySOAPAddress()) {
+ return false;
+ } //TODO also check modify soap address is enabled in wsmd
+ return sc.getWebServiceUriScheme() != null || props.get(Constants.JBWS_CXF_WSDL_URI_SCHEME) != null;
+ }
+
+ private static String rewriteUriScheme(final String origUriScheme, final String newUriScheme, final ServerConfig serverConfig, final Map<String, String> props) {
+ //1) if either of orig URI or new URI uses HTTPS, use HTTPS
+ String uriScheme = (HTTPS.equals(origUriScheme) || HTTPS.equals(newUriScheme)) ? HTTPS : HTTP;
+ //2) server configuration override
+ final String serverUriScheme = serverConfig.getWebServiceUriScheme();
+ if (serverUriScheme != null) {
+ uriScheme = serverUriScheme;
+ }
+ //3) deployment configuration override
+ final String mdUriScheme = props.get(Constants.JBWS_CXF_WSDL_URI_SCHEME);
+ if (mdUriScheme != null) {
+ uriScheme = mdUriScheme;
+ }
+ return uriScheme;
+ }
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2014-08-19 08:39:45 UTC (rev 18850)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2014-08-20 14:16:42 UTC (rev 18851)
@@ -22,6 +22,7 @@
package org.jboss.wsf.stack.cxf.configuration;
import java.security.AccessController;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -125,7 +126,7 @@
{
bus.setExtension(configurer, Configurer.class);
}
- Map<String, String> props = (wsmd == null) ? null : wsmd.getProperties();
+ Map<String, String> props = getProperties(wsmd);
setInterceptors(bus, props);
dep.addAttachment(Bus.class, bus);
@@ -163,6 +164,15 @@
}
}
+ private static Map<String, String> getProperties(JBossWebservicesMetaData wsmd) {
+ Map<String, String> props;
+ if (wsmd != null) {
+ props = wsmd.getProperties();
+ } else {
+ props = Collections.emptyMap();
+ }
+ return props;
+ }
/**
* Performs close operations
@@ -206,8 +216,9 @@
bus.getInInterceptors().add(new HandlerAuthInterceptor());
}
- if (SoapAddressRewriteHelper.isPathRewriteRequired(getServerConfig())) {
- bus.getInInterceptors().add(WSDLSoapAddressRewriteInterceptor.INSTANCE);
+ final ServerConfig sc = getServerConfig();
+ if (SoapAddressRewriteHelper.isPathRewriteRequired(sc) || SoapAddressRewriteHelper.isSchemeRewriteRequired(sc, props)) {
+ bus.getInInterceptors().add(new WSDLSoapAddressRewriteInterceptor(props));
}
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-08-19 08:39:45 UTC (rev 18850)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-08-20 14:16:42 UTC (rev 18851)
@@ -201,7 +201,7 @@
} else {
//- wsdl-first handling
if (ei.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)){
- String epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ei.getAddress(), servConfig);
+ String epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ei.getAddress(), servConfig, null); //TODO [JBWS-3805]
ei.setAddress(epurl);
}
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-08-19 08:39:45 UTC (rev 18850)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-08-20 14:16:42 UTC (rev 18851)
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.stack.cxf.interceptor;
+import java.util.Map;
+
import org.apache.cxf.frontend.WSDLGetUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
@@ -33,19 +35,20 @@
* soap:address rewrite
*
* @author rsearls(a)redhat.com
+ * @author alessio.soldano(a)jboss.com
* @since 19-May-2014
*/
public class WSDLSoapAddressRewriteInterceptor extends AbstractPhaseInterceptor<Message> {
- public static final WSDLSoapAddressRewriteInterceptor INSTANCE =
- new WSDLSoapAddressRewriteInterceptor();
+ private final WSDLGetUtils wsdlGetUtils;
- public WSDLSoapAddressRewriteInterceptor() {
+ public WSDLSoapAddressRewriteInterceptor(Map<String, String> props) {
// this must run before WSDLGetInterceptor which is in Phase.READ
super(Phase.POST_STREAM);
+ this.wsdlGetUtils = new WSDLSoapAddressRewriteUtils(props);
}
public void handleMessage(Message message) throws Fault {
- message.setContextualProperty(WSDLGetUtils.class.getName(), new WSDLSoapAddressRewriteUtils());
+ message.setContextualProperty(WSDLGetUtils.class.getName(), wsdlGetUtils);
}
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java 2014-08-19 08:39:45 UTC (rev 18850)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java 2014-08-20 14:16:42 UTC (rev 18851)
@@ -22,6 +22,7 @@
package org.jboss.wsf.stack.cxf.interceptor.util;
import java.security.AccessController;
+import java.util.Map;
import javax.wsdl.Definition;
@@ -37,9 +38,17 @@
* when a path rewrite rule is specified in the server configuration.
*
* @author rsearls(a)redhat.com
+ * @author alessio.soldano(a)jboss.com
*
*/
public class WSDLSoapAddressRewriteUtils extends WSDLGetUtils {
+
+ private final Map<String, String> props;
+
+ public WSDLSoapAddressRewriteUtils(Map<String, String> props) {
+ super();
+ this.props = props;
+ }
@Override
public String getPublishableEndpointUrl(Definition def, String epurl,
@@ -51,9 +60,9 @@
} else {
// When using replacement path, must set replacement path in the active url.
final ServerConfig sc = getServerConfig();
- if (SoapAddressRewriteHelper.isPathRewriteRequired(sc)
+ if ((SoapAddressRewriteHelper.isPathRewriteRequired(sc) || SoapAddressRewriteHelper.isSchemeRewriteRequired(sc, props)) //TODO if we ended up here, the checks are perhaps not needed (otherwise this won't have been installed)
&& endpointInfo.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)) {
- epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(epurl, sc);
+ epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(epurl, sc, props);
updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
}
}
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 2014-08-19 08:39:45 UTC (rev 18850)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-08-20 14:16:42 UTC (rev 18851)
@@ -26,6 +26,7 @@
import java.net.URL;
import java.security.AccessController;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -288,7 +289,7 @@
wsdlLocation = ddep.getAnnotationWsdlLocation();
}
final ServerConfig sc = getServerConfig();
- JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
+ final Map<String, String> props = getJBossWebServicesMetaDataProperties(dep);
if (wsdlLocation != null) {
URL wsdlUrl = dep.getResourceResolver().resolveFailSafe(wsdlLocation);
if (wsdlUrl != null) {
@@ -296,7 +297,7 @@
//do not try rewriting addresses for not-http binding
String wsdlAddress = parser.filterSoapAddress(ddep.getServiceName(), ddep.getPortName(), SOAPAddressWSDLParser.SOAP_HTTP_NS);
- String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc, wsmd);
+ String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc, props);
//If "auto rewrite", leave "publishedEndpointUrl" unset so that CXF does 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.
@@ -310,11 +311,22 @@
//same comment as above regarding auto rewrite...
if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
//force computed address for code first endpoints
- ddep.setPublishedEndpointUrl(SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ddep.getAddress(), sc, wsmd));
+ ddep.setPublishedEndpointUrl(SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ddep.getAddress(), sc, props));
}
}
}
+ private static Map<String, String> getJBossWebServicesMetaDataProperties(Deployment dep) {
+ JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
+ Map<String, String> props;
+ if (wsmd != null) {
+ props = wsmd.getProperties();
+ } else {
+ props = Collections.emptyMap();
+ }
+ return props;
+ }
+
private SOAPAddressWSDLParser getCurrentSOAPAddressWSDLParser(URL wsdlUrl, Map<String, SOAPAddressWSDLParser> soapAddressWsdlParsers) {
final String key = wsdlUrl.toString();
SOAPAddressWSDLParser parser = soapAddressWsdlParsers.get(key);
10 years, 4 months
JBossWS SVN: r18850 - in stack/cxf/trunk/modules/testsuite: cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-19 04:39:45 -0400 (Tue, 19 Aug 2014)
New Revision: 18850
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOne.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOneImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/SoapAddressURISchemeTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/jboss-webservices.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/web.xml
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3805]:Add test case
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOne.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOne.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOne.java 2014-08-19 08:39:45 UTC (rev 18850)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.jbws3805;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "EndpointOne", targetNamespace = "http://org.jboss.ws.jaxws.cxf/jbws3805", serviceName = "ServiceOne")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointOne
+{
+ String echo(String input);
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOne.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOneImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOneImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOneImpl.java 2014-08-19 08:39:45 UTC (rev 18850)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.jbws3805;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "EndpointOne", targetNamespace = "http://org.jboss.ws.jaxws.cxf/jbws3805", serviceName = "ServiceOne")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public class EndpointOneImpl
+{
+
+ @WebMethod
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/EndpointOneImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/SoapAddressURISchemeTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/SoapAddressURISchemeTestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/SoapAddressURISchemeTestCase.java 2014-08-19 08:39:45 UTC (rev 18850)
@@ -0,0 +1,71 @@
+package org.jboss.test.ws.jaxws.cxf.jbws3805;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+public class SoapAddressURISchemeTestCase extends JBossWSTest
+{
+ private static String publishURL = "http://" + getServerHost() + ":8080/jaxws-cxf-jbws3805/HelloService";
+
+ public static BaseDeployment<?>[] createDeployments()
+ {
+ List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
+ list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-jbws3805.war") {
+ {
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n" + "Dependencies: org.jboss.ws.common\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.jbws3805.EndpointOne.class).addClass(org.jboss.test.ws.jaxws.cxf.jbws3805.EndpointOneImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3805/WEB-INF/jboss-webservices.xml"), "jboss-webservices.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/jbws3805/WEB-INF/web.xml"));
+ }
+ });
+ return list.toArray(new BaseDeployment<?>[list.size()]);
+ }
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(SoapAddressURISchemeTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
+ }
+
+ public void testSoapAddressURIScheme() throws Exception
+ {
+ URL wsdlURL = new URL(publishURL + "?wsdl");
+ HttpURLConnection connection = (HttpURLConnection)wsdlURL.openConnection();
+ try
+ {
+ connection.connect();
+ assertEquals(200, connection.getResponseCode());
+ connection.getInputStream();
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String line;
+ while ((line = in.readLine()) != null)
+ {
+ if (line.contains("address location"))
+ {
+ assertTrue("Unexpected uri scheme", line.contains("https") && line.contains("8443"));
+ return;
+ }
+ }
+ fail("Could not check soap:address!");
+ }
+ finally
+ {
+ connection.disconnect();
+ }
+
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3805/SoapAddressURISchemeTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/jboss-webservices.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/jboss-webservices.xml (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/jboss-webservices.xml 2014-08-19 08:39:45 UTC (rev 18850)
@@ -0,0 +1,12 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<webservices
+ xmlns="http://www.jboss.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.2"
+ xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee">
+ <property>
+ <name>org.jboss.ws.cxf.wsdl.uriScheme</name>
+ <value>https</value>
+ </property>
+
+</webservices>
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/jboss-webservices.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/web.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/web.xml (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/web.xml 2014-08-19 08:39:45 UTC (rev 18850)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>HelloService</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.cxf.jbws3805.EndpointOneImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>HelloService</servlet-name>
+ <url-pattern>/HelloService</url-pattern>
+ </servlet-mapping>
+
+</web-app>
\ No newline at end of file
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jbws3805/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-19 07:49:15 UTC (rev 18849)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-19 08:39:45 UTC (rev 18850)
@@ -695,6 +695,9 @@
<!-- # [JBWS-3620] Authentication failures w/ Undertow -->
<exclude>org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase*</exclude>
+ <!-- # [JBWS-3805]:Allow overriding soap:address rewrite options in jboss-webservices.xml;Not supposed to support in WFLY8 -->
+ <exclude>org/jboss/test/ws/jaxws/cxf/jbws3805/*TestCase*</exclude>
+
<!-- # [JBWS-3816] WSTrustActAsTestCase.testActAs failing with move to cxf 3.0.2-SNAPSHOT -->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase*</exclude>
@@ -789,6 +792,9 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
+ <!-- # [JBWS-3805]:Allow overriding soap:address rewrite options in jboss-webservices.xml;Not supposed to support in WFLY8 -->
+ <exclude>org/jboss/test/ws/jaxws/cxf/jbws3805/*TestCase*</exclude>
+
<!-- [JBWS-3809] Enable it after backport change to wilfly810 ASIL ? -->
<exclude>org/jboss/test/ws/jaxws/cxf/jbws3809/*TestCase*</exclude>
</excludes>
10 years, 4 months
JBossWS SVN: r18849 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-19 03:49:15 -0400 (Tue, 19 Aug 2014)
New Revision: 18849
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3785][JBWS-3805]:Revert the previous change;only provide option to force change the soap address uri scheme
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java 2014-08-19 07:48:01 UTC (rev 18848)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/Constants.java 2014-08-19 07:49:15 UTC (rev 18849)
@@ -45,6 +45,7 @@
public static final String CXF_WS_DISCOVERY_ENABLED = "cxf.ws-discovery.enabled";
public static final String JBWS_CXF_DISABLE_HANDLER_AUTH_CHECKS = "org.jboss.ws.cxf.disableHandlerAuthChecks";
public static final String JBWS_CXF_NO_LOCAL_BC = "org.jboss.ws.cxf.noLocalBC";
+ public static final String JBWS_CXF_WSDL_URI_SCHEME = "org.jboss.ws.cxf.wsdl.uriScheme";
public static final String JBWS_CXF_JAXWS_CLIENT_BUS_STRATEGY = "org.jboss.ws.cxf.jaxws-client.bus.strategy";
public static final String THREAD_BUS_STRATEGY = "THREAD_BUS";
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-19 07:48:01 UTC (rev 18848)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-19 07:49:15 UTC (rev 18849)
@@ -26,9 +26,9 @@
import java.net.URI;
import java.net.URL;
-import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.ws.common.Constants;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
+import org.jboss.wsf.stack.cxf.client.Constants;
/**
* Helper for rewriting soap:address in published wsdl
@@ -50,7 +50,7 @@
* @param serverConfig The current ServerConfig
* @return The rewritten soap:address to be used in the wsdl
*/
- public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String epAddress, ServerConfig serverConfig, Service service) {
+ public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String epAddress, ServerConfig serverConfig, JBossWebservicesMetaData wsmd) {
if (wsdlAddress == null) {
return null;
}
@@ -63,7 +63,7 @@
uriScheme = serverConfig.getWebServiceUriScheme();
}
if (uriScheme == null) {
- uriScheme = (String)service.getProperty(Constants.FORCE_URI_SCHEME);
+ uriScheme = wsmd.getProperty(Constants.JBWS_CXF_WSDL_URI_SCHEME);
}
return rewriteSoapAddress(serverConfig, wsdlAddress, epAddress, uriScheme);
}
@@ -73,6 +73,11 @@
}
}
+ public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig) {
+ return getRewrittenPublishedEndpointUrl(address, serverConfig, null);
+ }
+
+
/**
* Rewrite and get address to be used for CXF published endpoint url prop (rewritten wsdl address).
* This method is to be used for code-first endpoints, when no wsdl is provided by the user.
@@ -81,13 +86,46 @@
* @param serverConfig The current ServerConfig
* @return
*/
- public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig)
+ public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig, JBossWebservicesMetaData wsmd)
{
try
{
+ final URL tmpurl = new URL(address);
+ String uriScheme = serverConfig.getWebServiceUriScheme();
+ if (uriScheme == null && wsmd != null) {
+ uriScheme = wsmd.getProperty(Constants.JBWS_CXF_WSDL_URI_SCHEME);
+ }
+ if (uriScheme != null) {
+ String port = "";
+ if (HTTPS.equals(uriScheme))
+ {
+ int portNo = serverConfig.getWebServiceSecurePort();
+ if (portNo != 443)
+ {
+ port = ":" + portNo;
+ }
+ }
+ else
+ {
+ int portNo = serverConfig.getWebServicePort();
+ if (portNo != 80)
+ {
+ port = ":" + portNo;
+ }
+ }
+
+ StringBuilder addressBuilder = new StringBuilder();
+ addressBuilder.append(uriScheme);
+ addressBuilder.append("://");
+ addressBuilder.append(tmpurl.getHost());
+ addressBuilder.append(port);
+ addressBuilder.append(tmpurl.getPath());
+ address = addressBuilder.toString();
+
+ }
+ final URL url = new URL(address);
if (isPathRewriteRequired(serverConfig))
- {
- final URL url = new URL(address);
+ {
final String path = url.getPath();
final String tmpPath = SEDProcessor.newInstance(serverConfig.getWebServicePathRewriteRule()).processLine(path);
final String newUrl=url.toString().replace(path, tmpPath);
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 2014-08-19 07:48:01 UTC (rev 18848)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-08-19 07:49:15 UTC (rev 18849)
@@ -51,6 +51,7 @@
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
@@ -287,6 +288,7 @@
wsdlLocation = ddep.getAnnotationWsdlLocation();
}
final ServerConfig sc = getServerConfig();
+ JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
if (wsdlLocation != null) {
URL wsdlUrl = dep.getResourceResolver().resolveFailSafe(wsdlLocation);
if (wsdlUrl != null) {
@@ -294,7 +296,7 @@
//do not try rewriting addresses for not-http binding
String wsdlAddress = parser.filterSoapAddress(ddep.getServiceName(), ddep.getPortName(), SOAPAddressWSDLParser.SOAP_HTTP_NS);
- String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc, dep.getService());
+ String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc, wsmd);
//If "auto rewrite", leave "publishedEndpointUrl" unset so that CXF does 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.
@@ -308,7 +310,7 @@
//same comment as above regarding auto rewrite...
if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
//force computed address for code first endpoints
- ddep.setPublishedEndpointUrl(SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ddep.getAddress(), sc));
+ ddep.setPublishedEndpointUrl(SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ddep.getAddress(), sc, wsmd));
}
}
}
10 years, 4 months
JBossWS SVN: r18848 - in common/trunk/src/main/java/org/jboss/ws/common: deployment and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-19 03:48:01 -0400 (Tue, 19 Aug 2014)
New Revision: 18848
Modified:
common/trunk/src/main/java/org/jboss/ws/common/Constants.java
common/trunk/src/main/java/org/jboss/ws/common/Loggers.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
Log:
[JBWS-3785][JBWS-3805]:Revert the previous change;only provide option to force change the soap address uri scheme
Modified: common/trunk/src/main/java/org/jboss/ws/common/Constants.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/Constants.java 2014-08-18 15:41:42 UTC (rev 18847)
+++ common/trunk/src/main/java/org/jboss/ws/common/Constants.java 2014-08-19 07:48:01 UTC (rev 18848)
@@ -320,6 +320,4 @@
static final String HTTP_MAX_CONNECTIONS = "org.jboss.ws.http.maxConnections";
static final String NETTY_MESSAGE = "org.jboss.ws.http.netty.Message";
-
- static final String FORCE_URI_SCHEME = "org.jboss.ws.address.forceUriScheme";
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/Loggers.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/Loggers.java 2014-08-18 15:41:42 UTC (rev 18847)
+++ common/trunk/src/main/java/org/jboss/ws/common/Loggers.java 2014-08-19 07:48:01 UTC (rev 18848)
@@ -222,9 +222,4 @@
@LogMessage(level = TRACE)
@Message(id = 22116, value = "Could not find %s in the additional metadatafiles")
void cannotFindInAdditionalMetaData(String resourcePath);
-
-
- @LogMessage(level = WARN)
- @Message(id = 22118, value = "Invalid uri schema value %s")
- void invalidUriSchemeValue(String scheme);
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-08-18 15:41:42 UTC (rev 18847)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-08-19 07:48:01 UTC (rev 18848)
@@ -31,8 +31,6 @@
import java.util.Map;
import org.jboss.ws.api.annotation.WebContext;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.Loggers;
import org.jboss.ws.common.Messages;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.ws.common.management.AbstractServerConfig;
@@ -47,7 +45,6 @@
import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
-import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
/**
* A deployer that assigns the endpoint address.
@@ -72,33 +69,11 @@
String host = serverConfig.getWebServiceHost();
Map<String, Endpoint> endpointsMap = new HashMap<String, Endpoint>();
List<Endpoint> deleteList = new LinkedList<Endpoint>();
- String uriSchema = serverConfig.getWebServiceUriScheme();
- JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
- if (uriSchema == null && wsmd != null && wsmd.getProperty(Constants.FORCE_URI_SCHEME) != null)
- {
- String wsmdScheme = wsmd.getProperty(Constants.FORCE_URI_SCHEME);
- if ("http".equals(wsmdScheme) || "https".equals(wsmdScheme))
- {
- uriSchema = wsmdScheme;
- dep.getService().setProperty(Constants.FORCE_URI_SCHEME, uriSchema);
- } else {
- Loggers.DEPLOYMENT_LOGGER.invalidUriSchemeValue(wsmdScheme);
- }
- }
for (Endpoint ep : service.getEndpoints())
{
if (ep instanceof HttpEndpoint)
{
- boolean confidential = false;
- if ("https".equals(uriSchema)) {
- confidential = true;
- }
- if ("http".equals(uriSchema)) {
- confidential = false;
- }
- if (uriSchema == null) {
- confidential = isConfidentialTransportGuarantee(dep, ep);
- }
+ boolean confidential = isConfidentialTransportGuarantee(dep, ep);
int currentPort = port.getValue(confidential);
String hostAndPort = host + (currentPort > 0 ? ":" + currentPort : "");
@@ -109,7 +84,7 @@
if (urlPattern.endsWith("/*"))
urlPattern = urlPattern.substring(0, urlPattern.length() - 2);
-
+
String protocol = confidential ? "https://" : "http://";
String address = protocol + hostAndPort + (contextRoot.equals("/") && urlPattern.startsWith("/") ? "" : contextRoot) + urlPattern;
httpEp.setAddress(address);
Modified: common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2014-08-18 15:41:42 UTC (rev 18847)
+++ common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2014-08-19 07:48:01 UTC (rev 18848)
@@ -89,6 +89,7 @@
//The SOAP address uri schema, http is the default value
private volatile String webServiceUriScheme;
private final Object webServiceUriSchemeLock = new Object();
+
private volatile boolean statisticsEnabled;
//The stack config
@@ -293,7 +294,7 @@
public String getWebServiceUriScheme()
{
- return this.webServiceUriScheme;
+ return this.webServiceUriScheme;
}
public void setWebServiceUriScheme(String scheme)
@@ -303,16 +304,16 @@
public void setWebServiceUriScheme(String scheme, UpdateCallbackHandler uch)
{
- synchronized (webServiceUriSchemeLock) {
- if (uch != null)
- {
- uch.onBeforeUpdate();
- }
- this.webServiceUriScheme = scheme;
- }
+ synchronized (webServiceUriSchemeLock)
+ {
+ if (uch != null)
+ {
+ uch.onBeforeUpdate();
+ }
+ this.webServiceUriScheme = scheme;
+ }
}
-
-
+
private int getConnectorPort(boolean secure) {
final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
int port = 0;
10 years, 4 months
JBossWS SVN: r18847 - stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-08-18 11:41:42 -0400 (Mon, 18 Aug 2014)
New Revision: 18847
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService.wsdl
Log:
Fixing comment
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService.wsdl 2014-08-14 08:43:00 UTC (rev 18846)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService.wsdl 2014-08-18 15:41:42 UTC (rev 18847)
@@ -101,7 +101,7 @@
<soap:address location="http://@jboss.bind.address@:8080/jaxws-samples-wsse-policy-oasis/SecurityService224"/>
</wsdl:port>
</wsdl:service>
- <!-- 2.2.1 (WSS 1.0) UsernameToken with Mutual X.509v3 Authentication, Sign, Encrypt -->
+ <!-- 2.2.1 (WSS1.0) X.509 Certificates, Sign, Encrypt -->
<wsp:Policy wsu:Id="SecurityService221_policy">
<wsp:ExactlyOne>
<wsp:All>
10 years, 4 months
JBossWS SVN: r18846 - in stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf: metadata and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-14 04:43:00 -0400 (Thu, 14 Aug 2014)
New Revision: 18846
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3805]:Add property to force the address uri scheme
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-14 08:41:55 UTC (rev 18845)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-14 08:43:00 UTC (rev 18846)
@@ -26,7 +26,9 @@
import java.net.URI;
import java.net.URL;
+import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.ws.common.Constants;
/**
* Helper for rewriting soap:address in published wsdl
@@ -48,7 +50,7 @@
* @param serverConfig The current ServerConfig
* @return The rewritten soap:address to be used in the wsdl
*/
- public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String epAddress, ServerConfig serverConfig) {
+ public static String getRewrittenPublishedEndpointUrl(String wsdlAddress, String epAddress, ServerConfig serverConfig, Service service) {
if (wsdlAddress == null) {
return null;
}
@@ -60,6 +62,9 @@
if (serverConfig.getWebServiceUriScheme() != null) {
uriScheme = serverConfig.getWebServiceUriScheme();
}
+ if (uriScheme == null) {
+ uriScheme = (String)service.getProperty(Constants.FORCE_URI_SCHEME);
+ }
return rewriteSoapAddress(serverConfig, wsdlAddress, epAddress, uriScheme);
}
else
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 2014-08-14 08:41:55 UTC (rev 18845)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-08-14 08:43:00 UTC (rev 18846)
@@ -294,7 +294,7 @@
//do not try rewriting addresses for not-http binding
String wsdlAddress = parser.filterSoapAddress(ddep.getServiceName(), ddep.getPortName(), SOAPAddressWSDLParser.SOAP_HTTP_NS);
- String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc);
+ String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc, dep.getService());
//If "auto rewrite", leave "publishedEndpointUrl" unset so that CXF does 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.
10 years, 4 months
JBossWS SVN: r18845 - in common/trunk/src/main/java/org/jboss/ws/common: deployment and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-14 04:41:55 -0400 (Thu, 14 Aug 2014)
New Revision: 18845
Modified:
common/trunk/src/main/java/org/jboss/ws/common/Constants.java
common/trunk/src/main/java/org/jboss/ws/common/Loggers.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
Log:
[JBWS-3805]:Add property to force the address uri scheme
Modified: common/trunk/src/main/java/org/jboss/ws/common/Constants.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/Constants.java 2014-08-13 08:23:56 UTC (rev 18844)
+++ common/trunk/src/main/java/org/jboss/ws/common/Constants.java 2014-08-14 08:41:55 UTC (rev 18845)
@@ -320,4 +320,6 @@
static final String HTTP_MAX_CONNECTIONS = "org.jboss.ws.http.maxConnections";
static final String NETTY_MESSAGE = "org.jboss.ws.http.netty.Message";
+
+ static final String FORCE_URI_SCHEME = "org.jboss.ws.address.forceUriScheme";
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/Loggers.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/Loggers.java 2014-08-13 08:23:56 UTC (rev 18844)
+++ common/trunk/src/main/java/org/jboss/ws/common/Loggers.java 2014-08-14 08:41:55 UTC (rev 18845)
@@ -222,4 +222,9 @@
@LogMessage(level = TRACE)
@Message(id = 22116, value = "Could not find %s in the additional metadatafiles")
void cannotFindInAdditionalMetaData(String resourcePath);
+
+
+ @LogMessage(level = WARN)
+ @Message(id = 22118, value = "Invalid uri schema value %s")
+ void invalidUriSchemeValue(String scheme);
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-08-13 08:23:56 UTC (rev 18844)
+++ common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-08-14 08:41:55 UTC (rev 18845)
@@ -31,6 +31,8 @@
import java.util.Map;
import org.jboss.ws.api.annotation.WebContext;
+import org.jboss.ws.common.Constants;
+import org.jboss.ws.common.Loggers;
import org.jboss.ws.common.Messages;
import org.jboss.ws.common.integration.AbstractDeploymentAspect;
import org.jboss.ws.common.management.AbstractServerConfig;
@@ -45,6 +47,7 @@
import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData.JSEResourceCollection;
+import org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData;
/**
* A deployer that assigns the endpoint address.
@@ -70,11 +73,32 @@
Map<String, Endpoint> endpointsMap = new HashMap<String, Endpoint>();
List<Endpoint> deleteList = new LinkedList<Endpoint>();
String uriSchema = serverConfig.getWebServiceUriScheme();
+ JBossWebservicesMetaData wsmd = dep.getAttachment(JBossWebservicesMetaData.class);
+ if (uriSchema == null && wsmd != null && wsmd.getProperty(Constants.FORCE_URI_SCHEME) != null)
+ {
+ String wsmdScheme = wsmd.getProperty(Constants.FORCE_URI_SCHEME);
+ if ("http".equals(wsmdScheme) || "https".equals(wsmdScheme))
+ {
+ uriSchema = wsmdScheme;
+ dep.getService().setProperty(Constants.FORCE_URI_SCHEME, uriSchema);
+ } else {
+ Loggers.DEPLOYMENT_LOGGER.invalidUriSchemeValue(wsmdScheme);
+ }
+ }
for (Endpoint ep : service.getEndpoints())
{
if (ep instanceof HttpEndpoint)
{
- boolean confidential = isConfidentialTransportGuarantee(dep, ep);
+ boolean confidential = false;
+ if ("https".equals(uriSchema)) {
+ confidential = true;
+ }
+ if ("http".equals(uriSchema)) {
+ confidential = false;
+ }
+ if (uriSchema == null) {
+ confidential = isConfidentialTransportGuarantee(dep, ep);
+ }
int currentPort = port.getValue(confidential);
String hostAndPort = host + (currentPort > 0 ? ":" + currentPort : "");
@@ -87,10 +111,6 @@
urlPattern = urlPattern.substring(0, urlPattern.length() - 2);
String protocol = confidential ? "https://" : "http://";
- //force address protocol
- if (uriSchema != null) {
- protocol = uriSchema + "://";
- }
String address = protocol + hostAndPort + (contextRoot.equals("/") && urlPattern.startsWith("/") ? "" : contextRoot) + urlPattern;
httpEp.setAddress(address);
//JBWS-2957: EJB3 binds the same endpoint class to multiple beans at multiple JNDI locations;
10 years, 4 months
JBossWS SVN: r18844 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-13 04:23:56 -0400 (Wed, 13 Aug 2014)
New Revision: 18844
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3514]:Enable tests for wildfly800 and wildfly810
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-13 08:22:11 UTC (rev 18843)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-13 08:23:56 UTC (rev 18844)
@@ -700,9 +700,6 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
-
- <!-- [JBWS-3514] Enable it after backport change to wilfly800 ASIL -->
- <exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
</excludes>
</configuration>
</plugin>
@@ -792,9 +789,6 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
- <!-- [JBWS-3514] Enable it after backport change to wilfly810 ASIL -->
- <exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
-
<!-- [JBWS-3809] Enable it after backport change to wilfly810 ASIL ? -->
<exclude>org/jboss/test/ws/jaxws/cxf/jbws3809/*TestCase*</exclude>
</excludes>
10 years, 4 months
JBossWS SVN: r18843 - in container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices: invocation and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-13 04:22:11 -0400 (Wed, 13 Aug 2014)
New Revision: 18843
Modified:
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java
Log:
[JBWS-3514]:Back port fix to wildfly800 branch
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java 2014-08-13 08:21:37 UTC (rev 18842)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java 2014-08-13 08:22:11 UTC (rev 18843)
@@ -24,6 +24,7 @@
import org.jboss.as.ee.component.BasicComponentInstance;
import org.jboss.as.ee.component.Component;
import org.jboss.as.ee.component.ComponentInstance;
+import org.jboss.as.naming.ManagedReference;
import org.jboss.as.webservices.injection.WSComponent;
import org.jboss.invocation.ImmediateInterceptorFactory;
import org.jboss.invocation.Interceptor;
@@ -44,7 +45,13 @@
@Override
public Object processInvocation(final InterceptorContext interceptorContext) throws Exception {
final WSComponent wsComponent = (WSComponent)interceptorContext.getPrivateData(Component.class);
- final BasicComponentInstance pojoComponentInstance = wsComponent.getComponentInstance();
+ BasicComponentInstance pojoComponentInstance = null;
+ if (interceptorContext.getPrivateData(ManagedReference.class) != null) {
+ ManagedReference reference = interceptorContext.getPrivateData(ManagedReference.class);
+ pojoComponentInstance = (BasicComponentInstance)wsComponent.createInstance(reference.getInstance());
+ } else {
+ pojoComponentInstance = wsComponent.getComponentInstance();
+ }
interceptorContext.putPrivateData(ComponentInstance.class, pojoComponentInstance);
return interceptorContext.proceed();
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java 2014-08-13 08:21:37 UTC (rev 18842)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java 2014-08-13 08:22:11 UTC (rev 18843)
@@ -77,7 +77,7 @@
if (componentView == null) {
componentView = getMSCService(componentViewName, ComponentView.class);
if (componentView == null) {
- throw MESSAGES.cannotFindComponentView(componentViewName);
+ throw MESSAGES.cannotFindComponentView(componentViewName);
}
if (reference == null) {
try {
@@ -103,22 +103,24 @@
try {
// prepare for invocation
onBeforeInvocation(wsInvocation);
- //for spring integration we don't need to go into ee's interceptors
- if(wsInvocation.getInvocationContext().getTargetBean() != null && endpoint.getProperty("SpringBus") != null) {
- this.reference = new ManagedReference() {
- public void release() {
- }
-
- public Object getInstance() {
- return wsInvocation.getInvocationContext().getTargetBean();
- }
- };
- }
// prepare invocation data
final ComponentView componentView = getComponentView();
Component component = componentView.getComponent();
- if (component instanceof WSComponent && endpoint.getProperty("SpringBus") != null) {
- ((WSComponent)component).setReference(reference);
+ //for spring integration and @FactoryType is annotated we don't need to go into ee's interceptors
+ if(wsInvocation.getInvocationContext().getTargetBean() != null
+ && (endpoint.getProperty("SpringBus") != null)
+ || wsInvocation.getInvocationContext().getProperty("forceTargetBean") != null) {
+ this.reference = new ManagedReference() {
+ public void release() {
+ }
+
+ public Object getInstance() {
+ return wsInvocation.getInvocationContext().getTargetBean();
+ }
+ };
+ if (component instanceof WSComponent) {
+ ((WSComponent) component).setReference(reference);
+ }
}
final Method method = getComponentViewMethod(wsInvocation.getJavaMethod(), componentView.getViewMethods());
final InterceptorContext context = new InterceptorContext();
@@ -127,13 +129,16 @@
context.setParameters(wsInvocation.getArgs());
context.putPrivateData(Component.class, component);
context.putPrivateData(ComponentView.class, componentView);
+ if(wsInvocation.getInvocationContext().getProperty("forceTargetBean") != null) {
+ context.putPrivateData(ManagedReference.class, reference);
+ }
// invoke method
final Object retObj = componentView.invoke(context);
// set return value
wsInvocation.setReturnValue(retObj);
}
catch (Throwable t) {
- WSLogger.ROOT_LOGGER.error(MESSAGES.methodInvocationFailed(t.getLocalizedMessage()), t);
+ WSLogger.ROOT_LOGGER.error(MESSAGES.methodInvocationFailed(t.getLocalizedMessage()), t);
handleInvocationException(t);
}
finally {
10 years, 4 months