Author: fmui
Date: Thu Nov 14 14:14:07 2013
New Revision: 1541913
URL: http://svn.apache.org/r1541913
Log:
Workbench: added simple proxy detection
Added:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ProxyDetector.java
(with props)
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.bat
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.sh
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.bat
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.sh
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh
Added:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ProxyDetector.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ProxyDetector.java?rev=1541913&view=auto
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ProxyDetector.java
(added)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ProxyDetector.java
Thu Nov 14 14:14:07 2013
@@ -0,0 +1,456 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.workbench;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.chemistry.opencmis.commons.impl.IOUtils;
+
+/**
+ * Tries to detect the OS proxy configuration.
+ */
+public class ProxyDetector {
+
+ public static final String HTTP_PROXY_HOST = "http.proxyHost";
+ public static final String HTTP_PROXY_PORT = "http.proxyPort";
+ public static final String HTTPS_PROXY_HOST = "https.proxyHost";
+ public static final String HTTPS_PROXY_PORT = "https.proxyPort";
+ public static final String HTTP_NON_PROXY_HOSTS = "http.nonProxyHosts";
+
+ public static final Pattern PROXY_ENV_VAR1 =
Pattern.compile("http.?:\\/\\/(.+):(\\d+).*");
+ public static final Pattern PROXY_ENV_VAR2 =
Pattern.compile("(.+):(\\d+)");
+ public static final Pattern PROXY_WIN_REG =
Pattern.compile("\\s+Proxy(.+)\\s+REG.+\\s+(.+)");
+
+ public static boolean debug = false;
+
+ /**
+ * Gets proxy settings from system properties.
+ */
+ public static ProxySettings getJavaProxySettings() {
+ ProxySettings settings = new ProxySettings();
+
+ settings.setHttpProxyHost(System.getProperty(HTTP_PROXY_HOST));
+
settings.setHttpProxyPort(parsePort(System.getProperty(HTTP_PROXY_PORT)));
+ settings.setHttpsProxyHost(System.getProperty(HTTPS_PROXY_HOST));
+
settings.setHttpsProxyPort(parsePort(System.getProperty(HTTPS_PROXY_PORT)));
+
+ String nonProxyHosts = System.getProperty(HTTP_NON_PROXY_HOSTS);
+ if (nonProxyHosts != null) {
+ List<String> noHosts = new ArrayList<String>();
+ for (String noHost : nonProxyHosts.split("|")) {
+ noHost = noHost.trim();
+ if (noHost.length() == 0) {
+ continue;
+ }
+ noHosts.add(noHost);
+ }
+
+ settings.setNonProxyHosts(noHosts);
+ }
+
+ if (settings.getHttpProxyHost() != null ||
settings.getHttpsProxyHost() != null) {
+ return settings;
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets proxy settings from environment variables.
+ */
+ public static ProxySettings getEnvProxySettings() {
+ ProxySettings settings = new ProxySettings();
+
+ Map<String, String> env = System.getenv();
+
+ for (Map.Entry<String, String> e : env.entrySet()) {
+ if (e.getKey().equalsIgnoreCase("http_proxy")) {
+ Matcher m = PROXY_ENV_VAR1.matcher(e.getValue());
+ if (m.matches()) {
+ settings.setHttpProxyHost(parseHost(m.group(1)));
+ settings.setHttpProxyPort(parsePort(m.group(2)));
+ } else {
+ m = PROXY_ENV_VAR2.matcher(e.getValue());
+ if (m.matches()) {
+ settings.setHttpProxyHost(parseHost(m.group(1)));
+ settings.setHttpProxyPort(parsePort(m.group(2)));
+ }
+ }
+ }
+
+ if (e.getKey().equalsIgnoreCase("https_proxy")) {
+ Matcher m = PROXY_ENV_VAR1.matcher(e.getValue());
+ if (m.matches()) {
+ settings.setHttpsProxyHost(parseHost(m.group(1)));
+ settings.setHttpsProxyPort(parsePort(m.group(2)));
+ } else {
+ m = PROXY_ENV_VAR2.matcher(e.getValue());
+ if (m.matches()) {
+ settings.setHttpProxyHost(parseHost(m.group(1)));
+ settings.setHttpProxyPort(parsePort(m.group(2)));
+ }
+ }
+ }
+
+ if (e.getKey().equalsIgnoreCase("no_proxy")) {
+ List<String> noHosts = new ArrayList<String>();
+ for (String noHost : e.getValue().split(",")) {
+ noHost = noHost.trim();
+ if (noHost.length() == 0) {
+ continue;
+ }
+
+ if (noHost.charAt(0) == '.') {
+ noHost = "*" + noHost;
+ }
+
+ if (noHost.charAt(noHost.length() - 1) == '.') {
+ noHost = noHost + "*";
+ }
+
+ noHosts.add(noHost);
+ }
+
+ settings.setNonProxyHosts(noHosts);
+ }
+ }
+
+ if (settings.getHttpProxyHost() != null ||
settings.getHttpsProxyHost() != null) {
+ return settings;
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets proxy settings from the Windows registry.
+ */
+ public static ProxySettings getRegistryProxySettings() {
+ if (!isWindows()) {
+ return null;
+ }
+
+ BufferedReader reader = null;
+ try {
+ ProxySettings settings = new ProxySettings();
+
+ Process process = Runtime
+ .getRuntime()
+ .exec("reg query
\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet
Settings\" /v Proxy*");
+
+ reader = new BufferedReader(new
InputStreamReader(process.getInputStream()));
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ Matcher m = PROXY_WIN_REG.matcher(line);
+ if (!m.matches()) {
+ continue;
+ }
+
+ String key = m.group(1).trim().toLowerCase(Locale.ENGLISH);
+ String value = m.group(2).trim();
+
+ if (key.equals("enable")) {
+ if (!value.equals("0x1")) {
+ // proxies disabled
+ return null;
+ }
+ } else if (key.equals("server")) {
+ // server
+ String host = value;
+ int port = 80;
+
+ int x = value.indexOf(':');
+ if (x > 0) {
+ host = value.substring(0, x);
+ port = parsePort(value.substring(x + 1));
+ }
+
+ settings.setHttpProxyHost(host);
+ settings.setHttpProxyPort(port);
+ settings.setHttpsProxyHost(host);
+ settings.setHttpsProxyPort(port);
+ } else if (key.equals("override")) {
+ // no proxy
+ List<String> noHosts = new ArrayList<String>();
+ for (String noHost : value.split(";")) {
+ noHost = noHost.trim();
+ if (noHost.length() == 0) {
+ continue;
+ }
+ noHosts.add(noHost);
+ }
+
+ settings.setNonProxyHosts(noHosts);
+ }
+ }
+
+ if (settings.getHttpProxyHost() != null ||
settings.getHttpsProxyHost() != null) {
+ return settings;
+ }
+ } catch (IOException e) {
+ // ignore
+ if (debug) {
+ e.printStackTrace();
+ }
+ } finally {
+ IOUtils.closeQuietly(reader);
+ }
+
+ return null;
+ }
+
+ private static String parseHost(String host) {
+ if (host == null) {
+ return null;
+ }
+
+ int at = host.lastIndexOf('@');
+ if (at > -1) {
+ return host.substring(at + 1);
+ }
+
+ return host;
+ }
+
+ private static int parsePort(String port) {
+ if (port == null) {
+ return 80;
+ }
+
+ try {
+ return Integer.parseInt(port);
+ } catch (NumberFormatException e) {
+ throw new RuntimeException("Invalid port: " + port);
+ }
+ }
+
+ private static boolean isWindows() {
+ return System.getProperty("os.name").startsWith("Windows");
+ }
+
+ /**
+ * Main.
+ */
+ public static void main(String[] args) {
+ boolean javaParams = false;
+ boolean useSystemProxy = false;
+
+ for (String arg : args) {
+ if (arg.equalsIgnoreCase("-j")) {
+ javaParams = true;
+ } else if (arg.equalsIgnoreCase("-s")) {
+ useSystemProxy = true;
+ } else if (arg.equalsIgnoreCase("-d")) {
+ debug = true;
+ } else if (arg.equalsIgnoreCase("-h") ||
arg.equalsIgnoreCase("-?")) {
+ System.out.println("Parameters:");
+ System.out.println("-j print Java system properties");
+ System.out.println("-s add java.net.useSystemProxies
property");
+ return;
+ }
+ }
+
+ ProxySettings settings = null;
+
+ settings = getJavaProxySettings();
+
+ if (settings == null) {
+ // try environment variables
+ settings = getEnvProxySettings();
+ }
+
+ if (settings == null) {
+ // try the Windows registry
+ settings = getRegistryProxySettings();
+ }
+
+ // print proxy settings
+ if (javaParams) {
+ String proxyStr = "";
+
+ if (settings != null) {
+ proxyStr = settings.toJavaConfigString();
+ }
+
+ if (useSystemProxy) {
+ if (proxyStr.length() > 0) {
+ proxyStr = proxyStr + " ";
+ }
+ proxyStr = proxyStr + "-Djava.net.useSystemProxies=true";
+ }
+
+ System.out.println(proxyStr);
+ } else {
+ if (settings != null) {
+ System.out.println(settings.toString());
+ } else {
+ System.out.println("DIRECT");
+ }
+ }
+ }
+
+ /**
+ * Proxy settings holder.
+ */
+ public static class ProxySettings {
+ private String httpProxyHost;
+ private int httpProxyPort;
+
+ private String httpsProxyHost;
+ private int httpsProxyPort;
+
+ private List<String> nonProxyHosts;
+
+ public ProxySettings() {
+ }
+
+ public String getHttpProxyHost() {
+ return httpProxyHost;
+ }
+
+ public void setHttpProxyHost(String httpProxyHost) {
+ this.httpProxyHost = httpProxyHost;
+ }
+
+ public int getHttpProxyPort() {
+ return httpProxyPort;
+ }
+
+ public void setHttpProxyPort(int httpProxyPort) {
+ this.httpProxyPort = httpProxyPort;
+ }
+
+ public String getHttpsProxyHost() {
+ return httpsProxyHost;
+ }
+
+ public void setHttpsProxyHost(String httpsProxyHost) {
+ this.httpsProxyHost = httpsProxyHost;
+ }
+
+ public int getHttpsProxyPort() {
+ return httpsProxyPort;
+ }
+
+ public void setHttpsProxyPort(int httpsProxyPort) {
+ this.httpsProxyPort = httpsProxyPort;
+ }
+
+ public List<String> getNonProxyHosts() {
+ return nonProxyHosts;
+ }
+
+ public void setNonProxyHosts(List<String> nonProxyHosts) {
+ this.nonProxyHosts = nonProxyHosts;
+ }
+
+ public String toJavaConfigString() {
+ StringBuilder sb = new StringBuilder();
+
+ if (httpProxyHost != null) {
+ sb.append("-D" + HTTP_PROXY_HOST + "=" + httpProxyHost + " -D"
+ HTTP_PROXY_PORT + "=" + httpProxyPort);
+ }
+
+ if (httpsProxyHost != null) {
+ if (sb.length() > 0) {
+ sb.append(' ');
+ }
+
+ sb.append("-D" + HTTPS_PROXY_HOST + "=" + httpsProxyHost + "
-D" + HTTPS_PROXY_PORT + "="
+ + httpsProxyPort);
+ }
+
+ if (nonProxyHosts != null && !nonProxyHosts.isEmpty()) {
+ if (sb.length() > 0) {
+ sb.append(' ');
+ }
+
+ if (isWindows()) {
+ sb.append('\"');
+ }
+
+ sb.append("-D" + HTTP_NON_PROXY_HOSTS + "=");
+
+ boolean first = true;
+ for (String host : nonProxyHosts) {
+ if (!first) {
+ sb.append('|');
+ } else {
+ first = false;
+ }
+
+ sb.append(host);
+ }
+
+ if (isWindows()) {
+ sb.append('\"');
+ }
+ }
+
+ return sb.toString();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ if (httpProxyHost != null) {
+ sb.append("HTTP proxy: " + httpProxyHost + ":" +
httpProxyPort);
+ }
+
+ if (httpsProxyHost != null) {
+ if (sb.length() > 0) {
+ sb.append('\n');
+ }
+
+ sb.append("HTTPS proxy: " + httpsProxyHost + ":" +
httpsProxyPort);
+ }
+
+ if (nonProxyHosts != null && !nonProxyHosts.isEmpty()) {
+ if (sb.length() > 0) {
+ sb.append('\n');
+ }
+
+ sb.append("Non proxy hosts: ");
+
+ boolean first = true;
+ for (String host : nonProxyHosts) {
+ if (!first) {
+ sb.append(",");
+ } else {
+ first = false;
+ }
+
+ sb.append(host);
+ }
+ }
+
+ return sb.toString();
+ }
+ }
+}
Propchange:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ProxyDetector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.bat
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.bat?rev=1541913&r1=1541912&r2=1541913&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.bat
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.bat
Thu Nov 14 14:14:07 2013
@@ -19,6 +19,15 @@ rem @version@
cd %~dp0\lib
rem use variable CUSTOM_JAVA_OPTS to set additional JAVA options
-set "JAVA_OPTS=-Djava.net.useSystemProxies=true
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=axis2"
+
+rem uncomment the following lines to configure HTTP proxy
+
+rem set http_proxy=http://<proxy>:<port>
+rem set https_proxy=https://<proxy>:<port>
+rem set no_proxy=localhost,127.0.0.0,.local
+
+
+for /F "delims=/" %%x in ('"java -classpath .;*
org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s"') do set
"JAVA_PROXY_CONF=%%x"
+set JAVA_OPTS=%JAVA_PROXY_CONF%
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=axis2
start /B javaw %JAVA_OPTS% %CUSTOM_JAVA_OPTS% -classpath ".;*"
org.apache.chemistry.opencmis.workbench.Workbench
\ No newline at end of file
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.sh
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.sh?rev=1541913&r1=1541912&r2=1541913&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.sh
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-axis2.sh
Thu Nov 14 14:14:07 2013
@@ -40,24 +40,14 @@ done
# use variable CUSTOM_JAVA_OPTS to set additional JAVA options
-JAVA_OPTS="-Djava.net.useSystemProxies=true
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=axis2"
+# uncomment the following lines to configure HTTP proxy
-if [ -n "$http_proxy" ]; then
- HTTP_PROXY_HOST=$(echo $http_proxy | sed 's/http:\/\/\(.*\):.*/\1/')
- HTTP_PROXY_PORT=$(echo $http_proxy | sed 's/http:\/\/.*:\(.*\)/\1/')
- JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=$HTTP_PROXY_HOST
-Dhttp.proxyPort=$HTTP_PROXY_PORT"
-fi
-
-if [ -n "$https_proxy" ]; then
- HTTPS_PROXY_HOST=$(echo $https_proxy | sed 's/https*:\/\/\(.*\):.*/\1/')
- HTTPS_PROXY_PORT=$(echo $https_proxy | sed 's/https*:\/\/.*:\(.*\)/\1/')
- JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyHost=$HTTPS_PROXY_HOST
-Dhttps.proxyPort=$HTTPS_PROXY_PORT"
-fi
-
-if [ -n "$no_proxy" ]; then
- NON_PROXY_HOSTS=$(echo $no_proxy | sed 's/[[:space:]]//g; s/^\./\*\./g;
s/,\./,\*\./g; s/\.$/\.\*/g; s/\.,/\.\*,/g; s/,/|/g;')
- JAVA_OPTS="$JAVA_OPTS -Dhttp.nonProxyHosts=$NON_PROXY_HOSTS"
-fi
+# export http_proxy=http://<proxy>:<port>
+# export https_proxy=https://<proxy>:<port>
+# export no_proxy=localhost,127.0.0.0,.local
+JAVA_PROXY_CONF=$($JAVA -classpath $WCP
org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s)
+JAVA_OPTS="$JAVA_PROXY_CONF
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=axis2"
+
exec $JAVA $JAVA_OPTS $CUSTOM_JAVA_OPTS -classpath $WCP
org.apache.chemistry.opencmis.workbench.Workbench &
\ No newline at end of file
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.bat
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.bat?rev=1541913&r1=1541912&r2=1541913&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.bat
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.bat
Thu Nov 14 14:14:07 2013
@@ -19,6 +19,15 @@ rem @version@
cd %~dp0\lib
rem use variable CUSTOM_JAVA_OPTS to set additional JAVA options
-set "JAVA_OPTS=-Djava.net.useSystemProxies=true
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=cxf"
+
+rem uncomment the following lines to configure HTTP proxy
+
+rem set http_proxy=http://<proxy>:<port>
+rem set https_proxy=https://<proxy>:<port>
+rem set no_proxy=localhost,127.0.0.0,.local
+
+
+for /F "delims=/" %%x in ('"java -classpath .;*
org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s"') do set
"JAVA_PROXY_CONF=%%x"
+set JAVA_OPTS=%JAVA_PROXY_CONF%
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=cxf
start /B javaw %JAVA_OPTS% %CUSTOM_JAVA_OPTS% -classpath ".;*"
org.apache.chemistry.opencmis.workbench.Workbench
\ No newline at end of file
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.sh
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.sh?rev=1541913&r1=1541912&r2=1541913&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.sh
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench-cxf.sh
Thu Nov 14 14:14:07 2013
@@ -40,24 +40,14 @@ done
# use variable CUSTOM_JAVA_OPTS to set additional JAVA options
-JAVA_OPTS="-Djava.net.useSystemProxies=true
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=cxf"
+# uncomment the following lines to configure HTTP proxy
-if [ -n "$http_proxy" ]; then
- HTTP_PROXY_HOST=$(echo $http_proxy | sed 's/http:\/\/\(.*\):.*/\1/')
- HTTP_PROXY_PORT=$(echo $http_proxy | sed 's/http:\/\/.*:\(.*\)/\1/')
- JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=$HTTP_PROXY_HOST
-Dhttp.proxyPort=$HTTP_PROXY_PORT"
-fi
-
-if [ -n "$https_proxy" ]; then
- HTTPS_PROXY_HOST=$(echo $https_proxy | sed 's/https*:\/\/\(.*\):.*/\1/')
- HTTPS_PROXY_PORT=$(echo $https_proxy | sed 's/https*:\/\/.*:\(.*\)/\1/')
- JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyHost=$HTTPS_PROXY_HOST
-Dhttps.proxyPort=$HTTPS_PROXY_PORT"
-fi
-
-if [ -n "$no_proxy" ]; then
- NON_PROXY_HOSTS=$(echo $no_proxy | sed 's/[[:space:]]//g; s/^\./\*\./g;
s/,\./,\*\./g; s/\.$/\.\*/g; s/\.,/\.\*,/g; s/,/|/g;')
- JAVA_OPTS="$JAVA_OPTS -Dhttp.nonProxyHosts=$NON_PROXY_HOSTS"
-fi
+# export http_proxy=http://<proxy>:<port>
+# export https_proxy=https://<proxy>:<port>
+# export no_proxy=localhost,127.0.0.0,.local
+JAVA_PROXY_CONF=$($JAVA -classpath $WCP
org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s)
+JAVA_OPTS="$JAVA_PROXY_CONF
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=cxf"
+
exec $JAVA $JAVA_OPTS $CUSTOM_JAVA_OPTS -classpath $WCP
org.apache.chemistry.opencmis.workbench.Workbench &
\ No newline at end of file
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat?rev=1541913&r1=1541912&r2=1541913&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.bat
Thu Nov 14 14:14:07 2013
@@ -19,6 +19,15 @@ rem @version@
cd %~dp0\lib
rem use variable CUSTOM_JAVA_OPTS to set additional JAVA options
-set "JAVA_OPTS=-Djava.net.useSystemProxies=true
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=sunjre"
+
+rem uncomment the following lines to configure HTTP proxy
+
+rem set http_proxy=http://<proxy>:<port>
+rem set https_proxy=https://<proxy>:<port>
+rem set no_proxy=localhost,127.0.0.0,.local
+
+
+for /F "delims=/" %%x in ('"java -classpath .;*
org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s"') do set
"JAVA_PROXY_CONF=%%x"
+set JAVA_OPTS=%JAVA_PROXY_CONF%
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=sunjre
start /B javaw %JAVA_OPTS% %CUSTOM_JAVA_OPTS% -classpath ".;*"
org.apache.chemistry.opencmis.workbench.Workbench
\ No newline at end of file
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh?rev=1541913&r1=1541912&r2=1541913&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/start/workbench.sh
Thu Nov 14 14:14:07 2013
@@ -1,4 +1,4 @@
-#!/bin/sh
+# #!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -40,24 +40,14 @@ done
# use variable CUSTOM_JAVA_OPTS to set additional JAVA options
-JAVA_OPTS="-Djava.net.useSystemProxies=true
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=sunjre"
+# uncomment the following lines to configure HTTP proxy
-if [ -n "$http_proxy" ]; then
- HTTP_PROXY_HOST=$(echo $http_proxy | sed 's/http:\/\/\(.*\):.*/\1/')
- HTTP_PROXY_PORT=$(echo $http_proxy | sed 's/http:\/\/.*:\(.*\)/\1/')
- JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=$HTTP_PROXY_HOST
-Dhttp.proxyPort=$HTTP_PROXY_PORT"
-fi
-
-if [ -n "$https_proxy" ]; then
- HTTPS_PROXY_HOST=$(echo $https_proxy | sed 's/https*:\/\/\(.*\):.*/\1/')
- HTTPS_PROXY_PORT=$(echo $https_proxy | sed 's/https*:\/\/.*:\(.*\)/\1/')
- JAVA_OPTS="$JAVA_OPTS -Dhttps.proxyHost=$HTTPS_PROXY_HOST
-Dhttps.proxyPort=$HTTPS_PROXY_PORT"
-fi
+# export http_proxy=http://<proxy>:<port>
+# export https_proxy=https://<proxy>:<port>
+# export no_proxy=localhost,127.0.0.0,.local
-if [ -n "$no_proxy" ]; then
- NON_PROXY_HOSTS=$(echo $no_proxy | sed 's/[[:space:]]//g; s/^\./\*\./g;
s/,\./,\*\./g; s/\.$/\.\*/g; s/\.,/\.\*,/g; s/,/|/g;')
- JAVA_OPTS="$JAVA_OPTS -Dhttp.nonProxyHosts=$NON_PROXY_HOSTS"
-fi
+JAVA_PROXY_CONF=$($JAVA -classpath $WCP
org.apache.chemistry.opencmis.workbench.ProxyDetector -j -s)
+JAVA_OPTS="$JAVA_PROXY_CONF
-Dorg.apache.chemistry.opencmis.binding.webservices.jaxws.impl=sunjre"
exec $JAVA $JAVA_OPTS $CUSTOM_JAVA_OPTS -classpath $WCP
org.apache.chemistry.opencmis.workbench.Workbench &
\ No newline at end of file