Thread: [Mantisconnect-cvs] SF.net SVN: mantisconnect:[206] mantisconnect/branches/clients/java/ client-api
Brought to you by:
vboctor
From: <pl...@us...> - 2010-12-05 20:41:04
|
Revision: 206 http://mantisconnect.svn.sourceforge.net/mantisconnect/?rev=206&view=rev Author: planser Date: 2010-12-05 20:40:57 +0000 (Sun, 05 Dec 2010) Log Message: ----------- - defined configurations settings for proxy Modified Paths: -------------- mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/README.txt mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/src/main/org/mantisbt/connect/axis/Proxy.java Modified: mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/README.txt =================================================================== --- mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/README.txt 2010-12-05 20:32:56 UTC (rev 205) +++ mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/README.txt 2010-12-05 20:40:57 UTC (rev 206) @@ -104,7 +104,7 @@ [...] -Proxy.setProxy("localhost", 8080); +Proxy.configure("localhost", 8080); IMCSession session = new MCSession(url, user, pwd); [...] Modified: mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/src/main/org/mantisbt/connect/axis/Proxy.java =================================================================== --- mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/src/main/org/mantisbt/connect/axis/Proxy.java 2010-12-05 20:32:56 UTC (rev 205) +++ mantisconnect/branches/clients/java/client-api/REL_BRANCH_1_1_1_0/src/main/org/mantisbt/connect/axis/Proxy.java 2010-12-05 20:40:57 UTC (rev 206) @@ -1,72 +1,114 @@ -/* - * Copyright 2008 Peter Lanser. - * - * MantisConnect is copyrighted to Victor Boctor. - * - * This library 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 3 of the License, or (at your option) any later version. - * - * This library 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 program. - * If not, see http://www.gnu.org/licenses/. - */ -package org.mantisbt.connect.axis; - -import org.apache.axis.components.net.DefaultHTTPTransportClientProperties; - -/** - * <p> - * A class which acts as a HTTP proxy for Axis. - * </p> - * <p> - * To configure a HTTP proxy use the static method - * <code>setProxy(String, int).</code> - * </p> - * - * @author Peter Lanser, pl...@us... - */ -public class Proxy extends DefaultHTTPTransportClientProperties { - - static { - System.setProperty("org.apache.axis.components.net.TransportClientProperties", - "org.mantisbt.connect.axis.Proxy"); - } - - private static String proxyHost; - - private static String proxyPort; - - public String getProxyHost() { - if (proxyHost != null) { - return proxyHost; - } else { - return super.getProxyHost(); - } - } - - public String getProxyPort() { - if (proxyPort != null) { - return String.valueOf(proxyPort); - } else { - return super.getProxyPort(); - } - } - - public static void setProxy(String proxyHost, int proxyPort) { - if (proxyHost == null || proxyPort == 0) { - Proxy.proxyHost = null; - Proxy.proxyPort = null; - } else { - Proxy.proxyHost = proxyHost; - Proxy.proxyPort = String.valueOf(proxyPort); - } - } - -} +/* + * Copyright 2008 Peter Lanser. + * + * MantisConnect is copyrighted to Victor Boctor. + * + * This library 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 3 of the License, or (at your option) any later version. + * + * This library 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 program. + * If not, see http://www.gnu.org/licenses/. + */ +package org.mantisbt.connect.axis; + +import org.apache.axis.components.net.DefaultHTTPTransportClientProperties; + +/** + * <p> + * A class which acts as a HTTP proxy for Axis. + * </p> + * <p> + * To configure a HTTP proxy use one of the static configure methods. + * </p> + * + * @author Peter Lanser, pl...@us... + */ +public class Proxy extends DefaultHTTPTransportClientProperties { + + static { + System.setProperty("org.apache.axis.components.net.TransportClientProperties", + "org.mantisbt.connect.axis.Proxy"); + } + + private static String host; + private static String port; + private static String user; + private static String password; + private static String nonProxyHosts; + + public String getProxyHost() { + if (Proxy.host != null) { + return Proxy.host; + } else { + return super.getProxyHost(); + } + } + + public String getProxyPort() { + if (Proxy.port != null) { + return Proxy.port; + } else { + return super.getProxyPort(); + } + } + + public String getProxyUser() { + if (Proxy.user != null) { + return Proxy.user; + } else { + return super.getProxyUser(); + } + } + + public String getProxyPassword() { + if (Proxy.password != null) { + return Proxy.password; + } else { + return super.getProxyPassword(); + } + } + + public String getNonProxyHosts() { + if (Proxy.nonProxyHosts != null) { + return Proxy.nonProxyHosts; + } else { + return super.getNonProxyHosts(); + } + } + + public static void configure(String host, int port) { + configure(host, port, null, null, null); + } + + public static void configure(String host, int port, String nonProxyHosts) { + configure(host, port, null, null, nonProxyHosts); + } + + public static void configure(String host, int port, String user, String password) { + configure(host, port, user, password, null); + } + + public static void configure(String host, int port, String user, String password, String nonProxyHosts) { + Proxy.host = host; + Proxy.port = String.valueOf(port); + Proxy.user = user; + Proxy.password = password; + Proxy.nonProxyHosts = nonProxyHosts; + } + + /** + * @deprecated Use <tt>configure(String host, int port)</tt> instead. + */ + public static void setProxy(String host, int port) { + configure(host, port); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |