Index: bpel-api/pom.xml =================================================================== --- bpel-api/pom.xml (revision 1428) +++ bpel-api/pom.xml (working copy) @@ -52,5 +52,10 @@ commons-logging commons-logging + + junit + junit + test + Index: bpel-obj/pom.xml =================================================================== --- bpel-obj/pom.xml (revision 1428) +++ bpel-obj/pom.xml (working copy) @@ -40,6 +40,11 @@ wsdl4j + junit + junit + test + + commons-logging commons-logging Index: pom.xml =================================================================== --- pom.xml (revision 1428) +++ pom.xml (working copy) @@ -93,7 +93,7 @@ 3.1 1.2 3.2.1 - 3.1 + 4.0 1.4 2.4 1.1 @@ -169,25 +169,13 @@ bpel-epr bpel-compiler bpel-ql - tools dao-jpa-hibernate - scheduler-simple bpel-store bpel-runtime bpel-connector bpel-test - @@ -556,8 +544,8 @@ ${commons.collections.version} - commons-httpclient - commons-httpclient + org.apache.httpcomponents + httpclient ${commons.httpclient.version} Index: tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java =================================================================== --- tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java (revision 1428) +++ tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java (working copy) @@ -18,24 +18,6 @@ */ package org.apache.ode.tools.sendsoap.cline; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpConnectionManager; -import org.apache.commons.httpclient.SimpleHttpConnectionManager; -import org.apache.commons.httpclient.UsernamePasswordCredentials; -import org.apache.commons.httpclient.auth.AuthScope; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; -import org.apache.ode.tools.ToolMessages; -import org.apache.ode.utils.StreamUtils; -import org.apache.ode.utils.cli.Argument; -import org.apache.ode.utils.cli.BaseCommandlineTool; -import org.apache.ode.utils.cli.CommandlineFragment; -import org.apache.ode.utils.cli.ConsoleFormatter; -import org.apache.ode.utils.cli.FlagWithArgument; -import org.apache.ode.utils.cli.Fragments; -import org.apache.ode.utils.msg.CommonMessages; -import org.apache.ode.utils.msg.MessageBundle; - import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -43,12 +25,29 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.http.HttpResponse; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.apache.ode.tools.ToolMessages; +import org.apache.ode.utils.StreamUtils; +import org.apache.ode.utils.cli.Argument; +import org.apache.ode.utils.cli.BaseCommandlineTool; +import org.apache.ode.utils.cli.CommandlineFragment; +import org.apache.ode.utils.cli.ConsoleFormatter; +import org.apache.ode.utils.cli.FlagWithArgument; +import org.apache.ode.utils.cli.Fragments; +import org.apache.ode.utils.msg.CommonMessages; +import org.apache.ode.utils.msg.MessageBundle; + /** *

* Commandline tool to send the contents of a (binary) file to a URL. @@ -107,22 +106,25 @@ m.appendReplacement(sb, now + "-" + c++); } m.appendTail(sb); - SimpleHttpConnectionManager mgr = new SimpleHttpConnectionManager(); - mgr.getParams().setConnectionTimeout(60000); - mgr.getParams().setSoTimeout(60000); - HttpClient httpClient = new HttpClient(mgr); - PostMethod httpPostMethod = new PostMethod(u.toExternalForm()); - if (proxyServer != null && proxyServer.length() > 0) { - httpClient.getState().setCredentials(new AuthScope(proxyServer, proxyPort), - new UsernamePasswordCredentials(username, password)); - httpPostMethod.setDoAuthentication(true); + + DefaultHttpClient httpClient = new DefaultHttpClient(); + try { + + HttpPost post = new HttpPost(u.toExternalForm()); + + if (proxyServer != null && proxyServer.length() > 0) { + httpClient.getCredentialsProvider().setCredentials(new AuthScope(proxyServer, proxyPort), + new UsernamePasswordCredentials(username, password)); + } + if (soapAction == null) soapAction = ""; + post.setHeader("SOAPAction", "\"" + soapAction + "\""); + post.setHeader("Content-Type", "text/xml"); + post.setEntity(new StringEntity(sb.toString())); + HttpResponse response = httpClient.execute(post); + return EntityUtils.toString(response.getEntity()) + "\n"; + } finally { + httpClient.getConnectionManager().shutdown(); } - if (soapAction == null) soapAction = ""; - httpPostMethod.setRequestHeader("SOAPAction", "\"" + soapAction + "\""); - httpPostMethod.setRequestHeader("Content-Type", "text/xml"); - httpPostMethod.setRequestEntity(new StringRequestEntity(sb.toString())); - httpClient.executeMethod(httpPostMethod); - return httpPostMethod.getResponseBodyAsString() + "\n"; } public static void main(String[] argv) { Index: tools/pom.xml =================================================================== --- tools/pom.xml (revision 1428) +++ tools/pom.xml (working copy) @@ -44,8 +44,8 @@ ant - commons-httpclient - commons-httpclient + org.apache.httpcomponents + httpclient commons-logging Index: dao-jpa-ojpa/.classpath =================================================================== --- dao-jpa-ojpa/.classpath (revision 1428) +++ dao-jpa-ojpa/.classpath (working copy) @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file Index: dao-jpa-ojpa/.project =================================================================== --- dao-jpa-ojpa/.project (revision 1428) +++ dao-jpa-ojpa/.project (working copy) @@ -1,21 +0,0 @@ - - riftsaw-dao-jpa-ojpa - RiftSaw - the JBoss BPEL engine. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - riftsaw-bpel-api - riftsaw-bpel-dao - riftsaw-bpel-epr - riftsaw-bpel-obj - riftsaw-bpel-schemas - riftsaw-dao-jpa - riftsaw-utils - - - - org.eclipse.jdt.core.javabuilder - - - - org.eclipse.jdt.core.javanature - - \ No newline at end of file Index: bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java =================================================================== --- bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java (revision 1428) +++ bpel-runtime/src/main/java/org/apache/ode/bpel/elang/xpath20/runtime/JaxpFunctionResolver.java (working copy) @@ -42,7 +42,6 @@ import net.sf.saxon.value.QNameValue; import net.sf.saxon.value.YearMonthDurationValue; -import org.apache.commons.httpclient.URIException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ode.bpel.common.FaultException; @@ -510,10 +509,8 @@ } else { return URITemplate.expand(uriTemplate, pairs); } - } catch (URIException e) { + }catch (UnsupportedOperationException e) { throw new XPathFunctionException(new FaultException(faultQName, "Invalid argument", e)); - } catch (UnsupportedOperationException e) { - throw new XPathFunctionException(new FaultException(faultQName, "Invalid argument", e)); } } Index: bpel-runtime/pom.xml =================================================================== --- bpel-runtime/pom.xml (revision 1428) +++ bpel-runtime/pom.xml (working copy) @@ -121,8 +121,8 @@ commons-logging - commons-httpclient - commons-httpclient + org.apache.httpcomponents + httpclient commons-lang Index: dao-jpa-hibernate/.classpath =================================================================== --- dao-jpa-hibernate/.classpath (revision 1428) +++ dao-jpa-hibernate/.classpath (working copy) @@ -28,7 +28,6 @@ - @@ -51,6 +50,7 @@ + Index: bpel-test/pom.xml =================================================================== --- bpel-test/pom.xml (revision 1428) +++ bpel-test/pom.xml (working copy) @@ -91,8 +91,8 @@ commons-logging - commons-httpclient - commons-httpclient + org.apache.httpcomponents + httpclient commons-lang Index: utils/src/test/java/org/apache/ode/utils/URITemplateTest.java =================================================================== --- utils/src/test/java/org/apache/ode/utils/URITemplateTest.java (revision 1428) +++ utils/src/test/java/org/apache/ode/utils/URITemplateTest.java (working copy) @@ -23,8 +23,6 @@ import java.util.*; -import org.apache.commons.httpclient.URIException; - /** * @author Alexis Midon */ Index: utils/src/main/java/org/apache/ode/utils/URITemplate.java =================================================================== --- utils/src/main/java/org/apache/ode/utils/URITemplate.java (revision 1428) +++ utils/src/main/java/org/apache/ode/utils/URITemplate.java (working copy) @@ -19,11 +19,12 @@ package org.apache.ode.utils; -import org.apache.commons.httpclient.URIException; -import org.apache.commons.httpclient.util.URIUtil; +import org.apache.commons.codec.net.URLCodec; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.http.util.EncodingUtils; +import java.util.BitSet; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -79,8 +80,7 @@ public class URITemplate { private static final Log log = LogFactory.getLog(URITemplate.class); - - + public static final String EXPANSION_REGEX = "\\{[^\\}]+\\}"; // compiled pattern of the regex private static final Pattern PATTERN = Pattern.compile(EXPANSION_REGEX); @@ -127,7 +127,7 @@ * @param nameValuePairs an array containing of name, value, name, value, and so on. Null values are allowed. * @see # expand (String, java.util.Map) */ - public static String expand(String uriTemplate, String... nameValuePairs) throws URIException, UnsupportedOperationException { + public static String expand(String uriTemplate, String... nameValuePairs) throws UnsupportedOperationException { return expand(uriTemplate, toMap(nameValuePairs)); } @@ -147,7 +147,7 @@ * @throws UnsupportedOperationException if the operation is not supported. Currently only var substitution is supported. * @see #varSubstitution(String, Object[], java.util.Map) */ - public static String expand(String uriTemplate, Map nameValuePairs) throws URIException, UnsupportedOperationException { + public static String expand(String uriTemplate, Map nameValuePairs) throws UnsupportedOperationException { return expand(uriTemplate, nameValuePairs, false); } @@ -177,14 +177,14 @@ * * @see #expand(String, java.util.Map) */ - public static String expandLazily(String uriTemplate, Map nameValuePairs) throws URIException, UnsupportedOperationException { + public static String expandLazily(String uriTemplate, Map nameValuePairs) throws UnsupportedOperationException { return expand(uriTemplate, nameValuePairs, true); } /** * @see #expandLazily(String, java.util.Map) */ - public static String expandLazily(String uriTemplate, String... nameValuePairs) throws URIException { + public static String expandLazily(String uriTemplate, String... nameValuePairs) { return expandLazily(uriTemplate, toMap(nameValuePairs)); } @@ -193,7 +193,7 @@ * @see #varSubstitution(String, Object[], java.util.Map, boolean) * @see #expandLazily(String, String[]) */ - private static String expand(String uriTemplate, Map nameValuePairs, boolean preserveUndefinedVar) throws URIException, UnsupportedOperationException { + private static String expand(String uriTemplate, Map nameValuePairs, boolean preserveUndefinedVar) throws UnsupportedOperationException { Matcher m = PATTERN.matcher(uriTemplate); // Strings are immutable in java // so let's use a buffer, and append all substrings between 2 matches and the replacement value for each match @@ -243,7 +243,7 @@ * @see org.apache.commons.httpclient.util.URIUtil#encodeWithinQuery(String) * @see java.net.URI */ - public static String varSubstitution(String expansionPattern, Object[] expansionInfo, Map nameValuePairs) throws URIException { + public static String varSubstitution(String expansionPattern, Object[] expansionInfo, Map nameValuePairs) { return varSubstitution(expansionPattern, expansionInfo, nameValuePairs, false); } @@ -270,7 +270,7 @@ *
{foo} *
{foo} */ - public static String varSubstitution(String expansionPattern, Object[] expansionInfo, Map nameValuePairs, boolean preserveUndefinedVar) throws URIException { + public static String varSubstitution(String expansionPattern, Object[] expansionInfo, Map nameValuePairs, boolean preserveUndefinedVar) { Map vars = (Map) expansionInfo[2]; // only one var per pattern Map.Entry e = (Map.Entry) vars.entrySet().iterator().next(); @@ -320,4 +320,146 @@ } return m; } + + public static class URIUtil { + + public static String encodeWithinQuery(String argString) { + return encode(argString, allowed_within_query, "UTF-8"); + } + + public static String encode(String unescaped, BitSet allowed, String charset) { + byte[] rawdata = URLCodec.encodeUrl(allowed, + EncodingUtils.getBytes(unescaped, charset)); + return EncodingUtils.getAsciiString(rawdata); + } + + public static final BitSet reserved = new BitSet(256); + // Static initializer for reserved + static { + reserved.set(';'); + reserved.set('/'); + reserved.set('?'); + reserved.set(':'); + reserved.set('@'); + reserved.set('&'); + reserved.set('='); + reserved.set('+'); + reserved.set('$'); + reserved.set(','); + } + + protected static final BitSet alpha = new BitSet(256); + // Static initializer for alpha + static { + for (int i = 'a'; i <= 'z'; i++) { + alpha.set(i); + } + for (int i = 'A'; i <= 'Z'; i++) { + alpha.set(i); + } + } + + protected static final BitSet digit = new BitSet(256); + // Static initializer for digit + static { + for (int i = '0'; i <= '9'; i++) { + digit.set(i); + } + } + + /** + * BitSet for alphanum (join of alpha & digit). + *

+         *  alphanum      = alpha | digit
+         * 

+ */ + protected static final BitSet alphanum = new BitSet(256); + // Static initializer for alphanum + static { + alphanum.or(alpha); + alphanum.or(digit); + } + + protected static final BitSet mark = new BitSet(256); + // Static initializer for mark + static { + mark.set('-'); + mark.set('_'); + mark.set('.'); + mark.set('!'); + mark.set('~'); + mark.set('*'); + mark.set('\''); + mark.set('('); + mark.set(')'); + } + + protected static final BitSet unreserved = new BitSet(256); + // Static initializer for unreserved + static { + unreserved.or(alphanum); + unreserved.or(mark); + } + + protected static final BitSet hex = new BitSet(256); + // Static initializer for hex + static { + hex.or(digit); + for (int i = 'a'; i <= 'f'; i++) { + hex.set(i); + } + for (int i = 'A'; i <= 'F'; i++) { + hex.set(i); + } + } + + protected static final BitSet percent = new BitSet(256); + // Static initializer for percent + static { + percent.set('%'); + } + + /** + * BitSet for escaped. + *

+         * escaped       = "%" hex hex
+         * 

+ */ + protected static final BitSet escaped = new BitSet(256); + // Static initializer for escaped + static { + escaped.or(percent); + escaped.or(hex); + } + + /** + * BitSet for uric. + *

+         * uric          = reserved | unreserved | escaped
+         * 

+ */ + protected static final BitSet uric = new BitSet(256); + // Static initializer for uric + static { + uric.or(reserved); + uric.or(unreserved); + uric.or(escaped); + } + + public static final BitSet allowed_query = new BitSet(256); + // Static initializer for allowed_query + static { + allowed_query.or(uric); + allowed_query.clear('%'); + } + + public static final BitSet allowed_within_query = new BitSet(256); + // Static initializer for allowed_within_query + static { + allowed_within_query.or(allowed_query); + allowed_within_query.andNot(reserved); // excluded 'reserved' + } + + } + } Index: utils/src/main/java/org/apache/ode/utils/Properties.java =================================================================== --- utils/src/main/java/org/apache/ode/utils/Properties.java (revision 1428) +++ utils/src/main/java/org/apache/ode/utils/Properties.java (working copy) @@ -19,29 +19,6 @@ package org.apache.ode.utils; -import org.apache.axis2.Constants; -import org.apache.axis2.addressing.AddressingConstants; -import org.apache.axis2.util.JavaUtils; -import org.apache.axis2.client.Options; -import org.apache.axis2.transport.http.HTTPConstants; -import org.apache.axis2.transport.http.HttpTransportProperties; -import org.apache.axis2.transport.jms.JMSConstants; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpVersion; -import org.apache.commons.httpclient.ProtocolException; -import org.apache.commons.httpclient.params.DefaultHttpParams; -import org.apache.commons.httpclient.params.HostParams; -import org.apache.commons.httpclient.params.HttpClientParams; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.params.HttpMethodParams; -import org.apache.commons.httpclient.params.HttpParams; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; - /** * @author Alexis Midon */ @@ -60,357 +37,5 @@ // its default value public static final int DEFAULT_MEX_TIMEOUT = 2 * 60 * 1000; - public static final String PROP_HTTP_CONNECTION_TIMEOUT = HttpConnectionParams.CONNECTION_TIMEOUT; - public static final String PROP_HTTP_SOCKET_TIMEOUT = HttpMethodParams.SO_TIMEOUT; - public static final String PROP_HTTP_PROTOCOL_VERSION = HttpMethodParams.PROTOCOL_VERSION; - public static final String PROP_HTTP_HEADER_PREFIX = "http.default-headers."; - public static final String PROP_HTTP_PROXY_PREFIX = "http.proxy."; - public static final String PROP_HTTP_PROXY_HOST = PROP_HTTP_PROXY_PREFIX + "host"; - public static final String PROP_HTTP_PROXY_PORT = PROP_HTTP_PROXY_PREFIX + "port"; - public static final String PROP_HTTP_PROXY_DOMAIN = PROP_HTTP_PROXY_PREFIX + "domain"; - public static final String PROP_HTTP_PROXY_USER = PROP_HTTP_PROXY_PREFIX + "user"; - public static final String PROP_HTTP_PROXY_PASSWORD = PROP_HTTP_PROXY_PREFIX + "password"; - /** - * @deprecated use org.apache.commons.httpclient.params.HttpMethodParams#HTTP_CONTENT_CHARSET (="http.protocol.content-charset") - */ - public static final String PROP_HTTP_PROTOCOL_ENCODING = "http.protocol.encoding"; - /** - * Property to override the location set in soap:address or http:address - */ - public static final String PROP_ADDRESS = "address"; - - // Httpclient specific - public static final String PROP_HTTP_MAX_REDIRECTS = HttpClientParams.MAX_REDIRECTS; - - // Axis2-specific - public static final String PROP_HTTP_REQUEST_CHUNK = "http.request.chunk"; - public static final String PROP_HTTP_REQUEST_GZIP = "http.request.gzip"; - public static final String PROP_HTTP_ACCEPT_GZIP = "http.accept.gzip"; - public static final String PROP_SECURITY_POLICY = "security.policy.file"; - public static final String PROP_JMS_REPLY_DESTINATION = "jms.reply.destination"; - public static final String PROP_JMS_REPLY_TIMEOUT = "jms.reply.timeout"; - public static final String PROP_JMS_DESTINATION_TYPE = "jms.destination.type"; - public static final String PROP_SEND_WS_ADDRESSING_HEADERS = "ws-addressing.headers"; - - - protected static final Log log = LogFactory.getLog(Properties.class); - - public static Object[] getProxyAndHeaders(Map properties) { - ArrayList

headers = null; // /!\ Axis2 requires an ArrayList (not a List implementation) - HttpTransportProperties.ProxyProperties proxy = null; - for (Map.Entry e : properties.entrySet()) { - final String k = e.getKey(); - final String v = e.getValue(); - if (k.startsWith(PROP_HTTP_HEADER_PREFIX)) { - if (headers == null) headers = new ArrayList
(); - // extract the header name - String name = k.substring(PROP_HTTP_HEADER_PREFIX.length()); - headers.add(new Header(name, v)); - } else if (k.startsWith(PROP_HTTP_PROXY_PREFIX)) { - if (proxy == null) proxy = new HttpTransportProperties.ProxyProperties(); - - if (PROP_HTTP_PROXY_HOST.equals(k)) proxy.setProxyName(v); - else if (PROP_HTTP_PROXY_PORT.equals(k)) proxy.setProxyPort(Integer.parseInt(v)); - else if (PROP_HTTP_PROXY_DOMAIN.equals(k)) proxy.setDomain(v); - else if (PROP_HTTP_PROXY_USER.equals(k)) proxy.setUserName(v); - else if (PROP_HTTP_PROXY_PASSWORD.equals(k)) proxy.setPassWord(v); - else if (log.isWarnEnabled()) - log.warn("Unknown proxy properties [" + k + "]. " + PROP_HTTP_PROXY_PREFIX + " is a refix reserved for proxy properties."); - } - } - if (proxy != null) { - String host = proxy.getProxyHostName(); - if (host == null || host.length() == 0) { - // disable proxy if the host is not null - proxy = null; - if (log.isDebugEnabled()) log.debug("Proxy host is null. Proxy will not be taken into account."); - } - } - - return new Object[]{proxy, headers}; - } - - public static class Axis2 { - - public static Options translate(Map properties) { - return translate(properties, new Options()); - } - - public static Options translate(Map properties, Options options) { - if (log.isDebugEnabled()) log.debug("Translating Properties for Axis2"); - if (properties.isEmpty()) return options; - - // First set any default values to make sure they can be overwriten - // set the default encoding for HttpClient (HttpClient uses ISO-8859-1 by default) - options.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, "UTF-8"); - - /*then add all property pairs so that new properties (with string value) - are automatically handled (i.e no translation needed) */ - for (Map.Entry e : properties.entrySet()) { - options.setProperty(e.getKey(), e.getValue()); - } - if (properties.containsKey(PROP_HTTP_CONNECTION_TIMEOUT)) { - final String value = properties.get(PROP_HTTP_CONNECTION_TIMEOUT); - try { - options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, Integer.valueOf(value)); - } catch (NumberFormatException e) { - if (log.isWarnEnabled()) - log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_CONNECTION_TIMEOUT + "=" + value + "]. Integer expected. Property will be skipped."); - } - } - if (properties.containsKey(PROP_HTTP_SOCKET_TIMEOUT)) { - final String value = properties.get(PROP_HTTP_SOCKET_TIMEOUT); - try { - options.setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf(value)); - } catch (NumberFormatException e) { - if (log.isWarnEnabled()) - log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_SOCKET_TIMEOUT + "=" + value + "]. Integer expected. Property will be skipped."); - } - } - if (properties.containsKey(PROP_HTTP_PROTOCOL_ENCODING)) { - if(log.isWarnEnabled())log.warn("Deprecated property: http.protocol.encoding. Use http.protocol.content-charset"); - options.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, properties.get(PROP_HTTP_PROTOCOL_ENCODING)); - } - if (properties.containsKey(HttpMethodParams.HTTP_CONTENT_CHARSET)) { - options.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, properties.get(HttpMethodParams.HTTP_CONTENT_CHARSET)); - } - if (properties.containsKey(PROP_HTTP_PROTOCOL_VERSION)) { - options.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, properties.get(PROP_HTTP_PROTOCOL_VERSION)); - } - if (properties.containsKey(PROP_HTTP_REQUEST_CHUNK)) { - options.setProperty(HTTPConstants.CHUNKED, properties.get(PROP_HTTP_REQUEST_CHUNK)); - } - if (properties.containsKey(PROP_HTTP_REQUEST_GZIP)) { - options.setProperty(HTTPConstants.MC_GZIP_REQUEST, properties.get(PROP_HTTP_REQUEST_GZIP)); - } - if (properties.containsKey(PROP_HTTP_ACCEPT_GZIP)) { - options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, properties.get(PROP_HTTP_ACCEPT_GZIP)); - } - if (properties.containsKey(PROP_HTTP_MAX_REDIRECTS)) { - if (log.isWarnEnabled()) log.warn("Property Not Supported: " + PROP_HTTP_MAX_REDIRECTS); - } - if (properties.containsKey(PROP_JMS_REPLY_DESTINATION)) { - options.setProperty(JMSConstants.REPLY_PARAM, properties.get(PROP_JMS_REPLY_DESTINATION)); - } - if (properties.containsKey(PROP_JMS_REPLY_TIMEOUT)) { - String value = properties.get(PROP_JMS_REPLY_TIMEOUT); - options.setProperty(JMSConstants.JMS_WAIT_REPLY, value); - // The value of this property must be a string object, not a long object. -// try { -// options.setProperty(JMSConstants.JMS_WAIT_REPLY, Long.valueOf(value)); -// } catch (NumberFormatException e) { -// if (log.isWarnEnabled()) -// log.warn("Mal-formatted Property: [" + Properties.PROP_JMS_REPLY_TIMEOUT + "=" + value + "]. Long expected. Property will be skipped."); -// } - } - if (properties.containsKey(PROP_JMS_DESTINATION_TYPE)) { - String value = properties.get(PROP_JMS_DESTINATION_TYPE); - try { - options.setProperty(JMSConstants.DEST_TYPE_PARAM, Long.valueOf(value)); - } catch (NumberFormatException e) { - if (log.isWarnEnabled()) - log.warn("Mal-formatted Property: [" + Properties.PROP_JMS_DESTINATION_TYPE + "=" + value + "]. Long expected. Property will be skipped."); - } - } - if(properties.containsKey(PROP_SEND_WS_ADDRESSING_HEADERS)){ - String value = properties.get(PROP_SEND_WS_ADDRESSING_HEADERS); - options.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, !Boolean.parseBoolean(value)); - } - if (properties.containsKey("ws-adddressing.headers")) { - if(log.isWarnEnabled())log.warn("Deprecated property: ws-adddressing.headers (Mind the 3 d's). Use ws-addressing.headers"); - String value = properties.get("ws-adddressing.headers"); - options.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, !Boolean.parseBoolean(value)); - } - - // iterate through the properties to get Headers & Proxy information - Object[] o = getProxyAndHeaders(properties); - HttpTransportProperties.ProxyProperties proxy = (HttpTransportProperties.ProxyProperties) o[0]; - ArrayList
headers = (ArrayList
) o[1]; // /!\ Axis2 requires an ArrayList (not a List implementation) - if (headers != null && !headers.isEmpty()) options.setProperty(HTTPConstants.HTTP_HEADERS, headers); - if (proxy != null) options.setProperty(HTTPConstants.PROXY, proxy); - - // Set properties that canNOT be overridden - if(JavaUtils.isTrueExplicitly(options.getProperty(HTTPConstants.REUSE_HTTP_CLIENT))){ - if (log.isWarnEnabled()) log.warn("This property cannot be overidden, and must always be false. "+ HTTPConstants.REUSE_HTTP_CLIENT); - } - options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "false"); - return options; - } - } - - - public static class HttpClient { - public static HttpParams translate(Map properties) { - return translate(properties, new DefaultHttpParams()); - } - - public static HttpParams translate(Map properties, HttpParams p) { - if (log.isDebugEnabled()) - log.debug("Translating Properties for HttpClient. Properties size=" + properties.size()); - if (properties.isEmpty()) return p; - - // First set any default values to make sure they can be overwriten - // set the default encoding for HttpClient (HttpClient uses ISO-8859-1 by default) - p.setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8"); - - /*then all property pairs so that new properties (with string value) - are automatically handled (i.e no translation needed) */ - for (Map.Entry e : properties.entrySet()) { - p.setParameter(e.getKey(), e.getValue()); - } - - // initialize the collection of headers - p.setParameter(HostParams.DEFAULT_HEADERS, new ArrayList()); - - if (properties.containsKey(PROP_HTTP_CONNECTION_TIMEOUT)) { - final String value = properties.get(PROP_HTTP_CONNECTION_TIMEOUT); - try { - p.setParameter(HttpConnectionParams.CONNECTION_TIMEOUT, Integer.valueOf(value)); - } catch (NumberFormatException e) { - if (log.isWarnEnabled()) - log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_CONNECTION_TIMEOUT + "=" + value + "] Property will be skipped."); - } - } - if (properties.containsKey(PROP_HTTP_SOCKET_TIMEOUT)) { - final String value = properties.get(PROP_HTTP_SOCKET_TIMEOUT); - try { - p.setParameter(HttpMethodParams.SO_TIMEOUT, Integer.valueOf(value)); - } catch (NumberFormatException e) { - if (log.isWarnEnabled()) - log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_SOCKET_TIMEOUT + "=" + value + "] Property will be skipped."); - } - } - - if (properties.containsKey(PROP_HTTP_PROTOCOL_ENCODING)) { - if(log.isWarnEnabled())log.warn("Deprecated property: http.protocol.encoding. Use http.protocol.content-charset"); - p.setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, properties.get(PROP_HTTP_PROTOCOL_ENCODING)); - } - // the next one is redundant because HttpMethodParams.HTTP_CONTENT_CHARSET accepts a string and we use the same property name - // so the property has already been added. - if (properties.containsKey(HttpMethodParams.HTTP_CONTENT_CHARSET)) { - p.setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, properties.get(HttpMethodParams.HTTP_CONTENT_CHARSET)); - } - - if (properties.containsKey(PROP_HTTP_PROTOCOL_VERSION)) { - try { - p.setParameter(HttpMethodParams.PROTOCOL_VERSION, HttpVersion.parse(properties.get(PROP_HTTP_PROTOCOL_VERSION))); - } catch (ProtocolException e) { - if (log.isWarnEnabled()) - - - log.warn("Mal-formatted Property: [" + PROP_HTTP_PROTOCOL_VERSION + "]", e); - } - } - if (properties.containsKey(PROP_HTTP_REQUEST_CHUNK)) { - // see org.apache.commons.httpclient.methods.EntityEnclosingMethod.setContentChunked() - p.setBooleanParameter(PROP_HTTP_REQUEST_CHUNK, Boolean.parseBoolean(properties.get(PROP_HTTP_REQUEST_CHUNK))); - } - if (properties.containsKey(PROP_HTTP_REQUEST_GZIP)) { - if (log.isWarnEnabled()) - log.warn("Property not supported by HTTP External Services: " + PROP_HTTP_REQUEST_GZIP); - } - - if (Boolean.parseBoolean(properties.get(PROP_HTTP_ACCEPT_GZIP))) { - // append gzip to the list of accepted encoding - // HttpClient does not support compression natively - // Additional code would be necessary to handle it. -// ((Collection) p.getParameter(HostParams.DEFAULT_HEADERS)).add(new Header("Accept-Encoding", "gzip")); - if (log.isWarnEnabled()) - log.warn("Property not supported by HTTP External Services: " + PROP_HTTP_ACCEPT_GZIP); - } - - if (properties.containsKey(PROP_HTTP_MAX_REDIRECTS)) { - final String value = properties.get(PROP_HTTP_MAX_REDIRECTS); - try { - p.setParameter(HttpClientParams.MAX_REDIRECTS, Integer.valueOf(value)); - } catch (NumberFormatException e) { - if (log.isWarnEnabled()) - log.warn("Mal-formatted Property: [" + Properties.PROP_HTTP_MAX_REDIRECTS + "=" + value + "] Property will be skipped."); - } - } - - Object[] o = getProxyAndHeaders(properties); - HttpTransportProperties.ProxyProperties proxy = (HttpTransportProperties.ProxyProperties) o[0]; - Collection headers = (Collection) o[1]; - if (headers != null && !headers.isEmpty()) - ((Collection) p.getParameter(HostParams.DEFAULT_HEADERS)).addAll(headers); - if (proxy != null) p.setParameter(PROP_HTTP_PROXY_PREFIX, proxy); - - return new UnmodifiableHttpParams(p); - } - - static class UnmodifiableHttpParams implements HttpParams { - - final HttpParams p; - - private UnmodifiableHttpParams(HttpParams p) { - this.p = p; - } - - public void setBooleanParameter(String name, boolean value) { - throw new UnsupportedOperationException(); - } - - public void setDefaults(HttpParams params) { - throw new UnsupportedOperationException(); - } - - public void setDoubleParameter(String name, double value) { - throw new UnsupportedOperationException(); - } - - public void setIntParameter(String name, int value) { - throw new UnsupportedOperationException(); - } - - public void setLongParameter(String name, long value) { - throw new UnsupportedOperationException(); - } - - public void setParameter(String name, Object value) { - throw new UnsupportedOperationException(); - } - - public boolean getBooleanParameter(String name, boolean defaultValue) { - return p.getBooleanParameter(name, defaultValue); - } - - public HttpParams getDefaults() { - return null; - } - - public double getDoubleParameter(String name, double defaultValue) { - return p.getDoubleParameter(name, defaultValue); - } - - public int getIntParameter(String name, int defaultValue) { - return p.getIntParameter(name, defaultValue); - } - - public long getLongParameter(String name, long defaultValue) { - return p.getLongParameter(name, defaultValue); - } - - public Object getParameter(String name) { - return p.getParameter(name); - } - - public boolean isParameterFalse(String name) { - return p.isParameterFalse(name); - } - - public boolean isParameterSet(String name) { - return p.isParameterSet(name); - } - - public boolean isParameterSetLocally(String name) { - return p.isParameterSetLocally(name); - } - - public boolean isParameterTrue(String name) { - return p.isParameterTrue(name); - } - } - } } Index: utils/pom.xml =================================================================== --- utils/pom.xml (revision 1428) +++ utils/pom.xml (working copy) @@ -53,8 +53,8 @@ commons-collections - commons-httpclient - commons-httpclient + org.apache.httpcomponents + httpclient commons-codec @@ -64,59 +64,25 @@ log4j log4j - - com.thoughtworks.xstream - xstream - - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - - - org.apache.axis2 - axis2-adb - - - org.apache.axis2 - axis2-codegen - - - org.apache.axis2 - axis2-kernel - - - org.apache.woden - woden - - - - - org.apache.axis2 - axis2-java2wsdl - - - org.apache.axis2 - axis2-saaj - - + net.sourceforge.saxon saxon - - + + net.sourceforge.saxon saxon xpath - - + + net.sourceforge.saxon saxon dom - - + + net.sourceforge.saxon saxon xqj - + commons-lang commons-lang @@ -124,6 +90,7 @@ junit junit + test