本文整理匯總了Java中org.tmatesoft.svn.core.SVNURL.getProtocol方法的典型用法代碼示例。如果您正苦於以下問題:Java SVNURL.getProtocol方法的具體用法?Java SVNURL.getProtocol怎麽用?Java SVNURL.getProtocol使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.tmatesoft.svn.core.SVNURL
的用法示例。
在下文中一共展示了SVNURL.getProtocol方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getReadTimeout
import org.tmatesoft.svn.core.SVNURL; //導入方法依賴的package包/類
public int getReadTimeout(@NotNull SVNURL url) {
String protocol = url.getProtocol();
if (HTTP.equals(protocol) || HTTPS.equals(protocol)) {
String host = url.getHost();
String timeout = getServersPropertyIdea(host, "http-timeout");
if (timeout != null) {
try {
return Integer.parseInt(timeout) * 1000;
}
catch (NumberFormatException nfe) {
// use default
}
}
return DEFAULT_READ_TIMEOUT;
}
if (SVN_SSH.equals(protocol)) {
return (int)getConfig().getSshReadTimeout();
}
return 0;
}
示例2: commonScheme
import org.tmatesoft.svn.core.SVNURL; //導入方法依賴的package包/類
private void commonScheme(final SVNURL url, final boolean username, final String realm) throws SVNException {
String kind = null;
final String actualRealm = realm == null ? "realm" : realm;
final String protocol = url.getProtocol();
if (username) {
kind = ISVNAuthenticationManager.USERNAME;
} else if ("svn+ssh".equals(protocol)) {
kind = ISVNAuthenticationManager.SSH;
} else if ("http".equals(protocol)) {
kind = ISVNAuthenticationManager.PASSWORD;
} else if ("https".equals(protocol)) {
kind = ISVNAuthenticationManager.SSL;
} else if ("file".equals(protocol)) {
kind = ISVNAuthenticationManager.USERNAME;
}
SVNAuthentication authentication = null;
try {
authentication = myAuthenticationManager.getFirstAuthentication(kind, actualRealm, url);
while (! passwordSpecified(authentication)) {
authentication = myAuthenticationManager.getNextAuthentication(kind, actualRealm, url);
}
} finally {
myAuthenticationManager.acknowledgeAuthentication(authentication != null, kind, actualRealm, null, authentication, url);
}
}
示例3: getConnectTimeout
import org.tmatesoft.svn.core.SVNURL; //導入方法依賴的package包/類
public int getConnectTimeout(@NotNull SVNURL url) {
String protocol = url.getProtocol();
if (SVN_SSH.equals(protocol)) {
return (int)getConfig().getSshConnectionTimeout();
}
final int connectTimeout = getHostOptionsProvider().getHostOptions(url).getConnectTimeout();
if ((HTTP.equals(protocol) || HTTPS.equals(protocol)) && (connectTimeout <= 0)) {
return DEFAULT_READ_TIMEOUT;
}
return connectTimeout;
}
示例4: createProxy
import org.tmatesoft.svn.core.SVNURL; //導入方法依賴的package包/類
private ISVNProxyManager createProxy(SVNURL url) {
// this code taken from default manager (changed for system properties reading)
String host = url.getHost();
String proxyHost = getServersPropertyIdea(host, HTTP_PROXY_HOST);
if (StringUtil.isEmptyOrSpaces(proxyHost)) {
if (getConfig().isIsUseDefaultProxy()) {
// ! use common proxy if it is set
try {
final List<Proxy> proxies = HttpConfigurable.getInstance().getOnlyBySettingsSelector().select(new URI(url.toString()));
if (proxies != null && ! proxies.isEmpty()) {
for (Proxy proxy : proxies) {
if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
final SocketAddress address = proxy.address();
if (address instanceof InetSocketAddress) {
return new MyPromptingProxyManager(((InetSocketAddress)address).getHostName(),
String.valueOf(((InetSocketAddress)address).getPort()), url.getProtocol());
}
}
}
}
}
catch (URISyntaxException e) {
LOG.info(e);
}
}
return null;
}
String proxyExceptions = getServersPropertyIdea(host, "http-proxy-exceptions");
String proxyExceptionsSeparator = ",";
if (proxyExceptions == null) {
proxyExceptions = System.getProperty("http.nonProxyHosts");
proxyExceptionsSeparator = "|";
}
if (proxyExceptions != null) {
for(StringTokenizer exceptions = new StringTokenizer(proxyExceptions, proxyExceptionsSeparator); exceptions.hasMoreTokens();) {
String exception = exceptions.nextToken().trim();
if (DefaultSVNOptions.matches(exception, host)) {
return null;
}
}
}
String proxyPort = getServersPropertyIdea(host, HTTP_PROXY_PORT);
String proxyUser = getServersPropertyIdea(host, HTTP_PROXY_USERNAME);
String proxyPassword = getServersPropertyIdea(host, HTTP_PROXY_PASSWORD);
return new MySimpleProxyManager(proxyHost, proxyPort, proxyUser, proxyPassword);
}