org.eclipse.jgit.transport.HttpTransport Java Examples

The following examples show how to use org.eclipse.jgit.transport.HttpTransport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultipleJGitEnvironmentRepositoryFactory.java    From spring-cloud-config with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: JGitAPIImpl.java    From git-client-plugin with MIT License 6 votes vote down vote up
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);
    }
}
 
Example #3
Source File: ConfigurableHttpConnectionFactoryIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
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");
}