本文整理汇总了Java中org.apache.maven.settings.Proxy.getPassword方法的典型用法代码示例。如果您正苦于以下问题:Java Proxy.getPassword方法的具体用法?Java Proxy.getPassword怎么用?Java Proxy.getPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.Proxy
的用法示例。
在下文中一共展示了Proxy.getPassword方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getActiveHttpProxy
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/**
* @return proxy string as [user[:password]@]proxyHost[:proxyPort] or null
*/
static String getActiveHttpProxy( Settings s )
{
String retVal = null;
for ( Proxy p : s.getProxies() )
{
if ( p.isActive() && "http".equals( p.getProtocol() ) )
{
StringBuilder sb = new StringBuilder();
String user = p.getUsername();
String pwd = p.getPassword();
if ( user != null )
{
sb.append( user );
if ( pwd != null )
{
sb.append( ":" );
sb.append( pwd );
}
sb.append( "@" );
}
sb.append( p.getHost() );
sb.append( ":" );
sb.append( p.getPort() );
retVal = sb.toString().trim();
break;
}
}
return retVal;
}
示例4: getProxyString
import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
private String getProxyString(final Proxy activeProxy) {
// Check sanity
if (activeProxy == null) {
return null;
}
// The XJC proxy argument should be on the form
// [user[:password]@]proxyHost[:proxyPort]
//
// builder.withNamedArgument("httpproxy", httpproxy);
//
final StringBuilder proxyBuilder = new StringBuilder();
if (activeProxy.getUsername() != null) {
// Start with the username.
proxyBuilder.append(activeProxy.getUsername());
// Append the password if provided.
if (activeProxy.getPassword() != null) {
proxyBuilder.append(":").append(activeProxy.getPassword());
}
proxyBuilder.append("@");
}
// Append hostname and port.
proxyBuilder.append(activeProxy.getHost()).append(":").append(activeProxy.getPort());
// All done.
return proxyBuilder.toString();
}
示例5: 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()
);
}
示例6: 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);
}
}
示例7: 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;
}