JBossWS SVN: r18705 - in stack/cxf/trunk/modules/resources/src/main/resources/modules: wildfly800/org/apache/httpcomponents and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-30 10:05:25 -0400 (Fri, 30 May 2014)
New Revision: 18705
Added:
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/asyncclient/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/asyncclient/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/asyncclient/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/asyncclient/module.xml
Log:
[JBWS-3630] Adding missing module.xml files
Added: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/asyncclient/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/asyncclient/module.xml (rev 0)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/asyncclient/module.xml 2014-05-30 14:05:25 UTC (rev 18705)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2014, Red Hat, Inc., 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.
+ -->
+
+<module xmlns="urn:jboss:module:1.3" name="org.apache.httpcomponents" slot="asyncclient">
+ <properties>
+ <property name="jboss.api" value="private"/>
+ </properties>
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="org.apache.commons.codec"/>
+ <module name="org.apache.commons.logging"/>
+ </dependencies>
+</module>
Property changes on: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/httpcomponents/asyncclient/module.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/asyncclient/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/asyncclient/module.xml (rev 0)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/asyncclient/module.xml 2014-05-30 14:05:25 UTC (rev 18705)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2014, Red Hat, Inc., 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.
+ -->
+
+<module xmlns="urn:jboss:module:1.3" name="org.apache.httpcomponents" slot="asyncclient">
+ <properties>
+ <property name="jboss.api" value="private"/>
+ </properties>
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="org.apache.commons.codec"/>
+ <module name="org.apache.commons.logging"/>
+ </dependencies>
+</module>
Property changes on: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/httpcomponents/asyncclient/module.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
10 years, 6 months
JBossWS SVN: r18704 - in stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor: util and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-05-29 16:24:44 -0400 (Thu, 29 May 2014)
New Revision: 18704
Added:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java
Log:
returning new classes
Added: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-29 20:24:44 UTC (rev 18704)
@@ -0,0 +1,120 @@
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.util.UrlUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.frontend.WSDLGetInterceptor;
+import org.apache.cxf.frontend.WSDLGetOutInterceptor;
+import org.apache.cxf.interceptor.*;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
+import org.jboss.wsf.stack.cxf.interceptor.util.WSDLSoapAddressRewriteUtils;
+import org.w3c.dom.Document;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This is a customization of org.apache.cxf.frontend.WSDLGetInterceptor. It
+ * enables the handling of rewriting the path of a URL.
+ * Date: 5/19/14
+ */
+public class WSDLSoapAddressRewriteInterceptor extends AbstractPhaseInterceptor<Message> {
+ public static final WSDLSoapAddressRewriteInterceptor INSTANCE =
+ new WSDLSoapAddressRewriteInterceptor();
+ private static final String TRANSFORM_SKIP = "transform.skip";
+ private Interceptor<Message> wsdlGetOutInterceptor = WSDLGetOutInterceptor.INSTANCE;
+
+ public WSDLSoapAddressRewriteInterceptor() {
+ super(Phase.READ);
+ getAfter().add(EndpointSelectionInterceptor.class.getName());
+ }
+
+ public WSDLSoapAddressRewriteInterceptor(Interceptor<Message> outInterceptor) {
+ this();
+ // Let people override the wsdlGetOutInterceptor
+ wsdlGetOutInterceptor = outInterceptor;
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+ String query = (String)message.get(Message.QUERY_STRING);
+
+ if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
+ return;
+ }
+
+ String baseUri = (String)message.get(Message.REQUEST_URL);
+ String ctx = (String)message.get(Message.PATH_INFO);
+
+ Map<String, String> map = UrlUtils.parseQueryString(query);
+ if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) {
+ Document doc = getDocument(message, baseUri, map, ctx);
+
+ Endpoint e = message.getExchange().get(Endpoint.class);
+ Message mout = new MessageImpl();
+ mout.setExchange(message.getExchange());
+ mout = e.getBinding().createMessage(mout);
+ mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
+ message.getExchange().setOutMessage(mout);
+
+ mout.put(WSDLGetInterceptor.DOCUMENT_HOLDER, doc);
+ mout.put(Message.CONTENT_TYPE, "text/xml");
+
+ // just remove the interceptor which should not be used
+ cleanUpOutInterceptors(mout);
+
+ // notice this is being added after the purge above, don't swap the order!
+ mout.getInterceptorChain().add(wsdlGetOutInterceptor);
+
+ message.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE);
+ // skip the service executor and goto the end of the chain.
+ message.getInterceptorChain().doInterceptStartingAt(
+ message,
+ OutgoingChainInterceptor.class.getName());
+ }
+ }
+
+ protected void cleanUpOutInterceptors(Message outMessage) {
+ // TODO - how can I improve this to provide a specific interceptor chain that just has the
+ // stax, gzip and message sender components, while also ensuring that GZIP is only provided
+ // if its already configured for the endpoint.
+ Iterator<Interceptor<? extends Message>> iterator = outMessage.getInterceptorChain().iterator();
+ while (iterator.hasNext()) {
+ Interceptor<? extends Message> inInterceptor = iterator.next();
+ if (!inInterceptor.getClass().equals(StaxOutInterceptor.class)
+ && !inInterceptor.getClass().equals(GZIPOutInterceptor.class)
+ && !inInterceptor.getClass().equals(MessageSenderInterceptor.class)) {
+ outMessage.getInterceptorChain().remove(inInterceptor);
+ }
+ }
+
+ }
+
+ private Document getDocument(Message message, String base, Map<String, String> params, String ctxUri) {
+ // cannot have two wsdl's being generated for the same endpoint at the same
+ // time as the addresses may get mixed up
+ // For WSDL's the WSDLWriter does not share any state between documents.
+ // For XSD's, the WSDLSoapAddressRewriteUtils makes a copy of any XSD schema documents before updating
+ // any addresses and returning them, so for both WSDL and XSD this is the only part that needs
+ // to be synchronized.
+ synchronized (message.getExchange().getEndpoint()) {
+ return new WSDLSoapAddressRewriteUtils().getDocument(message, base, params, ctxUri,
+ message.getExchange().getEndpoint().getEndpointInfo());
+ }
+ }
+
+ private boolean isRecognizedQuery(Map<String, String> map, String baseUri, String ctx,
+ EndpointInfo endpointInfo) {
+ if (map.containsKey("wsdl") || map.containsKey("xsd")) {
+ return true;
+ }
+ return false;
+ }
+
+}
Added: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/util/WSDLSoapAddressRewriteUtils.java 2014-05-29 20:24:44 UTC (rev 18704)
@@ -0,0 +1,245 @@
+package org.jboss.wsf.stack.cxf.interceptor.util;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.catalog.OASISCatalogManager;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.apache.cxf.frontend.WSDLQueryException;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.ResourceManagerWSDLLocator;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.stack.cxf.addressRewrite.SEDProcessor;
+import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
+import org.jboss.wsf.stack.cxf.interceptor.WSDLSoapAddressRewriteInterceptor;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.schema.SchemaReference;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.transform.dom.DOMSource;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.security.AccessController;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger;
+import org.apache.cxf.common.util.StringUtils;
+
+
+/**
+ * User: rsearls
+ * Date: 5/19/14
+ */
+public class WSDLSoapAddressRewriteUtils extends WSDLGetUtils {
+
+ private static final String WSDLS_KEY = WSDLSoapAddressRewriteUtils.class.getName() + ".WSDLs";
+ private static final String SCHEMAS_KEY = WSDLSoapAddressRewriteUtils.class.getName() + ".Schemas";
+
+ private static final Logger LOG = LogUtils.getL7dLogger(WSDLSoapAddressRewriteInterceptor.class);
+
+ public WSDLSoapAddressRewriteUtils() {
+
+ }
+
+ @Override
+ public Document getDocument(Message message,
+ String base,
+ Map<String, String> params,
+ String ctxUri,
+ EndpointInfo endpointInfo) {
+ try {
+ Bus bus = message.getExchange().getBus();
+ Object prop = message.getContextualProperty(PUBLISHED_ENDPOINT_URL);
+ if (prop == null) {
+ prop = endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL);
+ }
+ if (prop != null) {
+ base = String.valueOf(prop);
+ }
+ String wsdl = params.get("wsdl");
+ if (wsdl != null) {
+ // Always use the URL decoded version to ensure that we have a
+ // canonical representation of the import URL for lookup.
+ wsdl = URLDecoder.decode(wsdl, "utf-8");
+ }
+
+ String xsd = params.get("xsd");
+ if (xsd != null) {
+ // Always use the URL decoded version to ensure that we have a
+ // canonical representation of the import URL for lookup.
+ xsd = URLDecoder.decode(xsd, "utf-8");
+ }
+
+ Map<String, Definition> mp = CastUtils.cast((Map<?, ?>)endpointInfo.getService()
+ .getProperty(WSDLS_KEY));
+ Map<String, SchemaReference> smp = CastUtils.cast((Map<?, ?>)endpointInfo.getService()
+ .getProperty(SCHEMAS_KEY));
+
+ if (mp == null) {
+ endpointInfo.getService().setProperty(WSDLS_KEY,
+ new ConcurrentHashMap<String, Definition>(8, 0.75f, 4));
+ mp = CastUtils.cast((Map<?, ?>)endpointInfo.getService()
+ .getProperty(WSDLS_KEY));
+ }
+ if (smp == null) {
+ endpointInfo.getService().setProperty(SCHEMAS_KEY,
+ new ConcurrentHashMap<String, SchemaReference>(8, 0.75f, 4));
+ smp = CastUtils.cast((Map<?, ?>)endpointInfo.getService()
+ .getProperty(SCHEMAS_KEY));
+ }
+
+ if (!mp.containsKey("")) {
+ ServiceWSDLBuilder builder =
+ new ServiceWSDLBuilder(bus, endpointInfo.getService());
+
+ builder.setUseSchemaImports(
+ MessageUtils.getContextualBoolean(message, WSDL_CREATE_IMPORTS, false));
+
+ // base file name is ignored if createSchemaImports == false!
+ builder.setBaseFileName(endpointInfo.getService().getName().getLocalPart());
+
+ Definition def = builder.build(new HashMap<String, SchemaInfo>());
+
+ mp.put("", def);
+ updateDefinition(bus, def, mp, smp, base, endpointInfo, "");
+ }
+
+
+ Document doc;
+ if (xsd == null) {
+ Definition def = mp.get(wsdl);
+ if (def == null) {
+ String wsdl2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
+ wsdl,
+ base);
+ if (wsdl2 != null) {
+ def = mp.get(wsdl2);
+ }
+ }
+ if (def == null) {
+ throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("WSDL_NOT_FOUND",
+ LOG, wsdl), null);
+ }
+
+ synchronized (def) {
+ //writing a def is not threadsafe. Sync on it to make sure
+ //we don't get any ConcurrentModificationExceptions
+ if (endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL) != null) {
+ String epurl =
+ String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
+ updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+ base = epurl;
+ } else {
+ // When using replacement path, must set replacement path in the active url.
+ ServerConfig sc = getServerConfig();
+ if (SoapAddressRewriteHelper.isSoapAddressRewrite(getServerConfig())
+ && endpointInfo.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)) {
+ String epurl = SoapAddressRewriteHelper.rewriteSoapAddress(sc, base);
+ updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+ base = epurl;
+ }
+ }
+
+ WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
+ .getWSDLFactory().newWSDLWriter();
+ def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
+ doc = wsdlWriter.getDocument(def);
+ }
+ } else {
+ SchemaReference si = smp.get(xsd);
+ if (si == null) {
+ String xsd2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
+ xsd,
+ base);
+ if (xsd2 != null) {
+ si = smp.get(xsd2);
+ }
+ }
+ if (si == null) {
+ throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("SCHEMA_NOT_FOUND",
+ LOG, wsdl), null);
+ }
+
+ String uri = si.getReferencedSchema().getDocumentBaseURI();
+ uri = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
+ uri,
+ si.getReferencedSchema().getDocumentBaseURI());
+ if (uri == null) {
+ uri = si.getReferencedSchema().getDocumentBaseURI();
+ }
+ ResourceManagerWSDLLocator rml = new ResourceManagerWSDLLocator(uri,
+ bus);
+
+ InputSource src = rml.getBaseInputSource();
+ if (src.getByteStream() != null || src.getCharacterStream() != null) {
+ doc = StaxUtils.read(src);
+ } else { // last resort lets try for the referenced schema itself.
+ // its not thread safe if we use the same document
+ doc = StaxUtils.read(
+ new DOMSource(si.getReferencedSchema().getElement().getOwnerDocument()));
+ }
+ }
+
+ updateDoc(doc, base, mp, smp, message, xsd, wsdl);
+
+ return doc;
+ } catch (WSDLQueryException wex) {
+ throw wex;
+ } catch (Exception wex) {
+ throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
+ LOG,
+ base), wex);
+ }
+ }
+
+ @Override
+ public void updateWSDLPublishedEndpointAddress(Definition def, EndpointInfo endpointInfo)
+ {
+ synchronized (def) {
+ //writing a def is not threadsafe. Sync on it to make sure
+ //we don't get any ConcurrentModificationExceptions
+ if (endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL) != null) {
+ String epurl =
+ String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
+ updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+ }
+ /** rls test else {
+ // When using replacement path must set replacement path in active url.
+ ServerConfig sc = getServerConfig();
+ if (sc.isModifySOAPAddress() && !StringUtils.isEmpty(sc.getWebServicePath()
+ && endpointInfo.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)) {
+ try {
+ String base = endpointInfo.getAddress();
+ URL baseUrl = new URL(base);
+ //String tmpPath = Unix4j.builder().echo(baseUrl.getPath()).sed(sc.getWebServicePath()).toStringResult();
+ String tmpPath = SEDProcessor.newInstance(sc.getWebServicePath()).processLine(baseUrl.getPath());
+ String epurl = base.replace(baseUrl.getPath(), tmpPath);
+ updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+ //base = epurl;
+ } catch (Exception e){
+ // TODO fix
+ LOG.info(e.toString());
+ }
+ }
+ }
+ **/
+ }
+ }
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+}
10 years, 6 months
JBossWS SVN: r18703 - in stack/cxf/branches/rsearls/modules: server/src/main/java/org/jboss/wsf/stack/cxf/deployment and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-05-29 15:21:45 -0400 (Thu, 29 May 2014)
New Revision: 18703
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
Log:
changes to support host UNDEFINED_HOSTNAME sceniaro
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-29 07:21:34 UTC (rev 18702)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-29 19:21:45 UTC (rev 18703)
@@ -25,6 +25,7 @@
import java.net.URI;
import java.net.URL;
+import org.apache.cxf.common.util.StringUtils;
import org.jboss.wsf.spi.management.ServerConfig;
@@ -182,12 +183,12 @@
}
- public static String rewriteSoapAddress(ServerConfig serverConfig, String address, String contextRoot)
+ public static String rewriteSoapAddress(ServerConfig serverConfig, String address)
{
try
{
final String additionalCcontext = serverConfig.getWebServicePath();
- if (serverConfig.isModifySOAPAddress() && (additionalCcontext != null && additionalCcontext.length() > 0))
+ if (isSoapAddressRewrite(serverConfig))
{
final URL url = new URL(address);
final String path = url.getPath();
@@ -208,4 +209,8 @@
return address;
}
}
+
+ public static boolean isSoapAddressRewrite(ServerConfig sc){
+ return (sc.isModifySOAPAddress() && !StringUtils.isEmpty(sc.getWebServicePath()));
+ }
}
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-05-29 07:21:34 UTC (rev 18702)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-05-29 19:21:45 UTC (rev 18703)
@@ -25,7 +25,9 @@
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;
@@ -35,17 +37,15 @@
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;
import javax.xml.namespace.QName;
import java.io.IOException;
-import java.net.URL;
import java.security.AccessController;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static org.jboss.wsf.stack.cxf.Loggers.ADDRESS_REWRITE_LOGGER;
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
@@ -76,6 +76,10 @@
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
+ setCustomInterceptor();
+
//allow for configuration so that the wsdlPublisher can be set be the JBossWSCXFConfigurer
configureObject(this);
setupConfigHandlers();
@@ -84,6 +88,28 @@
}
/**
+ * 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
+ */
+ private void setCustomInterceptor(){
+ if (SoapAddressRewriteHelper.isSoapAddressRewrite(getServerConfig())) {
+ Collection<Endpoint> epList = super.getService().getEndpoints().values();
+ for (Endpoint ep : epList) {
+ List<Interceptor<? extends Message>> inList = ep.getInInterceptors();
+ for (Interceptor in : inList) {
+ if (in instanceof org.apache.cxf.frontend.WSDLGetInterceptor) {
+ int index = inList.indexOf(in);
+ if (index > -1) {
+ inList.remove(index);
+ inList.add(index, 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)'
*
@@ -139,8 +165,8 @@
if (wsdlLocation == null) {
JaxWsImplementorInfo info = new JaxWsImplementorInfo(getImplementorClass());
wsdlLocation = info.getWsdlLocation();
- updateCodeFirstSoapAddress();
}
+ updateCodeFirstSoapAddress();
wsdlPublisher.publishWsdlFiles(service.getName(), wsdlLocation, this.getBus(), service.getServiceInfos());
}
catch (IOException ioe)
@@ -186,12 +212,12 @@
}
/**
- * In the code-first scenario, reset the endpoint address so that it is
- * written to the generated wsdl file.
+ * 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 (!SoapAddressRewriteHelper.isAutoRewriteOn(servConfig)) {
+ if (servConfig.isModifySOAPAddress()) {
//- code-first handling
List<ServiceInfo> sevInfos = getServer().getEndpoint().getService().getServiceInfos();
for (ServiceInfo si: sevInfos){
@@ -200,6 +226,12 @@
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.rewriteSoapAddress(servConfig, ei.getAddress());
+ ei.setAddress(epurl);
+ }
}
}
}
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-05-29 07:21:34 UTC (rev 18702)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-05-29 19:21:45 UTC (rev 18703)
@@ -303,7 +303,7 @@
//same comment as above regarding auto rewrite...
if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
//- code-first handling
- String base = SoapAddressRewriteHelper.rewriteSoapAddress(sc, ddep.getAddress(), dep.getService().getContextRoot());
+ String base = SoapAddressRewriteHelper.rewriteSoapAddress(sc, ddep.getAddress());
ddep.setPublishedEndpointUrl(base); //force computed address for code first endpoints
}
}
Modified: stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-29 07:21:34 UTC (rev 18702)
+++ stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-29 19:21:45 UTC (rev 18703)
@@ -623,7 +623,6 @@
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
assertEquals("http://" + serverHost + ":8080/" + addContext +"/CodeFirstService", address);
-
if (isTestsuiteServerHostLocalhost()) {
definition = getWSDLDefinition("http://127.0.0.1:8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
@@ -665,7 +664,6 @@
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();
10 years, 6 months
JBossWS SVN: r18702 - in stack/cxf/trunk/modules/resources/src/main/resources: modules/wildfly900/org/apache/cxf/impl/main and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-05-29 03:21:34 -0400 (Thu, 29 May 2014)
New Revision: 18702
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/impl/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/cxf/impl/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf
Log:
[JBWS-3630]:Add httpcomponets module with slot 'asyncclient'
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/impl/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/impl/main/module.xml 2014-05-28 16:37:14 UTC (rev 18701)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/apache/cxf/impl/main/module.xml 2014-05-29 07:21:34 UTC (rev 18702)
@@ -43,6 +43,7 @@
<module name="javax.xml.stream.api" />
<module name="javax.xml.ws.api" />
<module name="org.apache.commons.lang" />
+ <module name="org.apache.httpcomponents" slot="asyncclient"/>
<module name="org.apache.neethi" />
<module name="org.apache.velocity" />
<module name="org.apache.xml-resolver" />
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/cxf/impl/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/cxf/impl/main/module.xml 2014-05-28 16:37:14 UTC (rev 18701)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly900/org/apache/cxf/impl/main/module.xml 2014-05-29 07:21:34 UTC (rev 18702)
@@ -43,6 +43,7 @@
<module name="javax.xml.stream.api" />
<module name="javax.xml.ws.api" />
<module name="org.apache.commons.lang" />
+ <module name="org.apache.httpcomponents" slot="asyncclient"/>
<module name="org.apache.neethi" />
<module name="org.apache.velocity" />
<module name="org.apache.xml-resolver" />
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-28 16:37:14 UTC (rev 18701)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-29 07:21:34 UTC (rev 18702)
@@ -75,7 +75,6 @@
<fileset dir="@{thirdpartydir}/lib">
<include name="**/cxf-*.jar"/>
<exclude name="**/cxf-core*.jar"/>
- <exclude name="**/cxf-rt-transports-http-hc.jar"/>
</fileset>
</copy>
<copy todir="@{targetdir}/org/jboss/ws/api/main" flatten="false" overwrite="true">
@@ -97,8 +96,16 @@
<fileset dir="@{thirdpartydir}/lib">
<include name="**/jbossws-spi.jar"/>
</fileset>
+ </copy>
+ <copy todir="@{targetdir}/org/apache/httpcomponents/asyncclient" flatten="false" overwrite="true">
+ <fileset dir="@{thirdpartydir}/lib">
+ <include name="**/httpcore.jar"/>
+ <include name="**/httpcore-nio.jar"/>
+ <include name="**/httpasyncclient.jar"/>
+ <include name="**/httpclient.jar"/>
+ </fileset>
</copy>
- <copy todir="@{targetdir}/org/apache/neethi/main" flatten="false" overwrite="true">
+ <copy todir="@{targetdir}/org/apache/neethi/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/neethi.jar"/>
</fileset>
@@ -189,8 +196,7 @@
<copy todir="@{targetdir}/org/apache/cxf/impl/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/cxf-*.jar"/>
- <exclude name="**/cxf-core*.jar"/>
- <exclude name="**/cxf-rt-transports-http-hc.jar"/>
+ <exclude name="**/cxf-core*.jar"/>
</fileset>
</copy>
<copy todir="@{targetdir}/org/jboss/ws/api/main" flatten="false" overwrite="true">
@@ -213,6 +219,14 @@
<include name="**/jbossws-spi.jar"/>
</fileset>
</copy>
+ <copy todir="@{targetdir}/org/apache/httpcomponents/asyncclient" flatten="false" overwrite="true">
+ <fileset dir="@{thirdpartydir}/lib">
+ <include name="**/httpcore.jar"/>
+ <include name="**/httpcore-nio.jar"/>
+ <include name="**/httpasyncclient.jar"/>
+ <include name="**/httpclient.jar"/>
+ </fileset>
+ </copy>
<copy todir="@{targetdir}/org/apache/neethi/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/neethi.jar"/>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf 2014-05-28 16:37:14 UTC (rev 18701)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf 2014-05-29 07:21:34 UTC (rev 18702)
@@ -1 +1 @@
-org/apache/cxf/**, org/apache/ws/security/**, org/apache/neethi/**, org/apache/ws/commons/xmlschema/**, org/jboss/ws/cxf/**, org/jboss/ws/api/**, org/jboss/ws/common/**, org/jboss/ws/jaxws-client/**, org/jboss/ws/jaxws-jboss-httpserver-httpspi/**, org/jboss/ws/jaxws-undertow-httpspi/**,org/jboss/ws/saaj-impl/**, org/jboss/ws/spi/**, org/jboss/ws/tools/**, org/opensaml/**, org/springframework/spring/**
+org/apache/cxf/**, org/apache/ws/security/**, org/apache/neethi/**, org/apache/ws/commons/xmlschema/**, org/jboss/ws/cxf/**, org/jboss/ws/api/**, org/jboss/ws/common/**, org/jboss/ws/jaxws-client/**, org/jboss/ws/jaxws-jboss-httpserver-httpspi/**, org/jboss/ws/jaxws-undertow-httpspi/**,org/jboss/ws/saaj-impl/**, org/jboss/ws/spi/**, org/jboss/ws/tools/**, org/opensaml/**, org/springframework/spring/**,org/apache/httpcomponents/asyncclient/**
10 years, 6 months
JBossWS SVN: r18701 - in stack/cxf/branches/rsearls: modules/dist and 9 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-28 12:37:14 -0400 (Wed, 28 May 2014)
New Revision: 18701
Added:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java
stack/cxf/branches/rsearls/modules/server/src/test/java/org/jboss/wsf/stack/cxf/addressRewrite/
stack/cxf/branches/rsearls/modules/server/src/test/java/org/jboss/wsf/stack/cxf/addressRewrite/AddressRewriteTest.java
Removed:
stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/unix4j/
Modified:
stack/cxf/branches/rsearls/modules/dist/pom.xml
stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/cxf/branches/rsearls/modules/server/pom.xml
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/branches/rsearls/pom.xml
Log:
- Removing dependency to unix4j and adding custom classes for SED processing
- Adding SED testcase
Modified: stack/cxf/branches/rsearls/modules/dist/pom.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/dist/pom.xml 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/modules/dist/pom.xml 2014-05-28 16:37:14 UTC (rev 18701)
@@ -128,11 +128,6 @@
<artifactId>opensaml</artifactId>
<scope>provided</scope>
</dependency>
- <!-- Java Sed utilities -->
- <dependency>
- <groupId>org.unix4j</groupId>
- <artifactId>unix4j-base</artifactId>
- </dependency>
<!-- container integration -->
<dependency>
<groupId>org.jboss.ws</groupId>
Modified: stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-05-28 16:37:14 UTC (rev 18701)
@@ -67,8 +67,6 @@
<include>javax.jws:jsr181-api:jar</include>
<include>org.codehaus.woodstox:stax2-api:jar</include>
<include>org.codehaus.woodstox:woodstox-core-asl:jar</include>
- <include>org.unix4j:unix4j-base:jar</include>
- <include>org.unix4j:unix4j-command:jar</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
Modified: stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2014-05-28 16:37:14 UTC (rev 18701)
@@ -74,6 +74,5 @@
<include path="META-INF"/>
</imports>
</module>
- <module name="org.unix4j"/>
</dependencies>
</module>
Modified: stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-28 16:37:14 UTC (rev 18701)
@@ -130,11 +130,6 @@
<include name="**/jbossws-(a){jbossid}-server-integration.jar"/>
</fileset>
</copy>
- <copy todir="@{targetdir}/org/unix4j/main" flatten="false" overwrite="true">
- <fileset dir="@{thirdpartydir}/lib">
- <include name="**/unix4j*.jar"/>
- </fileset>
- </copy>
<!-- module.xml files -->
<installModules targetDir="@{targetdir}">
<fileset dir="@{thirdpartydir}/modules/@{modules-jbossid}">
Modified: stack/cxf/branches/rsearls/modules/server/pom.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/server/pom.xml 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/modules/server/pom.xml 2014-05-28 16:37:14 UTC (rev 18701)
@@ -253,12 +253,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.unix4j</groupId>
- <artifactId>unix4j-base</artifactId>
- </dependency>
-
</dependencies>
<!-- Plugins -->
Added: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/CharMap.java 2014-05-28 16:37:14 UTC (rev 18701)
@@ -0,0 +1,83 @@
+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.
+ */
+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);
+ }
+
+ /**
+ * Adds the given source and destination characters to this char map.. 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 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));
+ }
+ }
+
+ /**
+ * Adds the given mapping {@code source --> destination} to this char map.
+ *
+ * @param source
+ * source character
+ * @param destination
+ * destination character
+ * @throws IllegalArgumentException
+ * if the destination character is the zero character
+ */
+ public 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/branches/rsearls/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/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java 2014-05-28 16:37:14 UTC (rev 18701)
@@ -0,0 +1,414 @@
+package org.jboss.wsf.stack.cxf.addressRewrite;
+
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public 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/branches/rsearls/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/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SedArguments.java 2014-05-28 16:37:14 UTC (rev 18701)
@@ -0,0 +1,212 @@
+package org.jboss.wsf.stack.cxf.addressRewrite;
+
+public final class SedArguments
+{
+
+ private boolean isGlobal = false;
+
+ private boolean isIgnoreCase = false;
+
+ private boolean isTranslate = false;
+
+ private boolean isSubstitute = false;
+
+ // operand: <script>
+ private String script;
+
+ private boolean scriptIsSet = false;
+
+ // operand: <regexp>
+ private String regexp;
+
+ private boolean regexpIsSet = false;
+
+ // operand: <string1>
+ private String string1;
+
+ private boolean string1IsSet = false;
+
+ // operand: <replacement>
+ private String replacement;
+
+ private boolean replacementIsSet = false;
+
+ // operand: <string2>
+ private String string2;
+
+ private boolean string2IsSet = false;
+
+ // operand: <occurrence>
+ 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/branches/rsearls/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/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-28 16:37:14 UTC (rev 18701)
@@ -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.
*
@@ -27,7 +27,6 @@
import java.net.URL;
import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.stack.cxf.unix4j.Unix4j;
/**
* Helper for rewriting soap:address in published wsdl
@@ -150,7 +149,7 @@
sb.append(port);
// replace original context-root with replacement context
if (additionalCcontext != null && additionalCcontext.length() > 0) {
- String tmpPath = Unix4j.builder().echo(path).sed(additionalCcontext).toStringResult();
+ String tmpPath = SEDProcessor.newInstance(additionalCcontext).processLine(path);
sb.append(tmpPath);
} else
{
@@ -192,7 +191,7 @@
{
final URL url = new URL(address);
final String path = url.getPath();
- final String tmpPath = Unix4j.builder().echo(path).sed(additionalCcontext).toStringResult();
+ final String tmpPath = SEDProcessor.newInstance(additionalCcontext).processLine(path);
final String newUrl=url.toString().replace(path, tmpPath);
ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl);
@@ -209,5 +208,4 @@
return address;
}
}
-
}
Added: stack/cxf/branches/rsearls/modules/server/src/test/java/org/jboss/wsf/stack/cxf/addressRewrite/AddressRewriteTest.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/test/java/org/jboss/wsf/stack/cxf/addressRewrite/AddressRewriteTest.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/test/java/org/jboss/wsf/stack/cxf/addressRewrite/AddressRewriteTest.java 2014-05-28 16:37:14 UTC (rev 18701)
@@ -0,0 +1,94 @@
+/*
+ * 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 junit.framework.TestCase;
+
+
+/**
+ * A test case for soap:address rewrite
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 27-May-2014
+ *
+ */
+public class AddressRewriteTest extends TestCase
+{
+ private static String run(String path, String script)
+ {
+ return SEDProcessor.newInstance(script).processLine(path);
+ }
+
+ public void testBasicPathRewrite()
+ {
+ ;
+ assertEquals("/FFF/bar", run("/foo/bar", "s/foo/FFF/g"));
+ assertEquals("/FFF/bar", run("/foo/bar", "s/foo/FFF/"));
+ assertEquals("/FFFo/FFFooo/bar", run("/foo/foooo/bar", "s/fo/FFF/g"));
+ assertEquals("/FFFo/foooo/bar", run("/foo/foooo/bar", "s/fo/FFF/"));
+ //ignore case...
+ assertEquals("/zzz/zzz/bar", run("/Foo/fOO/bar", "s/foo/zzz/Ig"));
+ }
+
+ public void testPathRewriteWithSlashes()
+ {
+ //replace all slashes with dashes...
+ assertEquals("foo-bar-abc", run("foo/bar/abc", "s/\\//-/g")); // "s/\//-/g"
+ //... replace first one only...
+ assertEquals("foo-bar/abc", run("foo/bar/abc", "s/\\//-/")); // "s/\//-/"
+ //... replace second one only...
+ assertEquals("/foo-bar/abc", run("/foo/bar/abc", "s/\\//-/2")); // "s/\//-/2"
+ //... replace all except first one...
+ assertEquals("/foo-bar-abc", run("/foo/bar/abc", "s/\\//-/2g")); // "s/\//-/2g"
+ //... the same using different delimiters
+ assertEquals("/foo-bar-abc", run("/foo/bar/abc", "s|/|-|2g")); // "s|/|-|2g"
+ assertEquals("/foo-bar-abc", run("/foo/bar/abc", "s:/:-:2g")); // "s:/:-:2g"
+ }
+
+ public void testPathRewriteAddition()
+ {
+ //add trailing context
+ assertEquals("/abc/foo/bar", run("/foo/bar", "s|/|/abc/|"));
+ assertEquals("/abc/foo/bar", run("/foo/bar", "s|^|/abc|"));
+ //add ending path
+ assertEquals("/foo/bar/abc", run("/foo/bar", "s|$|/abc|"));
+ //add trailing and ending path (use column separators to avoid clashes with path slashes and "|" logical OR)
+ assertEquals("/abc/foo/bar/abc", run("/foo/bar", "s:^|$:/abc:g"));
+ }
+
+ public void testPathRewriteReplacement()
+ {
+ //replace context only
+ assertEquals("/abc/bar", run("/foo/bar", "s|/.+/|/abc/|"));
+ assertEquals("/abc/bar", run("/foo/zzz/bar", "s|/.+/|/abc/|"));
+ //replace path only
+ assertEquals("/foo/abc", run("/foo/bar", "s|[a-z]*$|abc|"));
+ assertEquals("/foo/zzz/abc", run("/foo/zzz/bar", "s|[a-z]*$|abc|"));
+ //... case insensitive...
+ assertEquals("/foo/zzz/abc", run("/foo/zzz/Bar", "s|[a-zA-Z]*$|abc|"));
+ assertEquals("/foo/zzz/abc", run("/foo/zzz/Bar", "s|[a-z]*$|abc|I"));
+
+ //replace to upper case
+ assertEquals("/FOO/ZZZ/BAR", run("/foo/zzz/Bar", "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"));
+ }
+
+}
Property changes on: stack/cxf/branches/rsearls/modules/server/src/test/java/org/jboss/wsf/stack/cxf/addressRewrite/AddressRewriteTest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/rsearls/pom.xml
===================================================================
--- stack/cxf/branches/rsearls/pom.xml 2014-05-28 01:41:29 UTC (rev 18700)
+++ stack/cxf/branches/rsearls/pom.xml 2014-05-28 16:37:14 UTC (rev 18701)
@@ -111,7 +111,6 @@
<shrinkwrap.version>1.1.3</shrinkwrap.version>
<jaspi.api.version>1.0.0.Alpha1</jaspi.api.version>
<javax.inject.version>1</javax.inject.version>
- <unix4j-version>0.3</unix4j-version>
</properties>
@@ -1270,12 +1269,6 @@
<artifactId>easymockclassextension</artifactId>
<version>2.4</version>
</dependency>
- <!-- Java SED util -->
- <dependency>
- <groupId>org.unix4j</groupId>
- <artifactId>unix4j-base</artifactId>
- <version>${unix4j-version}</version>
- </dependency>
<!-- Other test dependencies -->
<dependency>
<groupId>org.picketlink</groupId>
10 years, 6 months
JBossWS SVN: r18700 - in stack/cxf/trunk: modules/dist/src/main/scripts and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-05-27 21:41:29 -0400 (Tue, 27 May 2014)
New Revision: 18700
Modified:
stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/cxf/trunk/pom.xml
Log:
[JBWS-3630]:Add http asynclient.jar in the binary distribution
Modified: stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-05-27 15:18:53 UTC (rev 18699)
+++ stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-05-28 01:41:29 UTC (rev 18700)
@@ -63,6 +63,10 @@
<include>javax.jws:jsr181-api:jar</include>
<include>org.codehaus.woodstox:stax2-api:jar</include>
<include>org.codehaus.woodstox:woodstox-core-asl:jar</include>
+ <include>org.apache.httpcomponents:httpcore-nio:jar</include>
+ <include>org.apache.httpcomponents:httpcore:jar</include>
+ <include>org.apache.httpcomponents:httpasyncclient:jar</include>
+ <include>org.apache.httpcomponents:httpclient:jar</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2014-05-27 15:18:53 UTC (rev 18699)
+++ stack/cxf/trunk/pom.xml 2014-05-28 01:41:29 UTC (rev 18700)
@@ -465,6 +465,12 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-hc</artifactId>
<version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
10 years, 7 months
JBossWS SVN: r18699 - stack/cxf/trunk/modules/resources/src/main/resources/resources.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-05-27 11:18:53 -0400 (Tue, 27 May 2014)
New Revision: 18699
Modified:
stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
Log:
[JBWS-3630]:exclude cxf-rt-transports-http-hc.jar from module.xml
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-27 12:54:53 UTC (rev 18698)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-27 15:18:53 UTC (rev 18699)
@@ -75,6 +75,7 @@
<fileset dir="@{thirdpartydir}/lib">
<include name="**/cxf-*.jar"/>
<exclude name="**/cxf-core*.jar"/>
+ <exclude name="**/cxf-rt-transports-http-hc.jar"/>
</fileset>
</copy>
<copy todir="@{targetdir}/org/jboss/ws/api/main" flatten="false" overwrite="true">
@@ -189,6 +190,7 @@
<fileset dir="@{thirdpartydir}/lib">
<include name="**/cxf-*.jar"/>
<exclude name="**/cxf-core*.jar"/>
+ <exclude name="**/cxf-rt-transports-http-hc.jar"/>
</fileset>
</copy>
<copy todir="@{targetdir}/org/jboss/ws/api/main" flatten="false" overwrite="true">
10 years, 7 months
JBossWS SVN: r18697 - stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-05-26 20:48:30 -0400 (Mon, 26 May 2014)
New Revision: 18697
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java
Log:
[JBWS-3630]:Add more test cases
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-05-26 15:53:21 UTC (rev 18696)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-05-27 00:48:30 UTC (rev 18697)
@@ -28,11 +28,11 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+import junit.framework.Test;
+
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
-import junit.framework.Test;
-
/**
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
@@ -40,7 +40,7 @@
public class AsyncClientTestCase extends JBossWSTest
{
private String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-cxf-asyncclient";
-
+
public static Test suite()
{
return new JBossWSCXFTestSetup(AsyncClientTestCase.class, "jaxws-cxf-asyncclient.war");
@@ -48,14 +48,40 @@
public void testAsycClienWithHCAddress() throws Exception
{
- QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient", "EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- Endpoint proxy = service.getPort(Endpoint.class);
+
+ Endpoint proxy = initPort();
BindingProvider provider = (BindingProvider)proxy;
Map<String, Object> requestContext = provider.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" + endpointAddress);
assertEquals("Echo:1000", proxy.echo(1000));
}
+
+ public void testAsycClienWithMsgProp() throws Exception
+ {
+ Endpoint proxy = initPort();
+ BindingProvider provider = (BindingProvider)proxy;
+ Map<String, Object> requestContext = provider.getRequestContext();
+ requestContext.put("use.async.http.conduit", Boolean.TRUE);
+ assertEquals("Echo:1000", proxy.echo(1000));
+ }
+
+ public void testAsycClienAsyncOperation() throws Exception
+ {
+ Endpoint proxy = initPort();
+ BindingProvider provider = (BindingProvider)proxy;
+ Map<String, Object> requestContext = provider.getRequestContext();
+ requestContext.put("use.async.http.conduit", Boolean.TRUE);
+ assertEquals("Echo:1000", proxy.echoAsync(1000).get());
+ }
+
+ private Endpoint initPort() throws Exception {
+ QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient", "EndpointImplService");
+ URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint proxy = service.getPort(Endpoint.class);
+ return proxy;
+ }
+
+
}
\ No newline at end of file
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java 2014-05-26 15:53:21 UTC (rev 18696)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java 2014-05-27 00:48:30 UTC (rev 18697)
@@ -21,17 +21,27 @@
*/
package org.jboss.test.ws.jaxws.cxf.asyncclient;
+import java.util.concurrent.Future;
+
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
/**
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
*/
@WebService(name = "EndpointService", targetNamespace = "http://org.jboss.ws/cxf/asyncclient")
-@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
public interface Endpoint
{
@WebMethod
public String echo(long time);
+
+ @WebMethod(operationName = "echo")
+ public Response<String> echoAsync(long time);
+
+ @WebMethod(operationName = "echo")
+ public Future<String> echoAsync(long time, AsyncHandler<String> handler);
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java 2014-05-26 15:53:21 UTC (rev 18696)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java 2014-05-27 00:48:30 UTC (rev 18697)
@@ -21,9 +21,13 @@
*/
package org.jboss.test.ws.jaxws.cxf.asyncclient;
+import java.util.concurrent.Future;
+
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
import javax.xml.ws.WebServiceContext;
import org.apache.cxf.continuations.Continuation;
@@ -33,7 +37,7 @@
*
*/
@WebService(name = "EndpointService", targetNamespace = "http://org.jboss.ws/cxf/asyncclient")
-@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
public class EndpointImpl
{
@Resource
@@ -54,5 +58,13 @@
return "Echo:" + time;
}
+ public Response<String> echoAsync(long time)
+ {
+ return null;
+ }
+ public Future<String> echoAsync(final long time, final AsyncHandler<String> handler) {
+ return null;
+ }
+
}
10 years, 7 months
JBossWS SVN: r18696 - in stack/cxf/trunk/modules: client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map and 8 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-26 11:53:21 -0400 (Mon, 26 May 2014)
New Revision: 18696
Removed:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/HandlerChainSortInterceptor.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAP.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPEndpoint.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPRelatesTo.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/EndpointPolicyAttachments.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicyAttachment.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicySetsAnnotationListener.java
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java
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/RequestHandlerFactoryImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/NsCtxSelectorStoreInterceptor.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBean.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingPolicyInterceptor.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java
Log:
Misc minor changes (making some fields final, removing unused / deprecated code)
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/HandlerChainSortInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/HandlerChainSortInterceptor.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/HandlerChainSortInterceptor.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -44,9 +44,9 @@
*/
public class HandlerChainSortInterceptor extends AbstractPhaseInterceptor<Message>
{
- private Binding binding;
+ private final Binding binding;
@SuppressWarnings("rawtypes")
- private static Comparator<Handler> comparator = new ConfigDelegateHandlerComparator<Handler>();
+ private static final Comparator<Handler> comparator = new ConfigDelegateHandlerComparator<Handler>();
public HandlerChainSortInterceptor(Binding b)
{
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/JBossWSSpringConfigurer.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -39,7 +39,7 @@
public class JBossWSSpringConfigurer implements JBossWSConfigurer, ApplicationContextAware, BusExtension
{
private BeanCustomizer customizer;
- private Configurer delegate;
+ private final Configurer delegate;
public JBossWSSpringConfigurer(Configurer delegate)
{
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAP.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAP.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAP.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -55,7 +55,7 @@
/**
* the wrapped instance which this class delegates to
*/
- private AddressingProperties implementation;
+ private final AddressingProperties implementation;
CXFMAP(AddressingProperties implementation)
{
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -46,7 +46,7 @@
*/
public class CXFMAPBuilder implements MAPBuilder
{
- private static MAPBuilder theBuilder = new CXFMAPBuilder();
+ private static final MAPBuilder theBuilder = new CXFMAPBuilder();
public static MAPBuilder getBuilder()
{
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPEndpoint.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPEndpoint.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPEndpoint.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -39,7 +39,7 @@
*/
public class CXFMAPEndpoint implements MAPEndpoint
{
- private EndpointReferenceType implementation;
+ private final EndpointReferenceType implementation;
CXFMAPEndpoint(EndpointReferenceType implementation)
{
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPRelatesTo.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPRelatesTo.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPRelatesTo.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -35,8 +35,8 @@
*/
public class CXFMAPRelatesTo implements MAPRelatesTo
{
- private String relatesTo;
- private QName type;
+ private final String relatesTo;
+ private final QName type;
CXFMAPRelatesTo(String relatesTo, QName type)
{
@@ -56,7 +56,7 @@
public void setType(QName type)
{
- this.type = type;
+ throw new UnsupportedOperationException();
}
}
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/EndpointPolicyAttachments.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/EndpointPolicyAttachments.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/EndpointPolicyAttachments.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -39,7 +39,7 @@
*/
public class EndpointPolicyAttachments
{
- private Map<Placement, List<PolicyAttachment>> attachmentMap;
+ private final Map<Placement, List<PolicyAttachment>> attachmentMap;
private EndpointPolicyAttachments(Map<Placement, List<PolicyAttachment>> attachmentMap) {
this.attachmentMap = attachmentMap;
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicyAttachment.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicyAttachment.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicyAttachment.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -45,8 +45,8 @@
*/
public class PolicyAttachment
{
- private Placement placement;
- private String uri;
+ private final Placement placement;
+ private final String uri;
public PolicyAttachment(Placement placement, String uri)
{
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicySetsAnnotationListener.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicySetsAnnotationListener.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/policy/PolicySetsAnnotationListener.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -60,21 +60,22 @@
public class PolicySetsAnnotationListener implements FactoryBeanListener
{
private final Map<Class<?>, EndpointPolicyAttachments> epaMap = new HashMap<Class<?>, EndpointPolicyAttachments>();
- private PolicyAttachmentStore store;
+ private final PolicyAttachmentStore store;
public PolicySetsAnnotationListener() {
this.store = PolicyAttachmentStore.getDefaultInstance();
}
public PolicySetsAnnotationListener(ClassLoader cl) {
- this.store = PolicyAttachmentStore.getDefaultInstance();
+ PolicyAttachmentStore tmp = PolicyAttachmentStore.getDefaultInstance();
if (cl != null) {
PolicyAttachmentStore pas = new PolicyAttachmentStore(cl);
if (!pas.isEmpty()) {
- pas.merge(this.store);
- this.store = pas;
+ pas.merge(tmp);
+ tmp = pas;
}
}
+ this.store = tmp;
}
public PolicySetsAnnotationListener(PolicyAttachmentStore store) {
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -58,7 +58,7 @@
public class SOAPConnectionImpl extends SOAPConnection
{
- private boolean closed = false;
+ private volatile boolean closed = false;
@Override
public SOAPMessage call(SOAPMessage msgOut, Object addressObject) throws SOAPException
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-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -97,7 +97,7 @@
*/
public class JBossWSInvoker extends JAXWSMethodInvoker implements Invoker
{
- private Object targetBean;
+ private volatile Object targetBean;
private final NamespaceContextSelectorWrapperFactory nsCtxSelectorFactory;
public JBossWSInvoker() {
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/RequestHandlerFactoryImpl.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.
*
@@ -30,12 +30,6 @@
*/
public class RequestHandlerFactoryImpl extends RequestHandlerFactory
{
- @Deprecated
- public RequestHandler newRequestHandler()
- {
- return new RequestHandlerImpl();
- }
-
public RequestHandler getRequestHandler()
{
return RequestHandlerImpl.getInstance();
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/NsCtxSelectorStoreInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/NsCtxSelectorStoreInterceptor.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/NsCtxSelectorStoreInterceptor.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -40,7 +40,7 @@
*/
public class NsCtxSelectorStoreInterceptor extends AbstractPhaseInterceptor<Message>
{
- private NamespaceContextSelectorWrapperFactory factory;
+ private final NamespaceContextSelectorWrapperFactory factory;
public NsCtxSelectorStoreInterceptor()
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBean.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBean.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBean.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -32,8 +32,8 @@
*/
public class DDBean
{
- private String beanName;
- private String beanClass;
+ private final String beanName;
+ private final String beanClass;
public DDBean(String beanName, String beanClass)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -43,11 +43,11 @@
public class DDBeans
{
// The Required services.
- private List<DDEndpoint> endpoints = new ArrayList<DDEndpoint>();
+ private final List<DDEndpoint> endpoints = new ArrayList<DDEndpoint>();
// Optional additional beans.
- private List<DDBean> beans = new LinkedList<DDBean>();
+ private final List<DDBean> beans = new LinkedList<DDBean>();
- private List<DDJmsAddressBean> addressBeans = new LinkedList<DDJmsAddressBean>();
+ private final List<DDJmsAddressBean> addressBeans = new LinkedList<DDJmsAddressBean>();
// The derived temp file
private File tmpFile;
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDJmsAddressBean.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -33,9 +33,9 @@
*/
public class DDJmsAddressBean
{
- private String portName;
- private Properties properties;
- private boolean isRequest = true;
+ private final String portName;
+ private final Properties properties;
+ private final boolean isRequest;
public DDJmsAddressBean(String portName, boolean isRequest, Properties properties)
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/JBossWSResourceResolver.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -39,7 +39,7 @@
*/
public class JBossWSResourceResolver implements ResourceResolver
{
- private org.jboss.wsf.spi.deployment.ResourceResolver resolver;
+ private final org.jboss.wsf.spi.deployment.ResourceResolver resolver;
public JBossWSResourceResolver(org.jboss.wsf.spi.deployment.ResourceResolver resolver)
{
Deleted: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/resolver/WebAppResolver.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -1,72 +0,0 @@
-/*
- * 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.wsf.stack.cxf.resolver;
-
-import org.jboss.wsf.spi.management.EndpointResolver;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.EndpointState;
-
-import javax.management.ObjectName;
-import java.util.Iterator;
-
-/**
- * Resolves Endpoints by Servlet name and web context path.
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jul 24, 2007
- */
-public class WebAppResolver implements EndpointResolver
-{
- private String contextPath;
- private String servletName;
-
- public WebAppResolver(String contextPath, String servletName)
- {
- this.contextPath = contextPath;
- this.servletName = servletName;
- }
-
- public Endpoint query(Iterator<Endpoint> endpoints)
- {
- Endpoint endpoint = null;
-
- if (contextPath.startsWith("/"))
- contextPath = contextPath.substring(1);
-
- while(endpoints.hasNext())
- {
- Endpoint auxEndpoint = endpoints.next();
- if (EndpointState.STARTED.equals(auxEndpoint.getState())) {
- ObjectName sepId = auxEndpoint.getName();
- String propContext = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_CONTEXT);
- String propEndpoint = sepId.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
- if (servletName.equals(propEndpoint) && contextPath.equals(propContext))
- {
- endpoint = auxEndpoint;
- break;
- }
- }
- }
-
- return endpoint;
- }
-}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -60,11 +60,11 @@
*/
public class SubjectCreatingInterceptor extends WSS4JInInterceptor
{
- protected SubjectCreator helper = new SubjectCreator();
+ protected final SubjectCreator helper = new SubjectCreator();
private static final Logger LOG = LogUtils.getL7dLogger(SubjectCreatingInterceptor.class);
- private ThreadLocal<SecurityDomainContext> sdc = new ThreadLocal<SecurityDomainContext>();
+ private final ThreadLocal<SecurityDomainContext> sdc = new ThreadLocal<SecurityDomainContext>();
private boolean supportDigestPasswords;
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingPolicyInterceptor.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingPolicyInterceptor.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingPolicyInterceptor.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -51,7 +51,7 @@
*/
public class SubjectCreatingPolicyInterceptor extends AbstractPhaseInterceptor<Message>
{
- protected SubjectCreator helper = new SubjectCreator();
+ protected final SubjectCreator helper = new SubjectCreator();
public SubjectCreatingPolicyInterceptor()
{
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java 2014-05-26 15:50:31 UTC (rev 18695)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java 2014-05-26 15:53:21 UTC (rev 18696)
@@ -39,11 +39,11 @@
*/
public class UsernameTokenCallbackHandler implements CallbackHandler
{
- private String nonce;
+ private final String nonce;
- private String created;
+ private final String created;
- private boolean decodeNonce;
+ private final boolean decodeNonce;
public UsernameTokenCallbackHandler(String nonce, String created, boolean decodeNonce)
{
10 years, 7 months
JBossWS SVN: r18695 - stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-26 11:50:31 -0400 (Mon, 26 May 2014)
New Revision: 18695
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFHandlerResolverImpl.java
Log:
[JBWS-3796] Perform injections once on handlers and prevent concurrency issues
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFHandlerResolverImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFHandlerResolverImpl.java 2014-05-26 09:20:26 UTC (rev 18694)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/serviceref/CXFHandlerResolverImpl.java 2014-05-26 15:50:31 UTC (rev 18695)
@@ -109,20 +109,22 @@
@SuppressWarnings("rawtypes")
public List<Handler> getHandlerChain(PortInfo portInfo)
{
- List<Handler> handlerChain = handlerMap.get(portInfo);
- if (handlerChain == null) {
- QName portQName = portInfo.getPortName();
- QName serviceQName = portInfo.getServiceName();
- String bindingId = portInfo.getBindingID();
- handlerChain = createHandlerChain(portInfo, portQName, serviceQName, bindingId);
- handlerMap.put(portInfo, handlerChain);
+ synchronized (handlerMap)
+ {
+ List<Handler> handlerChain = handlerMap.get(portInfo);
+ if (handlerChain == null) {
+ QName portQName = portInfo.getPortName();
+ QName serviceQName = portInfo.getServiceName();
+ String bindingId = portInfo.getBindingID();
+ handlerChain = createHandlerChain(portInfo, portQName, serviceQName, bindingId);
+ handlerMap.put(portInfo, handlerChain);
+
+ for (Handler h : handlerChain) {
+ configHandler(h);
+ }
+ }
+ return handlerChain;
}
-
- for (Handler h : handlerChain) {
- configHandler(h);
- }
-
- return handlerChain;
}
/**
@@ -149,7 +151,7 @@
}
@SuppressWarnings("rawtypes")
- public List<Handler> createHandlerChain(PortInfo portInfo, QName portQName, QName serviceQName, String bindingID) {
+ protected List<Handler> createHandlerChain(PortInfo portInfo, QName portQName, QName serviceQName, String bindingID) {
List<Handler> chain = new ArrayList<Handler>();
InputStream is = getInputStream();
try {
10 years, 7 months