本文整理汇总了Java中org.apache.maven.wagon.proxy.ProxyInfo类的典型用法代码示例。如果您正苦于以下问题:Java ProxyInfo类的具体用法?Java ProxyInfo怎么用?Java ProxyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProxyInfo类属于org.apache.maven.wagon.proxy包,在下文中一共展示了ProxyInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFetcher
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
private WagonHelper.WagonFetcher createFetcher(final Wagon wagon, TransferListener listener, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo) {
if(isDiag()) {
return new WagonHelper.WagonFetcher(wagon, listener, authenticationInfo, proxyInfo) {
@Override
public InputStream retrieve(String name) throws IOException, FileNotFoundException {
String id = wagon.getRepository().getId();
if(name.contains("properties") && System.getProperty("maven.diag.index.properties." + id) != null) { // NOI18N
LOGGER.log(Level.INFO, "maven indexer will use local properties file: {0}", System.getProperty("maven.diag.index.properties." + id)); // NOI18N
return new FileInputStream(new File(System.getProperty("maven.diag.index.properties." + id))); // NOI18N
} else if(name.contains(".gz") && System.getProperty("maven.diag.index.gz." + id) != null) { // NOI18N
LOGGER.log(Level.INFO, "maven indexer will use gz file: {0}", System.getProperty("maven.diag.index.gz." + id)); // NOI18N
return new FileInputStream(new File(System.getProperty("maven.diag.index.gz." + id))); // NOI18N
}
return super.retrieve(name);
}
};
} else {
return new WagonHelper.WagonFetcher(wagon, listener, authenticationInfo, proxyInfo);
}
}
示例2: createWagon
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
Wagon createWagon(String serverId, String url) throws WagonException {
Repository repository = new Repository(serverId, url);
Wagon wagon = wagonManager.getWagon(repository);
if (getLog().isDebugEnabled()) {
Debug debug = new Debug();
wagon.addSessionListener(debug);
wagon.addTransferListener(debug);
}
ProxyInfo proxyInfo = getProxyInfo();
if (proxyInfo != null) {
wagon
.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo);
} else {
wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
}
return wagon;
}
示例3: createWagon
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
/**
* Convenience method to create a wagon.
*
* @param serverId The serverId to use if the wagonManager needs help.
* @param url The url to create a wagon for.
* @param wagonManager The wgaon manager to use.
* @param settings The settings to use.
* @param logger The logger to use.
* @return The wagon to connect to the url.
* @throws org.apache.maven.wagon.UnsupportedProtocolException
* if the protocol is not supported.
* @throws org.apache.maven.artifact.manager.WagonConfigurationException
* if the wagon cannot be configured.
* @throws org.apache.maven.wagon.ConnectionException
* If the connection cannot be established.
* @throws org.apache.maven.wagon.authentication.AuthenticationException
* If the connection cannot be authenticated.
*/
public static Wagon createWagon( String serverId, String url, WagonManager wagonManager, Settings settings,
Log logger )
throws UnsupportedProtocolException, WagonConfigurationException, ConnectionException, AuthenticationException
{
Repository repository = new Repository( serverId, url );
Wagon wagon = wagonManager.getWagon( repository );
if ( logger.isDebugEnabled() )
{
Debug debug = new Debug();
wagon.addSessionListener( debug );
wagon.addTransferListener( debug );
}
ProxyInfo proxyInfo = getProxyInfo( settings );
if ( proxyInfo != null )
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo );
}
else
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) );
}
return wagon;
}
示例4: getProxyInfo
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
ProxyInfo getProxyInfo() {
if (settings.getActiveProxy() == null) {
return null;
}
ProxyInfo proxyInfo = new ProxyInfo();
Proxy proxy = settings.getActiveProxy();
proxyInfo.setHost(proxy.getHost());
proxyInfo.setType(proxy.getProtocol());
proxyInfo.setPort(proxy.getPort());
proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts());
proxyInfo.setUserName(proxy.getUsername());
proxyInfo.setPassword(proxy.getPassword());
return proxyInfo;
}
示例5: getClientConfiguration
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
static ClientConfiguration getClientConfiguration(ProxyInfoProvider proxyInfoProvider) {
ClientConfiguration clientConfiguration = new ClientConfiguration();
if (proxyInfoProvider != null) {
ProxyInfo proxyInfo = proxyInfoProvider.getProxyInfo("s3");
if (proxyInfo != null) {
clientConfiguration.withProxyHost(proxyInfo.getHost()).withProxyPort(proxyInfo.getPort());
}
}
return clientConfiguration;
}
示例6: getProxyInfo
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
@Override
public ProxyInfo getProxyInfo(String protocol) {
if ((protocol == null) || (this.proxyInfo == null) || protocol.equalsIgnoreCase(this.proxyInfo.getType())) {
return this.proxyInfo;
} else {
return null;
}
}
示例7: createWagon
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
/**
* Convenience method to create a wagon.
*
* @param serverId The serverId to use if the wagonManager needs help.
* @param url The url to create a wagon for.
* @param wagonManager The wgaon manager to use.
* @param settings The settings to use.
* @param logger The logger to use.
* @return The wagon to connect to the url.
* @throws org.apache.maven.wagon.UnsupportedProtocolException if the protocol is not supported.
* @throws org.apache.maven.artifact.manager.WagonConfigurationException if the wagon cannot be configured.
* @throws org.apache.maven.wagon.ConnectionException If the connection cannot be established.
* @throws org.apache.maven.wagon.authentication.AuthenticationException If the connection cannot be authenticated.
*/
public static Wagon createWagon( String serverId, String url, WagonManager wagonManager, Settings settings,
Log logger )
throws UnsupportedProtocolException, WagonConfigurationException,
ConnectionException, AuthenticationException
{
Repository repository = new Repository( serverId, url );
Wagon wagon = wagonManager.getWagon( repository );
if ( logger.isDebugEnabled() )
{
Debug debug = new Debug();
wagon.addSessionListener( debug );
wagon.addTransferListener( debug );
}
ProxyInfo proxyInfo = getProxyInfo( settings );
if ( proxyInfo != null )
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo );
}
else
{
wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) );
}
return wagon;
}
示例8: getProxyInfo
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
public static ProxyInfo getProxyInfo(Repository repository, WagonManager wagonManager) {
ProxyInfo proxyInfo = wagonManager.getProxy(repository.getProtocol());
if (proxyInfo == null) {
return null;
}
String host = repository.getHost();
String nonProxyHostsAsString = proxyInfo.getNonProxyHosts();
for (String nonProxyHost : StringUtils.split(nonProxyHostsAsString, ",;|")) {
if (org.apache.commons.lang.StringUtils.contains(nonProxyHost, "*")) {
// Handle wildcard at the end, beginning or middle of the nonProxyHost
final int pos = nonProxyHost.indexOf('*');
String nonProxyHostPrefix = nonProxyHost.substring(0, pos);
String nonProxyHostSuffix = nonProxyHost.substring(pos + 1);
// prefix*
if (StringUtils.isNotEmpty(nonProxyHostPrefix) && host.startsWith(nonProxyHostPrefix)
&& StringUtils.isEmpty(nonProxyHostSuffix)) {
return null;
}
// *suffix
if (StringUtils.isEmpty(nonProxyHostPrefix)
&& StringUtils.isNotEmpty(nonProxyHostSuffix) && host.endsWith(nonProxyHostSuffix)) {
return null;
}
// prefix*suffix
if (StringUtils.isNotEmpty(nonProxyHostPrefix) && host.startsWith(nonProxyHostPrefix)
&& StringUtils.isNotEmpty(nonProxyHostSuffix) && host.endsWith(nonProxyHostSuffix)) {
return null;
}
} else if (host.equals(nonProxyHost)) {
return null;
}
}
return proxyInfo;
}
示例9: getProxy
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
private org.apache.maven.settings.Proxy getProxy( ArtifactRepository repository,
List<org.apache.maven.settings.Proxy> proxies )
{
if ( proxies != null && repository.getProtocol() != null )
{
for ( org.apache.maven.settings.Proxy proxy : proxies )
{
if ( proxy.isActive() && repository.getProtocol().equalsIgnoreCase( proxy.getProtocol() ) )
{
if ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) )
{
ProxyInfo pi = new ProxyInfo();
pi.setNonProxyHosts( proxy.getNonProxyHosts() );
org.apache.maven.wagon.repository.Repository repo =
new org.apache.maven.wagon.repository.Repository( repository.getId(), repository.getUrl() );
if ( !ProxyUtils.validateNonProxyHosts( pi, repo.getHost() ) )
{
return proxy;
}
}
else
{
return proxy;
}
}
}
}
return null;
}
示例10: getProxy
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
public ProxyInfo getProxy( String protocol )
{
MavenSession session = legacySupport.getSession();
if ( session != null && protocol != null )
{
MavenExecutionRequest request = session.getRequest();
if ( request != null )
{
List<Proxy> proxies = request.getProxies();
if ( proxies != null )
{
for ( Proxy proxy : proxies )
{
if ( proxy.isActive() && protocol.equalsIgnoreCase( proxy.getProtocol() ) )
{
SettingsDecryptionResult result =
settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( proxy ) );
proxy = result.getProxy();
ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setHost( proxy.getHost() );
proxyInfo.setType( proxy.getProtocol() );
proxyInfo.setPort( proxy.getPort() );
proxyInfo.setNonProxyHosts( proxy.getNonProxyHosts() );
proxyInfo.setUserName( proxy.getUsername() );
proxyInfo.setPassword( proxy.getPassword() );
return proxyInfo;
}
}
}
}
}
return null;
}
示例11: connect
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
@Override
public final void connect(Repository repository, ProxyInfo proxyInfo) throws ConnectionException, AuthenticationException {
connect(repository);
}
示例12: connect
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
@Override
public void connect( Repository source, ProxyInfo proxyInfo )
throws ConnectionException, AuthenticationException
{
delegate.connect( source, proxyInfo );
}
示例13: connect
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
@Override
public void connect( Repository repository, ProxyInfo proxyInfo )
throws ConnectionException, AuthenticationException
{
}
示例14: NullProtectingProxyInfoProvider
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
NullProtectingProxyInfoProvider(ProxyInfo proxyInfo) {
this.proxyInfo = proxyInfo;
}
示例15: connect
import org.apache.maven.wagon.proxy.ProxyInfo; //导入依赖的package包/类
@Override
public final void connect(Repository source, ProxyInfo proxyInfo) throws ConnectionException,
AuthenticationException {
connect(source, null, proxyInfo);
}