[jboss-svn-commits] JBL Code SVN: r34759 - in labs/jbossesb/tags: JBESB_4_7_CP2_SOA_2210_2/product and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Aug 17 10:18:52 EDT 2010
Author: kevin.conner at jboss.com
Date: 2010-08-17 10:18:51 -0400 (Tue, 17 Aug 2010)
New Revision: 34759
Added:
labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/
labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java
Removed:
labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java
Modified:
labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/build.xml
Log:
Tag second version of SOA 2210 work
Copied: labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2 (from rev 34695, labs/jbossesb/branches/JBESB_4_7_CP)
Modified: labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/build.xml 2010-08-13 08:26:20 UTC (rev 34695)
+++ labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/build.xml 2010-08-17 14:18:51 UTC (rev 34759)
@@ -40,8 +40,8 @@
<property name="org.jboss.esb.internal.jar.dest" location="build/jbossesb/lib"/>
<!-- JBoss ESB version -->
- <property name="version" value="4.7"/>
- <property name="esb.server.name" value="jbossesb-server-${version}"/>
+ <property name="version" value="4.7_SOA_5.0_soa_2210"/>
+ <property name="esb.server.name" value="soa-server-5.0.2_soa_2210"/>
<property name="esbserver.dist.dir" value="${org.jboss.esb.internal.dest}/${esb.server.name}"/>
<!-- Set internal property defaults -->
Deleted: labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java 2010-08-13 08:26:20 UTC (rev 34695)
+++ labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java 2010-08-17 14:18:51 UTC (rev 34759)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.actions.soap;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
-
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.log4j.Logger;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.routing.http.HttpMethodFactory;
-import org.jboss.soa.esb.http.HttpClientFactory;
-import org.jboss.soa.esb.util.ClassUtil;
-
-/**
- * {@link HttpClientFactory} based WSLD loader.
- * <p/>
- * We use this in order to support different authentication modes that
- * may be required for WSDL lookup.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class RemoteWsdlLoader {
-
- private static Logger logger = Logger.getLogger(RemoteWsdlLoader.class);
- private HttpClient httpClient;
- private HostConfiguration hostConfig;
-
- public RemoteWsdlLoader(Properties httpClientProps) throws ConfigurationException {
- httpClient = HttpClientFactory.createHttpClient(httpClientProps);
- hostConfig = httpClient.getHostConfiguration();
- httpClient.setHostConfiguration(new HostConfiguration());
- }
-
- public InputStream load(String url, String charsetNameOverride) throws IOException {
- if (httpClient == null) {
- throw new IOException("RemoteWsdlLoader already shutdown") ;
- }
-
- InputStream originalStream = null;
- byte[] originalBytes = null;
- String charsetNameDetected = null;
-
- if(url.startsWith("file")) {
- originalStream = new URL(url).openStream();
- } else if(url.startsWith("classpath://")) {
- originalStream = ClassUtil.getResource(url.substring(12, url.length()), getClass()).openStream();
- } else {
- HttpMethodBase httpMethod;
-
- try {
- HttpMethodFactory methodFactory = HttpMethodFactory.Factory.getInstance("GET", null, new URL(url));
- httpMethod = methodFactory.getInstance(null);
- } catch (ConfigurationException ce) {
- // should never happen with "GET" method since ConfigTree isn't used with GET - only POST
- throw (IOException)(new IOException(ce.getMessage()).initCause(ce));
- }
-
- // Authentication is not being overridden on the method. It needs
- // to be present on the supplied HttpClient instance!
- httpMethod.setDoAuthentication(true);
-
- try {
- int result = httpClient.executeMethod(hostConfig, httpMethod);
-
- if(result != HttpStatus.SC_OK) {
- if(result < 200 || result > 299) {
- throw new HttpException("Received status code '" + result + "' on WSDL HTTP (GET) request: '" + url + "'.");
- } else {
- logger.warn("Received status code '" + result + "' on WSDL HTTP (GET) request: '" + url + "'.");
- }
- }
-
- originalBytes = httpMethod.getResponseBody();
- charsetNameDetected = httpMethod.getResponseCharSet();
- } finally {
- httpMethod.releaseConnection();
- }
- }
-
- String charsetName = (charsetNameOverride != null ? charsetNameOverride : charsetNameDetected);
- if (charsetName != null) {
- charsetName = charsetName.trim().toUpperCase();
- if (charsetName.equals("UTF-8") || charsetName.equals("UTF8")) {
- // short-circuit conversion; it's already UTF-8
- charsetName = null;
- }
- }
- if (charsetName != null) {
- // conversion WILL happen
- if (originalStream != null) {
- String read = StreamUtils.readStreamString(originalStream, charsetName);
- return new ByteArrayInputStream(read.getBytes("UTF-8"));
- } else if (originalBytes != null) {
- String read = new String(originalBytes, charsetName);
- return new ByteArrayInputStream(read.getBytes("UTF-8"));
- }
- } else {
- // conversion will NOT happen
- if (originalStream != null) {
- return originalStream;
- } else if (originalBytes != null) {
- return new ByteArrayInputStream(originalBytes);
- }
- }
- throw new IOException("null data; could not load url: " + url + " with charsetName: " + charsetName);
- }
-
- public void shutdown() {
- HttpClientFactory.shutdown(httpClient);
- httpClient = null ;
- }
-}
-
Copied: labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java (from rev 34757, labs/jbossesb/branches/JBESB_4_7_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java)
===================================================================
--- labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java (rev 0)
+++ labs/jbossesb/tags/JBESB_4_7_CP2_SOA_2210_2/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/RemoteWsdlLoader.java 2010-08-17 14:18:51 UTC (rev 34759)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.soap;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.routing.http.HttpMethodFactory;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.http.HttpClientFactory;
+import org.jboss.soa.esb.util.ClassUtil;
+
+/**
+ * {@link HttpClientFactory} based WSLD loader.
+ * <p/>
+ * We use this in order to support different authentication modes that
+ * may be required for WSDL lookup.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class RemoteWsdlLoader {
+
+ private static Logger logger = Logger.getLogger(RemoteWsdlLoader.class);
+ private HttpClient httpClient;
+ private HostConfiguration hostConfig;
+
+ public RemoteWsdlLoader(Properties httpClientProps) throws ConfigurationException {
+ httpClient = HttpClientFactory.createHttpClient(httpClientProps);
+ hostConfig = httpClient.getHostConfiguration();
+ httpClient.setHostConfiguration(new HostConfiguration());
+ }
+
+ public InputStream load(String url, String charsetNameOverride) throws IOException {
+ if (httpClient == null) {
+ throw new IOException("RemoteWsdlLoader already shutdown") ;
+ }
+
+ InputStream originalStream = null;
+ byte[] originalBytes = null;
+ String charsetNameDetected = null;
+
+ if(url.startsWith("file")) {
+ originalStream = new URL(url).openStream();
+ } else if(url.startsWith("classpath://")) {
+ originalStream = ClassUtil.getResource(url.substring(12, url.length()), getClass()).openStream();
+ } else {
+ HttpMethodBase httpMethod;
+
+ try {
+ HttpMethodFactory methodFactory = HttpMethodFactory.Factory.getInstance("GET", new ConfigTree("RemoteWsdlLoader"), new URL(url));
+ httpMethod = methodFactory.getInstance(null);
+ } catch (ConfigurationException ce) {
+ throw (IOException)(new IOException(ce.getMessage()).initCause(ce));
+ }
+
+ // Authentication is not being overridden on the method. It needs
+ // to be present on the supplied HttpClient instance!
+ httpMethod.setDoAuthentication(true);
+
+ try {
+ int result = httpClient.executeMethod(hostConfig, httpMethod);
+
+ if(result != HttpStatus.SC_OK) {
+ if(result < 200 || result > 299) {
+ throw new HttpException("Received status code '" + result + "' on WSDL HTTP (GET) request: '" + url + "'.");
+ } else {
+ logger.warn("Received status code '" + result + "' on WSDL HTTP (GET) request: '" + url + "'.");
+ }
+ }
+
+ originalBytes = httpMethod.getResponseBody();
+ charsetNameDetected = httpMethod.getResponseCharSet();
+ } finally {
+ httpMethod.releaseConnection();
+ }
+ }
+
+ String charsetName = (charsetNameOverride != null ? charsetNameOverride : charsetNameDetected);
+ if (charsetName != null) {
+ charsetName = charsetName.trim().toUpperCase();
+ if (charsetName.equals("UTF-8") || charsetName.equals("UTF8")) {
+ // short-circuit conversion; it's already UTF-8
+ charsetName = null;
+ }
+ }
+ if (charsetName != null) {
+ // conversion WILL happen
+ if (originalStream != null) {
+ String read = StreamUtils.readStreamString(originalStream, charsetName);
+ return new ByteArrayInputStream(read.getBytes("UTF-8"));
+ } else if (originalBytes != null) {
+ String read = new String(originalBytes, charsetName);
+ return new ByteArrayInputStream(read.getBytes("UTF-8"));
+ }
+ } else {
+ // conversion will NOT happen
+ if (originalStream != null) {
+ return originalStream;
+ } else if (originalBytes != null) {
+ return new ByteArrayInputStream(originalBytes);
+ }
+ }
+ throw new IOException("null data; could not load url: " + url + " with charsetName: " + charsetName);
+ }
+
+ public void shutdown() {
+ HttpClientFactory.shutdown(httpClient);
+ httpClient = null ;
+ }
+}
+
More information about the jboss-svn-commits
mailing list