本文整理汇总了Java中org.apache.maven.settings.Proxy.getHost方法的典型用法代码示例。如果您正苦于以下问题:Java Proxy.getHost方法的具体用法?Java Proxy.getHost怎么用?Java Proxy.getHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.Proxy
的用法示例。
在下文中一共展示了Proxy.getHost方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProxyConfig
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
static ProxyConfig getProxyConfig(MavenSession mavenSession) {
if (
mavenSession == null ||
mavenSession.getSettings() == null ||
mavenSession.getSettings().getActiveProxy() == null ||
!mavenSession.getSettings().getActiveProxy().isActive()
) {
return null;
} else {
Proxy mavenProxy = mavenSession.getSettings().getActiveProxy();
return new ProxyConfig(
mavenProxy.getProtocol(),
mavenProxy.getHost(),
mavenProxy.getPort(),
mavenProxy.getUsername(),
mavenProxy.getPassword());
}
}
示例2: ProxySettings
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
public ProxySettings(@Nonnull final Proxy mavenProxy) {
this.protocol = mavenProxy.getProtocol();
this.host = mavenProxy.getHost();
this.port = mavenProxy.getPort();
this.username = mavenProxy.getUsername();
this.password = mavenProxy.getPassword();
this.nonProxyHosts = mavenProxy.getNonProxyHosts();
}
示例3: proxyConfiguration
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/**
* Extract configuration from given maven proxy settings.
*
* @param proxy Proxy.
* @return Proxy configuration.
*/
public static ProxyConfig proxyConfiguration(Proxy proxy) {
return new ProxyConfig(
proxy.getProtocol(),
proxy.getUsername(),
proxy.getPassword(),
proxy.getHost(),
proxy.getPort()
);
}
示例4: getActiveProxyAsHttpproxy
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
protected String getActiveProxyAsHttpproxy() {
if (getSettings() == null) {
return null;
}
final Settings settings = getSettings();
final Proxy activeProxy = settings.getActiveProxy();
if (activeProxy == null || activeProxy.getHost() == null) {
return null;
}
return createXJCProxyArgument(activeProxy.getHost(), activeProxy.getPort(), activeProxy.getUsername(),
activeProxy.getPassword());
}
示例5: confluenceExecute
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/**
*
* @param task
* @throws MojoExecutionException
*/
protected <T extends Action1<ConfluenceService>> void confluenceExecute(T task) throws MojoExecutionException {
ConfluenceService confluence = null;
try {
ConfluenceProxy proxyInfo = null;
final Proxy activeProxy = mavenSettings.getActiveProxy();
if (activeProxy != null) {
proxyInfo =
new ConfluenceProxy(
activeProxy.getHost(),
activeProxy.getPort(),
activeProxy.getUsername(),
activeProxy.getPassword(),
activeProxy.getNonProxyHosts()
);
}
final ConfluenceService.Credentials credentials =
new ConfluenceService.Credentials(getUsername(), getPassword());
confluence =
ConfluenceServiceFactory.createInstance(
getEndPoint(),
credentials,
proxyInfo,
sslCertificate
);
getLog().info( String.valueOf(confluence) );
confluence.call(task);
} catch( RuntimeException re ) {
throw re;
} catch (Exception e) {
final String msg = "has been impossible connect to confluence due exception";
//getLog().error(msg, e);
throw new MojoExecutionException(msg, e);
}
}
示例6: activateProxy
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/**
* Called to install the plugins proxy settings.
*/
protected Object activateProxy()
{
if ( settings == null )
{
return null;
}
final Proxy proxy = settings.getActiveProxy();
if ( proxy == null )
{
return null;
}
final List<String> properties = new ArrayList<String>();
final String protocol = proxy.getProtocol();
final String prefix = isEmpty( protocol ) ? "" : ( protocol + "." );
final String host = proxy.getHost();
final String hostProperty = prefix + "proxyHost";
final String hostValue = isEmpty( host ) ? null : host;
setProperty( properties, hostProperty, hostValue );
final int port = proxy.getPort();
final String portProperty = prefix + "proxyPort";
final String portValue = ( port == 0 || port == -1 ) ? null : String.valueOf( port );
setProperty( properties, portProperty, portValue );
final String username = proxy.getUsername();
final String userProperty = prefix + "proxyUser";
final String userValue = isEmpty( username ) ? null : username;
setProperty( properties, userProperty, userValue );
final String password = proxy.getPassword();
final String passwordProperty = prefix + "proxyPassword";
final String passwordValue = isEmpty( password ) ? null : password;
setProperty( properties, passwordProperty, passwordValue );
final String nonProxyHosts = proxy.getNonProxyHosts();
final String nonProxyHostsProperty = prefix + "nonProxyHosts";
final String nonProxyHostsValue = isEmpty( nonProxyHosts ) ? null : nonProxyHosts.replace( ',', '|' );
setProperty( properties, nonProxyHostsProperty, nonProxyHostsValue );
getLog().debug( "Proxy settings: " + hostProperty + "=" + hostValue + ", " + portProperty + "=" + portValue
+ ", " + userProperty + "=" + userValue + ", " + passwordProperty + "="
+ ( passwordValue == null ? "null" : "<PasswordNotLogged>" ) + ", " + nonProxyHostsProperty + "="
+ nonProxyHostsValue );
return properties;
}