类org.eclipse.jgit.transport.HttpTransport源码实例Demo

下面列出了怎么用org.eclipse.jgit.transport.HttpTransport的API类实例代码及写法,或者点击链接到github查看源代码。

@Override
public MultipleJGitEnvironmentRepository build(
		MultipleJGitEnvironmentProperties environmentProperties) throws Exception {
	if (this.connectionFactory.isPresent()) {
		HttpTransport.setConnectionFactory(this.connectionFactory.get());
		this.connectionFactory.get().addConfiguration(environmentProperties);
	}

	MultipleJGitEnvironmentRepository repository = new MultipleJGitEnvironmentRepository(
			this.environment, environmentProperties);
	repository.setTransportConfigCallback(
			transportConfigCallbackFactory.build(environmentProperties));
	if (this.server.getDefaultLabel() != null) {
		repository.setDefaultLabel(this.server.getDefaultLabel());
	}
	return repository;
}
 
源代码2 项目: git-client-plugin   文件: JGitAPIImpl.java
JGitAPIImpl(File workspace, TaskListener listener, final PreemptiveAuthHttpClientConnectionFactory httpConnectionFactory) {
    /* If workspace is null, then default to current directory to match 
     * CliGitAPIImpl behavior */
    super(workspace == null ? new File(".") : workspace);
    this.listener = listener;

    // to avoid rogue plugins from clobbering what we use, always
    // make a point of overwriting it with ours.
    SshSessionFactory.setInstance(new TrileadSessionFactory());

    if (httpConnectionFactory != null) {
        httpConnectionFactory.setCredentialsProvider(asSmartCredentialsProvider());
        // allow override of HttpConnectionFactory to avoid JENKINS-37934
        HttpTransport.setConnectionFactory(httpConnectionFactory);
    }
}
 
private HttpClient getHttpClientForUrl(String repoUrl) throws IOException {
	HttpConnectionFactory connectionFactory = HttpTransport.getConnectionFactory();
	URL url = new URL(repoUrl);
	HttpConnection httpConnection = connectionFactory.create(url);
	assertThat(httpConnection).isInstanceOf(HttpClientConnection.class);
	return (HttpClient) ReflectionTestUtils.getField(httpConnection, "client");
}