当前位置: 首页>>代码示例>>Java>>正文


Java HttpWagon类代码示例

本文整理汇总了Java中org.apache.maven.wagon.providers.http.HttpWagon的典型用法代码示例。如果您正苦于以下问题:Java HttpWagon类的具体用法?Java HttpWagon怎么用?Java HttpWagon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpWagon类属于org.apache.maven.wagon.providers.http包,在下文中一共展示了HttpWagon类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupWagon

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
protected void setupWagon( NetworkConfiguration networkConfiguration )
{
    if ( networkConfiguration == null )
    {
        // back to default values
        HttpWagon.setPersistentPool( true );
        poolingClientConnectionManager = new PoolingHttpClientConnectionManager();
        poolingClientConnectionManager.setDefaultMaxPerRoute( 30 );
        poolingClientConnectionManager.setMaxTotal( 30 );
        HttpWagon.setPoolingHttpClientConnectionManager( poolingClientConnectionManager );

    }
    else
    {
        HttpWagon.setPersistentPool( networkConfiguration.isUsePooling() );
        poolingClientConnectionManager = new PoolingHttpClientConnectionManager();
        poolingClientConnectionManager.setDefaultMaxPerRoute( networkConfiguration.getMaxTotalPerHost() );
        poolingClientConnectionManager.setMaxTotal( networkConfiguration.getMaxTotal() );
        HttpWagon.setPoolingHttpClientConnectionManager( poolingClientConnectionManager );
    }
}
 
开发者ID:apache,项目名称:archiva,代码行数:22,代码来源:DefaultArchivaAdministration.java

示例2: lookup

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
@Override
public Wagon lookup(String roleHint) throws Exception {
    if ("http".equals(roleHint)) {
        if (useLightweightHttpWagon) {
            LightweightHttpWagon lightweightHttpWagon = new LightweightHttpWagon();
            FieldUtils.writeField(lightweightHttpWagon, "authenticator", new LightweightHttpWagonAuthenticator(), true);
            return lightweightHttpWagon;
        } else {
            return new HttpWagon();
        }
    } else if ("https".equals(roleHint)) {
        if (useLightweightHttpWagon) {
            LightweightHttpsWagon lightweightHttpsWagon = new LightweightHttpsWagon();
            FieldUtils.writeField(lightweightHttpsWagon, "authenticator", new LightweightHttpWagonAuthenticator(), true);
            return lightweightHttpsWagon;
        } else {
            return new HttpWagon();
        }
    } else if ("file".equals(roleHint)) {
        return new FileWagon();
    }
    return null;
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:24,代码来源:InternalWagonProvider.java

示例3: lookup

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
@Override
public Wagon lookup(String roleHint) throws Exception {
  if ("http".equals(roleHint)) {
    return new LightweightHttpWagon();
  }

  if ("https".equals(roleHint)) {
    return new HttpWagon();
  }

  return null;
}
 
开发者ID:lorthos,项目名称:incubator-zeppelin-druid,代码行数:13,代码来源:RepositorySystemFactory.java

示例4: downloadWithRemoteRedirect

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
@Test
public void downloadWithRemoteRedirect()
    throws Exception
{
    RemoteRepository remoteRepository = getRemoteRepositoriesService().getRemoteRepository( "central" );
    remoteRepository.setUrl( "http://localhost:" + redirectPort );
    getRemoteRepositoriesService().updateRemoteRepository( remoteRepository );

    RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader );

    if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
                                                     "internal" ) )
    {
        roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal" );
    }

    getUserService( authorizationHeader ).createGuestUser();
    roleManagementService.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, "guest" );

    roleManagementService.assignTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal",
                                               "guest" );

    getUserService( authorizationHeader ).removeFromCache( "guest" );

    Path file = Paths.get( "target/junit-4.9.jar" );
    Files.deleteIfExists( file );

    HttpWagon httpWagon = new HttpWagon();
    httpWagon.connect( new Repository( "foo", "http://localhost:" + port ) );

    httpWagon.get( "repository/internal/junit/junit/4.9/junit-4.9.jar", file.toFile() );

    ZipFile zipFile = new ZipFile( file.toFile() );
    List<String> entries = getZipEntriesNames( zipFile );
    ZipEntry zipEntry = zipFile.getEntry( "org/junit/runners/JUnit4.class" );
    assertNotNull( "cannot find zipEntry org/junit/runners/JUnit4.class, entries: " + entries + ", content is: "
                       + FileUtils.readFileToString( file.toFile() ), zipEntry );
    zipFile.close();
    file.toFile().deleteOnExit();
}
 
开发者ID:apache,项目名称:archiva,代码行数:41,代码来源:DownloadArtifactsTest.java

