JBossWS SVN: r18832 - in container/wildfly80/branches/jbossws-wildfly800/server-integration/src: main/java/org/jboss/as/webservices/dmr and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-08-08 09:29:35 -0400 (Fri, 08 Aug 2014)
New Revision: 18832
Modified:
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Attributes.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Constants.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Element.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSServerConfigAttributeHandler.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemReader.java
container/wildfly80/branches/jbossws-wildfly800/server-integration/src/test/java/org/jboss/as/webservices/config/ServerConfigImplTestCase.java
Log:
[JBWS-3750] reverting commit to revision: 18812
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -52,7 +52,6 @@
private final DMRSynchCheckHandler webServicePortUCH = new DMRSynchCheckHandler();
private final DMRSynchCheckHandler webServiceSecurePortUCH = new DMRSynchCheckHandler();
private final DMRSynchCheckHandler modifySOAPAddressUCH = new DMRSynchCheckHandler();
- private final DMRSynchCheckHandler webServicePathRewriteRuleUCH = new DMRSynchCheckHandler();
private ServerConfigImpl() {
// forbidden inheritance
@@ -66,7 +65,6 @@
webServicePortUCH.reset();
webServiceSecurePortUCH.reset();
modifySOAPAddressUCH.reset();
- webServicePathRewriteRuleUCH.reset();
}
public void incrementWSDeploymentCount() {
@@ -91,15 +89,6 @@
setWebServiceHost(host, webServiceHostUCH);
}
- public void setWebServicePathRewriteRule(String path, boolean forceUpdate) {
- setWebServicePathRewriteRule(path, forceUpdate ? null : webServicePathRewriteRuleUCH);
- }
-
- @Override
- public void setWebServicePathRewriteRule(String path) {
- setWebServicePathRewriteRule(path, webServicePathRewriteRuleUCH);
- }
-
public void setWebServicePort(int port, boolean forceUpdate) {
setWebServicePort(port, forceUpdate ? null : webServicePortUCH);
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Attributes.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Attributes.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Attributes.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -61,14 +61,8 @@
.setDefaultValue(new ModelNode(true))
.setAllowExpression(true)
.build();
+ SimpleAttributeDefinition[] SUBSYSTEM_ATTRIBUTES = {MODIFY_WSDL_ADDRESS, WSDL_HOST, WSDL_PORT, WSDL_SECURE_PORT};
- SimpleAttributeDefinition WSDL_PATH_REWRITE_RULE = new SimpleAttributeDefinitionBuilder(Constants.WSDL_PATH_REWRITE_RULE, ModelType.STRING)
- .setAllowNull(true)
- .setAllowExpression(false)
- .build();
-
- SimpleAttributeDefinition[] SUBSYSTEM_ATTRIBUTES = {MODIFY_WSDL_ADDRESS, WSDL_HOST, WSDL_PORT, WSDL_SECURE_PORT, WSDL_PATH_REWRITE_RULE};
-
SimpleAttributeDefinition VALUE = new SimpleAttributeDefinitionBuilder(Constants.VALUE, ModelType.STRING)
.setAllowNull(true)
.setAllowExpression(true)
@@ -83,4 +77,5 @@
.setAllowExpression(true)
.build();
+
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Constants.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Constants.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Constants.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -55,5 +55,4 @@
String HANDLER_NAME="handler-name";
String HANDLER_CLASS="handler-class";
String VALUE = "value";
- String WSDL_PATH_REWRITE_RULE = "wsdl-path-rewrite-rule";
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Element.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Element.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/Element.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -39,7 +39,6 @@
WSDL_HOST(Constants.WSDL_HOST),
WSDL_PORT(Constants.WSDL_PORT),
WSDL_SECURE_PORT(Constants.WSDL_SECURE_PORT),
- WSDL_PATH_REWRITE_RULE(Constants.WSDL_PATH_REWRITE_RULE),
CLIENT_CONFIG(Constants.CLIENT_CONFIG),
ENDPOINT_CONFIG(Constants.ENDPOINT_CONFIG),
CONFIG_NAME(Constants.CONFIG_NAME),
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSServerConfigAttributeHandler.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSServerConfigAttributeHandler.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSServerConfigAttributeHandler.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -25,7 +25,6 @@
import static org.jboss.as.webservices.dmr.Constants.WSDL_HOST;
import static org.jboss.as.webservices.dmr.Constants.WSDL_PORT;
import static org.jboss.as.webservices.dmr.Constants.WSDL_SECURE_PORT;
-import static org.jboss.as.webservices.dmr.Constants.WSDL_PATH_REWRITE_RULE;
import java.net.UnknownHostException;
@@ -108,9 +107,6 @@
} else if (WSDL_SECURE_PORT.equals(attributeName)) {
final int securePort = value != null ? Integer.parseInt(value) : -1;
config.setWebServiceSecurePort(securePort, isRevert);
- } else if (WSDL_PATH_REWRITE_RULE.equals(attributeName)) {
- final String path = value != null ? value : null;
- config.setWebServicePathRewriteRule(path, isRevert);
} else {
throw new IllegalArgumentException(attributeName);
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemAdd.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -26,7 +26,6 @@
import static org.jboss.as.webservices.dmr.Constants.WSDL_HOST;
import static org.jboss.as.webservices.dmr.Constants.WSDL_PORT;
import static org.jboss.as.webservices.dmr.Constants.WSDL_SECURE_PORT;
-import static org.jboss.as.webservices.dmr.Constants.WSDL_PATH_REWRITE_RULE;
import java.net.UnknownHostException;
import java.util.ArrayList;
@@ -113,9 +112,6 @@
if (configuration.hasDefined(WSDL_SECURE_PORT)) {
config.setWebServiceSecurePort(Attributes.WSDL_SECURE_PORT.resolveModelAttribute(context, configuration).asInt());
}
- if (configuration.hasDefined(WSDL_PATH_REWRITE_RULE)) {
- config.setWebServicePathRewriteRule(Attributes.WSDL_PATH_REWRITE_RULE.resolveModelAttribute(context, configuration).asString());
- }
return config;
}
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemReader.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemReader.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSSubsystemReader.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -140,11 +140,6 @@
Attributes.WSDL_SECURE_PORT.parseAndSetParameter(value, subsystem, reader);
break;
}
- case WSDL_PATH_REWRITE_RULE: {
- final String value = parseElementNoAttributes(reader);
- Attributes.WSDL_PATH_REWRITE_RULE.parseAndSetParameter(value, subsystem, reader);
- break;
- }
case ENDPOINT_CONFIG: {
readConfig(reader, address, endpointConfigs, false);
break;
Modified: container/wildfly80/branches/jbossws-wildfly800/server-integration/src/test/java/org/jboss/as/webservices/config/ServerConfigImplTestCase.java
===================================================================
--- container/wildfly80/branches/jbossws-wildfly800/server-integration/src/test/java/org/jboss/as/webservices/config/ServerConfigImplTestCase.java 2014-08-08 08:51:48 UTC (rev 18831)
+++ container/wildfly80/branches/jbossws-wildfly800/server-integration/src/test/java/org/jboss/as/webservices/config/ServerConfigImplTestCase.java 2014-08-08 13:29:35 UTC (rev 18832)
@@ -92,12 +92,6 @@
sc.setWebServiceSecurePort(5435);
}
});
- internalTestSingleAttributeUpdate(new Callback() {
- @Override
- public void setAttribute(ServerConfig sc) throws Exception {
- sc.setWebServicePathRewriteRule("MY/TEST/PATH");
- }
- });
}
@Test
@@ -126,17 +120,10 @@
sc.setWebServiceSecurePort(5435);
}
};
- Callback cbE = new Callback() {
- @Override
- public void setAttribute(ServerConfig sc) throws Exception {
- sc.setWebServicePathRewriteRule("MY/TEST/PATH");
- }
- };
- internalTestMultipleAttributeUpdate(cbA, new Callback[]{cbB, cbC, cbD, cbE});
- internalTestMultipleAttributeUpdate(cbB, new Callback[]{cbA, cbC, cbD, cbE});
- internalTestMultipleAttributeUpdate(cbC, new Callback[]{cbA, cbB, cbD, cbE});
- internalTestMultipleAttributeUpdate(cbD, new Callback[]{cbA, cbB, cbC, cbE});
- internalTestMultipleAttributeUpdate(cbE, new Callback[]{cbA, cbB, cbC, cbD});
+ internalTestMultipleAttributeUpdate(cbA, new Callback[]{cbB, cbC, cbD});
+ internalTestMultipleAttributeUpdate(cbB, new Callback[]{cbA, cbC, cbD});
+ internalTestMultipleAttributeUpdate(cbC, new Callback[]{cbA, cbB, cbD});
+ internalTestMultipleAttributeUpdate(cbD, new Callback[]{cbA, cbB, cbC});
}
protected void internalTestSingleAttributeUpdate(Callback cb) throws Exception {
10 years, 4 months
JBossWS SVN: r18831 - in stack/cxf/trunk/modules: server/src/main/java/org/jboss/wsf/stack/cxf/deployment and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-08-08 04:51:48 -0400 (Fri, 08 Aug 2014)
New Revision: 18831
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.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/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
Log:
[JBWS-3750] Fixing build (broken due to commit 18830) by copying missing classes from rsearls branch; also updating JBWS2150TestCaseForked to test additions
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -0,0 +1,80 @@
+/*
+ * 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.wsf.stack.cxf.addressRewrite;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A map from char to char. The mappings for the most common 256 source
+ * characters are simply kept in a char array. For all other more exotic source
+ * characters, a proper hash map is used to store the mapping.
+ */
+final class CharMap {
+
+ private final char[] map = new char[256];
+ private final Map<Character, Character> extendedMap = new HashMap<Character, Character>();
+
+ /**
+ * Creates a char map with the given source and destination characters. If
+ * the strings do not have the same length, subsequent characters in the
+ * longer string are ignored. The first mapping is defined as
+ * {@code source[0] --> destination[0]}, all other mappings in an analogous
+ * way with matching character indices in the two strings.
+ *
+ * @param source
+ * source characters
+ * @param destination
+ * destination characters
+ * @throws IllegalArgumentException
+ * if any of the destination characters is the zero character
+ */
+ public CharMap(String source, String destination) {
+ add(source, destination);
+ }
+
+ private void add(String source, String destination) {
+ final int len = Math.min(source.length(), destination.length());
+ for (int i = 0; i < len; i++) {
+ add(source.charAt(i), destination.charAt(i));
+ }
+ }
+
+ private void add(char source, char destination) {
+ if (destination == 0) {
+ throw new IllegalArgumentException("cannot map to zero character");
+ }
+ if (source < 256) {
+ map[source] = destination;
+ } else {
+ extendedMap.put(source, destination);
+ }
+ }
+
+ public char map(char source) {
+ if (source < 256) {
+ return map[source];
+ }
+ final Character mapped = extendedMap.get(source);
+ return mapped == null ? 0 : mapped.charValue();
+ }
+}
Property changes on: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -0,0 +1,435 @@
+/*
+ * 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.wsf.stack.cxf.addressRewrite;
+
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+final class SEDProcessor {
+
+ private static enum SEDCommand {
+ SUBSTITUTE, TRANSLATE
+ }
+
+ private static final int[] EMPTY_OCCURRENCE = new int[0];
+
+ private final SEDCommand command;
+ private final String replacement;
+ private final int[] occurrences;
+ private final Pattern regexp;
+ private final SedArguments args;
+ private final CharMap charMap;
+
+ private SEDProcessor(String script, SEDCommand command)
+ {
+ this.command = command;
+ this.args = deriveArgs(script);
+ if (args.isIgnoreCase())
+ {
+ this.regexp = Pattern.compile(getRegexp(args), Pattern.CASE_INSENSITIVE);
+ }
+ else
+ {
+ this.regexp = Pattern.compile(getRegexp(args));
+ }
+ this.replacement = getReplacement(args);
+ this.occurrences = args.isOccurrenceSet() ? args.getOccurrence() : EMPTY_OCCURRENCE;
+ for (int i = 0; i < occurrences.length; i++)
+ {
+ if (occurrences[i] <= 0)
+ {
+ throw new IllegalArgumentException("invalid occurrence index " + occurrences[i] + " in sed command");
+ }
+ }
+ Arrays.sort(occurrences);
+ if (command == SEDCommand.TRANSLATE)
+ {
+ this.charMap = new CharMap(args.getString1(), args.getString2());
+ }
+ else
+ {
+ this.charMap = null;
+ }
+ }
+
+ /**
+ * Returns the regexp operand from args, either called "regexp" or
+ * "string1". If none of the two is set, an empty string is returned.
+ *
+ * @param args
+ * the args with operand values
+ * @return the regexp argument from "regexp" or "string1" or an empty string
+ * of none of the two operands is set
+ */
+ private static String getRegexp(SedArguments args)
+ {
+ if (args.isRegexpSet())
+ {
+ return args.getRegexp();
+ }
+ if (args.isString1Set())
+ {
+ return args.getString1();
+ }
+ return "";
+ }
+
+ /**
+ * Returns the replacement operand from args, either called "replacement" or
+ * "string2". If none of the two is set, an empty string is returned.
+ *
+ * @param args
+ * the args with operand values
+ * @return the replacement argument from "replacement" or "string2" or an
+ * empty string of none of the two operands is set
+ */
+ private static String getReplacement(SedArguments args)
+ {
+ if (args.isReplacementSet())
+ {
+ return args.getReplacement();
+ }
+ if (args.isString2Set())
+ {
+ return args.getString2();
+ }
+ return "";
+ }
+
+ private SedArguments deriveArgs(String script)
+ {
+ final int start = findStartTrimWhitespace(script) + 1;
+ final int mid = indexOfNextDelimiter(script, start);
+ final int end = indexOfNextDelimiter(script, mid);
+ if (mid < 0 || end < 0)
+ {
+ throw new IllegalArgumentException("invalid script for sed command: " + script);
+ }
+ if (command == SEDCommand.SUBSTITUTE)
+ {
+ SedArguments args = parseSubstituteFlags(script, end + 1);
+ args.setRegexp(script.substring(start + 1, mid));
+ args.setReplacement(script.substring(mid + 1, end));
+ return args;
+ }
+ else if (command == SEDCommand.TRANSLATE)
+ {
+ SedArguments args = new SedArguments();
+ args.setScript(script);
+ args.setTranslate(true);
+ final int scriptEnd = findEndTrimWhitespace(script);
+ if (end + 1 < scriptEnd)
+ {
+ throw new IllegalArgumentException("non-whitespace characters found after " + command + " command in sed script: " + script);
+ }
+ args.setString1(script.substring(start + 1, mid));
+ args.setString2(script.substring(mid + 1, end));
+ return args;
+ }
+ else
+ {
+ throw new IllegalStateException();
+ }
+ }
+
+ private static SedArguments parseSubstituteFlags(String script, int start)
+ {
+ final int end = findWhitespace(script, start);
+ if (end < findEndTrimWhitespace(script))
+ {
+ throw new IllegalArgumentException("extra non-whitespace characters found after substitute command in sed script: " + script);
+ }
+ SedArguments args = new SedArguments();
+ args.setScript(script);
+ args.setSubstitute(true);
+ if (start < end)
+ {
+ //g, I flags
+ int index;
+ for (index = end - 1; index >= start; index--)
+ {
+ final char flag = script.charAt(index);
+ if (flag == 'g')
+ {
+ args.setGlobal(true);
+ }
+ else if (flag == 'I')
+ {
+ args.setIgnoreCase(true);
+ }
+ else
+ {
+ break;
+ }
+ }
+ //occurrence index
+ if (index >= start)
+ {
+ final String occurrenceStr = script.substring(start, index + 1);
+ final int occurrence;
+ try
+ {
+ occurrence = Integer.parseInt(occurrenceStr);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("invalid substitute flags in sed script: " + script, e);
+ }
+ if (occurrence <= 0)
+ {
+ throw new IllegalArgumentException("invalid occurrence index " + occurrence + " in sed script: " + script);
+ }
+ args.setOccurrence(occurrence);
+ }
+ }
+ return args;
+ }
+
+ public String processLine(String line)
+ {
+ if (command == SEDCommand.SUBSTITUTE)
+ {
+ final Matcher matcher = regexp.matcher(line);
+ if (matcher.find())
+ {
+ boolean matches = true;
+ final StringBuffer changed = new StringBuffer();//cannot use StringBuilder here since matcher does not support it
+ if (occurrences.length > 0)
+ {
+ int current = 1;
+ for (int i = 0; i < occurrences.length; i++)
+ {
+ final int occurrence = occurrences[i];
+ while (matches && current < occurrence)
+ {
+ matches = matcher.find();
+ current++;
+ }
+ if (matches)
+ {
+ matcher.appendReplacement(changed, replacement);
+ }
+ else
+ {
+ break;
+ }
+ }
+ if (matches && occurrences.length == 1 && args.isGlobal())
+ {
+ matches = matcher.find();
+ while (matches)
+ {
+ matcher.appendReplacement(changed, replacement);
+ matches = matcher.find();
+ }
+ }
+ }
+ else
+ {
+ while (matches)
+ {
+ matcher.appendReplacement(changed, replacement);
+ matches = args.isGlobal() && matcher.find();
+ }
+ }
+ matcher.appendTail(changed);
+ return changed.toString();
+ }
+ else
+ {
+ return line;
+ }
+ }
+ else if (command == SEDCommand.TRANSLATE)
+ {
+ char[] changed = null;
+ final int len = line.length();
+ for (int i = 0; i < len; i++)
+ {
+ final char src = line.charAt(i);
+ final char dst = charMap.map(src);
+ if (dst != 0)
+ {
+ if (changed == null)
+ {
+ changed = new char[len];
+ for (int j = 0; j < i; j++)
+ {
+ changed[j] = line.charAt(j);
+ }
+ }
+ changed[i] = dst;
+ }
+ else
+ {
+ if (changed != null)
+ {
+ changed[i] = src;
+ }
+ }
+ }
+ return changed != null ? String.valueOf(changed) : line;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the index of the next delimiter in the given sed script. The
+ * character at {@code indexOfPreviousDelimiter} is taken as delimiter. The
+ * method handles escaped delimiters and returns -1 if no further delimiter
+ * is found.
+ *
+ * @param script
+ * the script to analyze
+ * @param indexOfPreviousDelimiter
+ * the index of the previous delimiter
+ * @return the index of the next delimiter after
+ * {@code indexOfPreviousDelimiter}, or -1 if no further delimiter
+ * exists of if {@code indexOfNextDelimiter < 0}
+ */
+ private static int indexOfNextDelimiter(String script, int indexOfPreviousDelimiter)
+ {
+ if (indexOfPreviousDelimiter < 0 || script.length() <= indexOfPreviousDelimiter)
+ {
+ return -1;
+ }
+ final char delim = script.charAt(indexOfPreviousDelimiter);
+ if (delim == '\\')
+ {
+ throw new IllegalArgumentException("invalid delimiter '\\' in sed script: " + script);
+ }
+ int index = indexOfPreviousDelimiter;
+ do
+ {
+ index = script.indexOf(delim, index + 1);
+ }
+ while (index >= 0 && isEscaped(script, index));
+ return index;
+ }
+
+ private static boolean isEscaped(String script, int index)
+ {
+ int backslashCount = 0;
+ index--;
+ while (index >= 0 && script.charAt(index) == '\\')
+ {
+ backslashCount++;
+ index--;
+ }
+ // an uneven count of backslashes means that the character at position
+ // index is escaped (an even count of backslashes escapes backslashes)
+ return backslashCount % 2 == 1;
+ }
+
+ /**
+ * Finds and returns the start of the given sequence after trimming
+ * whitespace characters from the left.
+ *
+ * @param s
+ * the character sequence
+ * @return the index containing the first non-whitespace character, or the
+ * length of the character sequence if all characters are blank
+ */
+ private static int findStartTrimWhitespace(CharSequence s)
+ {
+ final int len = s.length();
+ for (int i = 0; i < len; i++)
+ {
+ if (!Character.isWhitespace(s.charAt(i)))
+ {
+ return i;
+ }
+ }
+ return len;
+ }
+
+ /**
+ * Finds and returns the first whitespace character in the given sequence at
+ * or after start. Returns the length of the string if no whitespace is
+ * found.
+ *
+ * @param s
+ * the character sequence
+ * @param start
+ * the first index to consider in the char sequence
+ * @return the index containing the first whitespace character at or after
+ * start, or the length of the character sequence if all characters
+ * are blank
+ */
+ private static int findWhitespace(CharSequence s, int start)
+ {
+ final int len = s.length();
+ for (int i = start; i < len; i++)
+ {
+ if (Character.isWhitespace(s.charAt(i)))
+ {
+ return i;
+ }
+ }
+ return len;
+ }
+
+ /**
+ * Finds and returns the end of the given character sequence after trimming
+ * white space characters from the right. Whitespace characters are defined
+ * by {@link Character#isWhitespace(char)}. .
+ *
+ * @param s
+ * the character sequence
+ * @return the index after the last non-whitespace character, or zero if all
+ * characters are blank
+ */
+ private static int findEndTrimWhitespace(CharSequence s)
+ {
+ for (int i = s.length(); i > 0; i--)
+ {
+ if (!Character.isWhitespace(s.charAt(i - 1)))
+ {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ public static SEDProcessor newInstance(String script)
+ {
+ final int len = script.length();
+ final int scriptStart = findStartTrimWhitespace(script);
+ if (scriptStart < len)
+ {
+ final char firstChar = script.charAt(scriptStart);
+ if (firstChar == 's')
+ {
+ return new SEDProcessor(script, SEDCommand.SUBSTITUTE);
+ }
+ else if (firstChar == 'y')
+ {
+ return new SEDProcessor(script, SEDCommand.TRANSLATE);
+ }
+ }
+ throw new IllegalArgumentException("invalid script");
+ }
+}
\ No newline at end of file
Property changes on: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -0,0 +1,211 @@
+/*
+ * 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.wsf.stack.cxf.addressRewrite;
+
+final class SedArguments
+{
+ private boolean isGlobal = false;
+ private boolean isIgnoreCase = false;
+ private boolean isTranslate = false;
+ private boolean isSubstitute = false;
+ private String script;
+ private boolean scriptIsSet = false;
+ private String regexp;
+ private boolean regexpIsSet = false;
+ private String string1;
+ private boolean string1IsSet = false;
+ private String replacement;
+ private boolean replacementIsSet = false;
+ private String string2;
+ private boolean string2IsSet = false;
+ private int[] occurrence;
+ private boolean occurrenceIsSet = false;
+
+ /**
+ * Constructor to use if no options are specified.
+ */
+ public SedArguments()
+ {
+
+ }
+
+ public String getScript()
+ {
+ if (scriptIsSet)
+ {
+ return script;
+ }
+ throw new IllegalStateException("operand has not been set: " + script);
+ }
+
+ public boolean isScriptSet()
+ {
+ return scriptIsSet;
+ }
+
+ public void setScript(String script)
+ {
+ this.script = script;
+ this.scriptIsSet = true;
+ }
+
+ public String getRegexp()
+ {
+ if (regexpIsSet)
+ {
+ return regexp;
+ }
+ throw new IllegalStateException("operand has not been set: " + regexp);
+ }
+
+ public boolean isRegexpSet()
+ {
+ return regexpIsSet;
+ }
+
+ public void setRegexp(String regexp)
+ {
+ this.regexp = regexp;
+ this.regexpIsSet = true;
+ }
+
+ public String getString1()
+ {
+ if (string1IsSet)
+ {
+ return string1;
+ }
+ throw new IllegalStateException("operand has not been set: " + string1);
+ }
+
+ public boolean isString1Set()
+ {
+ return string1IsSet;
+ }
+
+ public void setString1(String string1)
+ {
+ this.string1 = string1;
+ this.string1IsSet = true;
+ }
+
+ public String getReplacement()
+ {
+ if (replacementIsSet)
+ {
+ return replacement;
+ }
+ throw new IllegalStateException("operand has not been set: " + replacement);
+ }
+
+ public boolean isReplacementSet()
+ {
+ return replacementIsSet;
+ }
+
+ public void setReplacement(String replacement)
+ {
+ this.replacement = replacement;
+ this.replacementIsSet = true;
+ }
+
+ public String getString2()
+ {
+ if (string2IsSet)
+ {
+ return string2;
+ }
+ throw new IllegalStateException("operand has not been set: " + string2);
+ }
+
+ public boolean isString2Set()
+ {
+ return string2IsSet;
+ }
+
+ public void setString2(String string2)
+ {
+ this.string2 = string2;
+ this.string2IsSet = true;
+ }
+
+ public int[] getOccurrence()
+ {
+ if (occurrenceIsSet)
+ {
+ return occurrence;
+ }
+ throw new IllegalStateException("operand has not been set: " + occurrence);
+ }
+
+ public boolean isOccurrenceSet()
+ {
+ return occurrenceIsSet;
+ }
+
+ public void setOccurrence(int... occurrence)
+ {
+ this.occurrence = occurrence;
+ this.occurrenceIsSet = true;
+ }
+
+ public boolean isGlobal()
+ {
+ return isGlobal;
+ }
+
+ public boolean isIgnoreCase()
+ {
+ return isIgnoreCase;
+ }
+
+ public boolean isSubstitute()
+ {
+ return isSubstitute;
+ }
+
+ public boolean isTranslate()
+ {
+ return isTranslate;
+ }
+
+ public void setGlobal(boolean isGlobal)
+ {
+ this.isGlobal = isGlobal;
+ }
+
+ public void setIgnoreCase(boolean isIgnoreCase)
+ {
+ this.isIgnoreCase = isIgnoreCase;
+ }
+
+ public void setTranslate(boolean isTranslate)
+ {
+ this.isTranslate = isTranslate;
+ }
+
+ public void setSubstitute(boolean isSubstitute)
+ {
+ this.isSubstitute = isSubstitute;
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
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-07 17:03:51 UTC (rev 18830)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -157,7 +157,7 @@
JaxWsImplementorInfo info = new JaxWsImplementorInfo(getImplementorClass());
wsdlLocation = info.getWsdlLocation();
}
- updateCodeFirstSoapAddress();
+ updateSoapAddress();
wsdlPublisher.publishWsdlFiles(service.getName(), wsdlLocation, this.getBus(), service.getServiceInfos());
}
catch (IOException ioe)
@@ -206,7 +206,7 @@
* For both code-first and wsdl-first scenarios, reset the endpoint address
* so that it is written to the generated wsdl file.
*/
- private void updateCodeFirstSoapAddress() {
+ private void updateSoapAddress() {
ServerConfig servConfig = getServerConfig();
if (servConfig.isModifySOAPAddress()) {
//- code-first handling
Added: 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 (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -0,0 +1,51 @@
+/*
+ * 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.wsf.stack.cxf.interceptor;
+
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.jboss.wsf.stack.cxf.interceptor.util.WSDLSoapAddressRewriteUtils;
+
+/**
+ * This inInterceptor registers a custom WSDLGetUtils which will preform the desired
+ * soap:address rewrite
+ *
+ * @author rsearls(a)redhat.com
+ * @since 19-May-2014
+ */
+public class WSDLSoapAddressRewriteInterceptor extends AbstractPhaseInterceptor<Message> {
+ public static final WSDLSoapAddressRewriteInterceptor INSTANCE =
+ new WSDLSoapAddressRewriteInterceptor();
+
+ public WSDLSoapAddressRewriteInterceptor() {
+ // this must run before WSDLGetInterceptor which is in Phase.READ
+ super(Phase.POST_STREAM);
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ message.setContextualProperty(WSDLGetUtils.class.getName(), new WSDLSoapAddressRewriteUtils());
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: 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 (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -0,0 +1,69 @@
+/*
+ * 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.wsf.stack.cxf.interceptor.util;
+
+import java.security.AccessController;
+
+import javax.wsdl.Definition;
+
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
+
+/**
+ * This is an extension of the org.apache.cxf.frontend.WSDLGetUtils; currently this
+ * is needed for properly setting the publishedEndpointURL in the code-first scenario
+ * when a path rewrite rule is specified in the server configuration.
+ *
+ * @author rsearls(a)redhat.com
+ *
+ */
+public class WSDLSoapAddressRewriteUtils extends WSDLGetUtils {
+
+ @Override
+ public String getPublishableEndpointUrl(Definition def, String epurl,
+ EndpointInfo endpointInfo){
+
+ if (endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL) != null) {
+ epurl = String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
+ updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+ } else {
+ // When using replacement path, must set replacement path in the active url.
+ final ServerConfig sc = getServerConfig();
+ if (SoapAddressRewriteHelper.isPathRewriteRequired(sc)
+ && endpointInfo.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)) {
+ epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(epurl, sc);
+ updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+ }
+ }
+ return epurl;
+ }
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+}
Property changes on: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-08-07 17:03:51 UTC (rev 18830)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-08-08 08:51:48 UTC (rev 18831)
@@ -119,6 +119,7 @@
protected static Boolean modifySOAPAddress;
protected static String webServiceHost;
+ protected static String webServicePath;
public JBWS2150TestSetup() {
super(JBWS2150TestCaseForked.class, null);
@@ -128,6 +129,7 @@
{
modifySOAPAddress = (Boolean)getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "ModifySOAPAddress");
webServiceHost = (String)getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServiceHost");
+ webServicePath = (String)getServer().getAttribute(SERVER_CONFIG_OBJECT_NAME, "WebServicePathRewriteRule");
super.setUp();
}
}
@@ -143,6 +145,8 @@
getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
attr = new Attribute("WebServiceHost", JBWS2150TestSetup.webServiceHost);
getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ attr = new Attribute("WebServicePathRewriteRule", JBWS2150TestSetup.webServicePath);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
}
private String getWebServiceHost() {
@@ -570,6 +574,168 @@
}
}
+ /**
+ * Test soap:address rewrite when a path rewrite rule is specified.
+ *
+ * @throws Exception
+ */
+ public void testRewriteWithPathRule() throws Exception
+ {
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150";
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePathRewriteRule(sedCmd);
+ deploy("jaxws-jbws2150.war");
+ try
+ {
+ final String serverHost = getServerHost();
+ final List<String> wsdlLocations = new LinkedList<String>();
+ wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/ValidURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/ValidSecureURL?wsdl");
+ wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidSecureURL?wsdl");
+
+ for (final String wsdlLocation : wsdlLocations)
+ {
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + serverHost + ":8080/" + expectedContext + "/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + serverHost + ":8080/" + expectedContext + "/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("https://" + serverHost + ":8443/" + expectedContext + "/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("https://" + serverHost + ":8443/" + expectedContext + "/InvalidSecureURL", address);
+
+ //check wsdl import (which is bound to the endpoint currently serving the wsdl)
+ assertTrue(getWsdlImportAddress(definition).contains(expectedContext));
+ }
+ }
+ finally
+ {
+ undeploy("jaxws-jbws2150.war");
+ }
+ }
+
+ /**
+ * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified
+ *
+ * @throws Exception
+ */
+ public void testRewriteCodeFirstPathRule() throws Exception
+ {
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150-codefirst";
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePathRewriteRule(sedCmd);
+ deploy("jaxws-jbws2150-codefirst.war");
+ try
+ {
+ final String serverHost = getServerHost();
+ final String wsdlLocation = "http://" + serverHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + serverHost + ":8080/" + expectedContext +"/CodeFirstService", address);
+ }
+ finally
+ {
+ undeploy("jaxws-jbws2150-codefirst.war");
+ }
+ }
+
+ /**
+ * Test soap:address rewrite for code-first endpoints when a path rewrite rule is specified and auto-rewrite is on
+ * (wsdl host prop set to ServerConfig.UNDEFINED_HOSTNAME)
+ *
+ * @throws Exception
+ */
+ public void testAutoRewriteCodeFirstPathRule() throws Exception
+ {
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150-codefirst";
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePathRewriteRule(sedCmd);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deploy("jaxws-jbws2150-codefirst.war");
+ try
+ {
+ String serverHost = getServerHost();
+ final String wsdlLocation = "http://" + serverHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + serverHost + ":8080/" + expectedContext +"/CodeFirstService", address);
+ if (isTestsuiteServerHostLocalhost()) {
+ definition = getWSDLDefinition("http://127.0.0.1:8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
+ address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://127.0.0.1:8080/" + expectedContext +"/CodeFirstService", address);
+ }
+ }
+ finally
+ {
+ undeploy("jaxws-jbws2150-codefirst.war");
+ }
+ }
+
+ /**
+ * Test soap:address rewrite with host configured to ServerConfig.UNDEFINED_HOSTNAME and path rewrite rule specified
+ *
+ * @throws Exception
+ */
+ public void testAutoRewritePathRule() throws Exception
+ {
+ setModifySOAPAddress(true);
+ final String expectedContext = "xx/jaxws-jbws2150";
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePathRewriteRule(sedCmd);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deploy("jaxws-jbws2150.war");
+ try
+ {
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
+ final String serverHost = getServerHost();
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/ValidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
+ }
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
+ Definition definition = getWSDLDefinition(wsdlLocation);
+
+ String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
+ assertEquals("http://" + host + ":8080/" + expectedContext + "/ValidURL", address);
+
+ address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
+ assertEquals("http://" + host + ":8080/" + expectedContext + "/InvalidURL", address);
+
+ address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
+ assertEquals("http://" + host + ":8080/" + expectedContext + "/ValidSecureURL", address);
+
+ address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
+ assertEquals("http://" + host + ":8080/" + expectedContext + "/InvalidSecureURL", address);
+
+ //check wsdl import (which is bound to the endpoint currently serving the wsdl)
+ assertTrue(getWsdlImportAddress(definition).contains(expectedContext));
+ }
+ }
+ finally
+ {
+ undeploy("jaxws-jbws2150.war");
+ }
+ }
+
private void checkWsdlAndInvokeCodeFirstEndpoint(String testHost, String expectedWsdlHost, boolean setTargetAddress) throws Exception {
final String addr = "http://" + testHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService";
final String wsdlLocation = addr + "?wsdl";
@@ -600,6 +766,12 @@
Attribute attr = new Attribute("WebServiceHost", value);
getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
}
+
+ public void setWebServicePathRewriteRule(String value) throws Exception
+ {
+ Attribute attr = new Attribute("WebServicePathRewriteRule", value);
+ getServer().setAttribute(SERVER_CONFIG_OBJECT_NAME, attr);
+ }
private ServiceIface getEndpoint(String wsdlLocation, String serviceName) throws Exception
{
10 years, 4 months
JBossWS SVN: r18830 - in stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf: deployment and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-08-07 13:03:51 -0400 (Thu, 07 Aug 2014)
New Revision: 18830
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/deployment/EndpointImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
Log:
[JBWS-3750] code addition and corresponding test
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-07 14:56:37 UTC (rev 18829)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-08-07 17:03:51 UTC (rev 18830)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -32,6 +32,7 @@
* Helper for rewriting soap:address in published wsdl
*
* @author alessio.soldano(a)jboss.com
+ * @author rsears(a)redhat.com
* @since 30-Nov-2012
*/
public class SoapAddressRewriteHelper
@@ -64,6 +65,41 @@
}
}
+ /**
+ * 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.
+ *
+ * @param address The container computed endpoint address
+ * @param serverConfig The current ServerConfig
+ * @return
+ */
+ public static String getRewrittenPublishedEndpointUrl(String address, ServerConfig serverConfig)
+ {
+ try
+ {
+ 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);
+
+ ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl);
+ return newUrl;
+ }
+ else
+ {
+ ADDRESS_REWRITE_LOGGER.rewriteNotRequired(address);
+ return address;
+ }
+ }
+ catch (Exception e)
+ {
+ ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(address, "");
+ return address;
+ }
+ }
+
public static boolean isAutoRewriteOn(ServerConfig serverConfig)
{
return serverConfig.isModifySOAPAddress() && ServerConfig.UNDEFINED_HOSTNAME.equals(serverConfig.getWebServiceHost());
@@ -142,7 +178,21 @@
port = ":" + portNo;
}
}
- String urlStr = uriScheme + "://" + host + port + path;
+
+ StringBuilder sb = new StringBuilder(uriScheme);
+ sb.append("://");
+ sb.append(host);
+ sb.append(port);
+
+ if (isPathRewriteRequired(serverConfig)) {
+ sb.append(SEDProcessor.newInstance(serverConfig.getWebServicePathRewriteRule()).processLine(path));
+ }
+ else
+ {
+ sb.append(path);
+ }
+ final String urlStr = sb.toString();
+
ADDRESS_REWRITE_LOGGER.addressRewritten(origAddress, urlStr);
return urlStr;
}
@@ -166,4 +216,13 @@
return HTTP;
}
}
+
+
+ public static boolean isPathRewriteRequired(ServerConfig sc){
+ if (!sc.isModifySOAPAddress()) {
+ return false;
+ }
+ final String pathRewriteRule = sc.getWebServicePathRewriteRule();
+ return pathRewriteRule != null && !pathRewriteRule.isEmpty();
+ }
}
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-07 14:56:37 UTC (rev 18829)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-08-07 17:03:51 UTC (rev 18830)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -22,7 +22,10 @@
package org.jboss.wsf.stack.cxf.deployment;
import java.io.IOException;
+import java.security.AccessController;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -30,12 +33,22 @@
import org.apache.cxf.Bus;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
+import org.apache.cxf.message.Message;
import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
import org.jboss.ws.common.configuration.ConfigHelper;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.metadata.config.CommonConfig;
import org.jboss.wsf.stack.cxf.Loggers;
+import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
+import org.jboss.wsf.stack.cxf.interceptor.WSDLSoapAddressRewriteInterceptor;
+
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
* JBossWS integration needs.
@@ -64,6 +77,11 @@
{
super.getServerFactory().setBlockPostConstruct(true);
super.doPublish(addr);
+
+ // A custom interceptor is required when the server config attributes for rewriting
+ // the path in a WSDL URL (i.e., <soap:address location= ...) are set
+ replaceWSDLGetInterceptor();
+
//allow for configuration so that the wsdlPublisher can be set be the JBossWSCXFConfigurer
configureObject(this);
setupConfigHandlers();
@@ -72,6 +90,18 @@
}
/**
+ * Add interceptor that enables the desired soap:address rewrite
+ */
+ private void replaceWSDLGetInterceptor(){
+ if (SoapAddressRewriteHelper.isPathRewriteRequired(getServerConfig())) {
+ List<Interceptor<? extends Message>> inInterceptors = getInInterceptors();
+ if(!inInterceptors.contains(WSDLSoapAddressRewriteInterceptor.INSTANCE)){
+ inInterceptors.add(WSDLSoapAddressRewriteInterceptor.INSTANCE);
+ }
+ }
+ }
+
+ /**
* Sets the JAXWS endpoint config for the current endpoint. This is called by configurer when
* org.apache.cxf.jaxws.EndpointImpl#getServer(..) executes 'configureObject(this)'
*
@@ -111,8 +141,7 @@
/**
* Publish the contract to a file using the configured wsdl publisher
- *
- * @param endpoint
+ *
*/
protected void publishContractToFilesystem()
{
@@ -128,6 +157,7 @@
JaxWsImplementorInfo info = new JaxWsImplementorInfo(getImplementorClass());
wsdlLocation = info.getWsdlLocation();
}
+ updateCodeFirstSoapAddress();
wsdlPublisher.publishWsdlFiles(service.getName(), wsdlLocation, this.getBus(), service.getServiceInfos());
}
catch (IOException ioe)
@@ -172,4 +202,38 @@
this.wsdlPublisher = wsdlPublisher;
}
+ /**
+ * For both code-first and wsdl-first scenarios, reset the endpoint address
+ * so that it is written to the generated wsdl file.
+ */
+ private void updateCodeFirstSoapAddress() {
+ ServerConfig servConfig = getServerConfig();
+ if (servConfig.isModifySOAPAddress()) {
+ //- code-first handling
+ List<ServiceInfo> sevInfos = getServer().getEndpoint().getService().getServiceInfos();
+ for (ServiceInfo si: sevInfos){
+ Collection<EndpointInfo > epInfos = si.getEndpoints();
+ for(EndpointInfo ei: epInfos){
+ String publishedEndpointUrl = (String)ei.getProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL);
+ if (publishedEndpointUrl != null){
+ ei.setAddress(publishedEndpointUrl);
+ } else {
+ //- wsdl-first handling
+ if (ei.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)){
+ String epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ei.getAddress(), servConfig);
+ ei.setAddress(epurl);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
}
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-07 14:56:37 UTC (rev 18829)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-08-07 17:03:51 UTC (rev 18830)
@@ -293,7 +293,7 @@
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);
-
+
String rewrittenWsdlAddress = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(wsdlAddress, ddep.getAddress(), sc);
//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",
@@ -307,7 +307,8 @@
} else {
//same comment as above regarding auto rewrite...
if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
- ddep.setPublishedEndpointUrl(ddep.getAddress()); //force computed address for code first endpoints
+ //force computed address for code first endpoints
+ ddep.setPublishedEndpointUrl(SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ddep.getAddress(), sc));
}
}
}
@@ -362,5 +363,5 @@
return sb.toString();
}
-
+
}
10 years, 4 months
JBossWS SVN: r18829 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-08-07 10:56:37 -0400 (Thu, 07 Aug 2014)
New Revision: 18829
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
Updating excludes
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-07 12:29:18 UTC (rev 18828)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-07 14:56:37 UTC (rev 18829)
@@ -701,7 +701,7 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
- <!-- Enable it after backport change to wilfly800 ASIL -->
+ <!-- [JBWS-3514] Enable it after backport change to wilfly800 ASIL -->
<exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
</excludes>
</configuration>
@@ -792,10 +792,10 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
- <!-- Enable it after backport change to wilfly810 ASIL -->
+ <!-- [JBWS-3514] Enable it after backport change to wilfly810 ASIL -->
<exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
- <!-- Enable it after backport change to wilfly810 ASIL ? -->
+ <!-- [JBWS-3809] Enable it after backport change to wilfly810 ASIL ? -->
<exclude>org/jboss/test/ws/jaxws/cxf/jbws3809/*TestCase*</exclude>
</excludes>
</configuration>
@@ -886,10 +886,6 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
-
- <!-- Enable it after merge to wildfly9 -->
- <exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
-
</excludes>
</configuration>
</plugin>
10 years, 4 months
JBossWS SVN: r18828 - stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/main.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-08-07 08:29:18 -0400 (Thu, 07 Aug 2014)
New Revision: 18828
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/main/module.xml
Log:
[JBWS-3810] Also fix WFLY 8 integration
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/main/module.xml 2014-08-07 00:48:28 UTC (rev 18827)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/main/module.xml 2014-08-07 12:29:18 UTC (rev 18828)
@@ -51,6 +51,7 @@
<module name="org.apache.neethi" />
<module name="org.apache.ws.xmlschema" />
<module name="org.codehaus.woodstox" />
+ <module name="org.apache.xml-resolver" />
<module name="org.springframework.spring" optional="true">
<imports>
<include path="META-INF"/>
10 years, 4 months
JBossWS SVN: r18827 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-06 20:48:28 -0400 (Wed, 06 Aug 2014)
New Revision: 18827
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
Only temporarily exclude JBWS3809TestCase for Wildfly810
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-07 00:46:27 UTC (rev 18826)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-07 00:48:28 UTC (rev 18827)
@@ -703,9 +703,6 @@
<!-- Enable it after backport change to wilfly800 ASIL -->
<exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
-
- <!-- Enable it after backport change to wilfly800 ASIL ? -->
- <exclude>org/jboss/test/ws/jaxws/cxf/jbws3809/*TestCase*</exclude>
</excludes>
</configuration>
</plugin>
10 years, 4 months
JBossWS SVN: r18826 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-06 20:46:27 -0400 (Wed, 06 Aug 2014)
New Revision: 18826
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
Temporarily exclude JBWS3809TestCase.Enable it after backport fix to WFLY8.x integration layer
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-06 07:18:31 UTC (rev 18825)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-07 00:46:27 UTC (rev 18826)
@@ -703,6 +703,9 @@
<!-- Enable it after backport change to wilfly800 ASIL -->
<exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
+
+ <!-- Enable it after backport change to wilfly800 ASIL ? -->
+ <exclude>org/jboss/test/ws/jaxws/cxf/jbws3809/*TestCase*</exclude>
</excludes>
</configuration>
</plugin>
@@ -791,8 +794,12 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
+
<!-- Enable it after backport change to wilfly810 ASIL -->
<exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
+
+ <!-- Enable it after backport change to wilfly810 ASIL ? -->
+ <exclude>org/jboss/test/ws/jaxws/cxf/jbws3809/*TestCase*</exclude>
</excludes>
</configuration>
</plugin>
10 years, 4 months
JBossWS SVN: r18825 - in stack/cxf/trunk/modules: testsuite and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-08-06 03:18:31 -0400 (Wed, 06 Aug 2014)
New Revision: 18825
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/session/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/session/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/session/WEB-INF/web.xml
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3514]:Support cxf @FactoryType annotation
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2014-07-29 18:00:00 UTC (rev 18824)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2014-08-06 07:18:31 UTC (rev 18825)
@@ -126,9 +126,13 @@
} else if (o != null) {
params = new MessageContentsList(o);
}
+ if (factory != null)
+ {
+ targetBean = this.getServiceObject(exchange);
+ }
return invoke(exchange, targetBean, adjustMethodAndParams(md.getMethod(bop), exchange, params, targetBean.getClass()), params);
}
-
+
/**
* This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBossWS integration logic
* to invoke the JBoss AS target bean.
@@ -139,8 +143,10 @@
{
Endpoint ep = exchange.get(Endpoint.class);
final InvocationHandler invHandler = ep.getInvocationHandler();
- final Invocation inv = createInvocation(invHandler, ep, m, paramArray);
-
+ final Invocation inv = createInvocation(invHandler, serviceObject, ep, m, paramArray);
+ if (factory != null) {
+ inv.getInvocationContext().setProperty("forceTargetBean", true);
+ }
Bus threadBus = BusFactory.getThreadDefaultBus(false);
BusFactory.setThreadDefaultBus(null);
setNamespaceContextSelector(exchange);
@@ -155,12 +161,12 @@
}
}
- private Invocation createInvocation(InvocationHandler invHandler, Endpoint ep, Method m, Object[] paramArray) {
+ private Invocation createInvocation(InvocationHandler invHandler, Object serviceObject, Endpoint ep, Method m, Object[] paramArray) {
Invocation inv = invHandler.createInvocation();
InvocationContext invContext = inv.getInvocationContext();
WebServiceContext wsCtx = new WebServiceContextImpl(null);
invContext.addAttachment(WebServiceContext.class, wsCtx);
- invContext.setTargetBean(targetBean);
+ invContext.setTargetBean(serviceObject);
inv.setJavaMethod(m);
inv.setArgs(paramArray);
return inv;
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpoint.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpoint.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpoint.java 2014-08-06 07:18:31 UTC (rev 18825)
@@ -0,0 +1,31 @@
+/*
+ * 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.samples.session;
+
+import javax.jws.WebService;
+
+@WebService
+public interface SessionEndpoint
+{
+ String setNumber(int value);
+ String getNumber();
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpoint.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/samples/session/SessionEndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointImpl.java 2014-08-06 07:18:31 UTC (rev 18825)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.samples.session;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.annotations.FactoryType;
+
+@WebService(serviceName = "SessionService", endpointInterface = "org.jboss.test.ws.jaxws.samples.session.SessionEndpoint", targetNamespace="http://jboss.org/jaxws-samples-session")
+(a)FactoryType(FactoryType.Type.Session)
+public class SessionEndpointImpl implements SessionEndpoint
+{
+ String result;
+ public String setNumber(int value)
+ {
+ System.out.println("Set value " + value + "to " + this);
+ result = "Number is " + value;
+ return result;
+ }
+
+ public String getNumber() {
+ System.out.println("Get value from " + this);
+ return result;
+ }
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointImpl.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/samples/session/SessionEndpointTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java 2014-08-06 07:18:31 UTC (rev 18825)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.samples.session;
+
+import java.io.File;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+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;
+
+/**
+ * Test to demonstrate enable session with cxf <code>@FactoryType</code>
+ * annotation
+ *
+ * @author ema(a)redhat.com
+ */
+public class SessionEndpointTestCase extends JBossWSTest
+{
+ private String targetNS = "http://jboss.org/jaxws-samples-session";
+
+ private SessionEndpoint proxy;
+
+ public static BaseDeployment<?>[] createDeployments()
+ {
+ List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
+ list.add(new JBossWSTestHelper.WarDeployment("jaxws-samples-session.war")
+ {
+ {
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n" + "Dependencies: org.apache.cxf.impl\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.session.SessionEndpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.session.SessionEndpointImpl.class)
+ .setWebXML(
+ new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/session/WEB-INF/web.xml"));
+ }
+ });
+ return list.toArray(new BaseDeployment<?>[list.size()]);
+ }
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(SessionEndpointTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ }
+
+ public void testSession() throws Exception
+ {
+ SessionEndpoint proxy = this.createPort();
+ SessionEndpoint proxy2 = this.createPort();
+ ((BindingProvider) proxy).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+ ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:8080/jaxws-samples-session/session");
+ ((BindingProvider) proxy2).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
+ ((BindingProvider) proxy2).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:8080/jaxws-samples-session/session");
+ proxy.setNumber(10);
+ assertEquals("Number is 10", proxy.getNumber());
+ proxy2.setNumber(20);
+ assertEquals("Number is 20", proxy2.getNumber());
+ assertEquals("Number is 10", proxy.getNumber());
+ }
+
+ public SessionEndpoint createPort() throws Exception
+ {
+ QName serviceName = new QName(targetNS, "SessionService");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-session/session?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ proxy = (SessionEndpoint) service.getPort(SessionEndpoint.class);
+ return proxy;
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/session/WEB-INF/web.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/session/WEB-INF/web.xml (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/session/WEB-INF/web.xml 2014-08-06 07:18:31 UTC (rev 18825)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
+ version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <servlet>
+ <servlet-name>SessionService</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.samples.session.SessionEndpointImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>SessionService</servlet-name>
+ <url-pattern>/session</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/samples/session/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-07-29 18:00:00 UTC (rev 18824)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-08-06 07:18:31 UTC (rev 18825)
@@ -700,6 +700,9 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
+
+ <!-- Enable it after backport change to wilfly800 ASIL -->
+ <exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
</excludes>
</configuration>
</plugin>
@@ -788,6 +791,8 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
+ <!-- Enable it after backport change to wilfly810 ASIL -->
+ <exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
</excludes>
</configuration>
</plugin>
@@ -877,6 +882,10 @@
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
+
+ <!-- Enable it after merge to wildfly9 -->
+ <exclude>org/jboss/test/ws/jaxws/samples/session/*TestCase*</exclude>
+
</excludes>
</configuration>
</plugin>
10 years, 4 months