示例5: lookup

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
public Wagon lookup( String roleHint )
    throws Exception
{
    if ( "http".equals( roleHint ) )
    {
        return new HttpWagon();
    }
    return null;
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:10,代码来源:MavenClasspathBuilder.java

示例6: downloadWithRemoteRedirect

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
@Test
public void downloadWithRemoteRedirect()
    throws Exception
{
    RemoteRepository remoteRepository = getRemoteRepositoriesService().getRemoteRepository( "central" );
    remoteRepository.setUrl( "http://localhost:" + redirectPort );
    getRemoteRepositoriesService().updateRemoteRepository( remoteRepository );

    RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader );

    if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
                                                     "internal" ) )
    {
        roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal" );
    }

    getUserService( authorizationHeader ).createGuestUser();
    roleManagementService.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, "guest" );

    roleManagementService.assignTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal",
                                               "guest" );

    getUserService( authorizationHeader ).removeFromCache( "guest" );

    File file = new File( "target/junit-4.9.jar" );
    if ( file.exists() )
    {
        file.delete();
    }

    HttpWagon httpWagon = new HttpWagon();
    httpWagon.connect( new Repository( "foo", "http://localhost:" + port ) );

    httpWagon.get( "/repository/internal/junit/junit/4.9/junit-4.9.jar", file );

    ZipFile zipFile = new ZipFile( file );
    List<String> entries = getZipEntriesNames( zipFile );
    ZipEntry zipEntry = zipFile.getEntry( "org/junit/runners/JUnit4.class" );
    assertNotNull( "cannot find zipEntry org/junit/runners/JUnit4.class, entries: " + entries + ", content is: "
                       + FileUtils.readFileToString( file ), zipEntry );
    zipFile.close();
    file.deleteOnExit();
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:44,代码来源:DownloadArtifactsTest.java

示例7: downloadSNAPSHOT

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
@Test
public void downloadSNAPSHOT()
    throws Exception
{

    File tmpIndexDir = new File( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex" );
    if ( tmpIndexDir.exists() )
    {
        FileUtils.deleteDirectory( tmpIndexDir );
    }
    String id = Long.toString( System.currentTimeMillis() );
    ManagedRepository managedRepository = new ManagedRepository();
    managedRepository.setId( id );
    managedRepository.setName( "name of " + id );
    managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/snapshot-repo" );
    managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex/" + id );

    ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService();

    if ( managedRepositoriesService.getManagedRepository( id ) != null )
    {
        managedRepositoriesService.deleteManagedRepository( id, false );
    }

    getManagedRepositoriesService().addManagedRepository( managedRepository );

    RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader );

    if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
                                                     id ) )
    {
        roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id );
    }

    getUserService( authorizationHeader ).createGuestUser();
    roleManagementService.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, "guest" );

    roleManagementService.assignTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id,
                                               "guest" );

    getUserService( authorizationHeader ).removeFromCache( "guest" );

    File file = new File( "target/archiva-model-1.4-M4-SNAPSHOT.jar" );
    if ( file.exists() )
    {
        file.delete();
    }

    HttpWagon httpWagon = new HttpWagon();
    httpWagon.connect( new Repository( "foo", "http://localhost:" + port ) );

    httpWagon.get( "/repository/"+ id +"/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-SNAPSHOT.jar", file );

    ZipFile zipFile = new ZipFile( file );
    List<String> entries = getZipEntriesNames( zipFile );
    ZipEntry zipEntry = zipFile.getEntry( "org/apache/archiva/model/ArchivaArtifact.class" );
    assertNotNull( "cannot find zipEntry org/apache/archiva/model/ArchivaArtifact.class, entries: " + entries + ", content is: "
                       + FileUtils.readFileToString( file ), zipEntry );
    zipFile.close();
    file.deleteOnExit();



}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:65,代码来源:DownloadSnapshotTest.java

示例8: downloadSNAPSHOT

import org.apache.maven.wagon.providers.http.HttpWagon; //导入依赖的package包/类
@Test
public void downloadSNAPSHOT()
    throws Exception
{

    Path tmpIndexDir = Paths.get( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex" );
    if ( Files.exists(tmpIndexDir) )
    {
        org.apache.archiva.common.utils.FileUtils.deleteDirectory( tmpIndexDir );
    }
    String id = Long.toString( System.currentTimeMillis() );
    ManagedRepository managedRepository = new ManagedRepository( Locale.getDefault());
    managedRepository.setId( id );
    managedRepository.setName( "name of " + id );
    managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/snapshot-repo" );
    managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex/" + id );

    ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService();

    if ( managedRepositoriesService.getManagedRepository( id ) != null )
    {
        managedRepositoriesService.deleteManagedRepository( id, false );
    }

    getManagedRepositoriesService().addManagedRepository( managedRepository );

    RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader );

    if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
                                                     id ) )
    {
        roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id );
    }

    getUserService( authorizationHeader ).createGuestUser();
    roleManagementService.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, "guest" );

    roleManagementService.assignTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, id,
                                               "guest" );

    getUserService( authorizationHeader ).removeFromCache( "guest" );

    Path file = Paths.get( "target/archiva-model-1.4-M4-SNAPSHOT.jar" );
    Files.deleteIfExists(file);

    HttpWagon httpWagon = new HttpWagon();
    httpWagon.connect( new Repository( "foo", "http://localhost:" + port ) );

    httpWagon.get( "/repository/"+ id +"/org/apache/archiva/archiva-model/1.4-M4-SNAPSHOT/archiva-model-1.4-M4-SNAPSHOT.jar", file.toFile() );

    ZipFile zipFile = new ZipFile( file.toFile() );
    List<String> entries = getZipEntriesNames( zipFile );
    ZipEntry zipEntry = zipFile.getEntry( "org/apache/archiva/model/ArchivaArtifact.class" );
    assertNotNull( "cannot find zipEntry org/apache/archiva/model/ArchivaArtifact.class, entries: " + entries + ", content is: "
                       + FileUtils.readFileToString( file.toFile() ), zipEntry );
    zipFile.close();
    file.toFile().deleteOnExit();



}
 
开发者ID:apache,项目名称:archiva,代码行数:62,代码来源:DownloadSnapshotTest.java


注:本文中的org.apache.maven.wagon.providers.http.HttpWagon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。