1 /* 2 * Copyright (C) 2009, Constantine Plotnikov <constantine.plotnikov@gmail.com> 3 * Copyright (C) 2009, JetBrains s.r.o. 4 * Copyright (C) 2009, Shawn O. Pearce <spearce@spearce.org> and others 5 * 6 * This program and the accompanying materials are made available under the 7 * terms of the Eclipse Distribution License v. 1.0 which is available at 8 * https://www.eclipse.org/org/documents/edl-v10.php. 9 * 10 * SPDX-License-Identifier: BSD-3-Clause 11 */ 12 13 package org.eclipse.jgit.transport; 14 15 import org.eclipse.jgit.lib.Repository; 16 import org.eclipse.jgit.transport.http.HttpConnectionFactory; 17 import org.eclipse.jgit.transport.http.JDKHttpConnectionFactory; 18 19 /** 20 * The base class for transports that use HTTP as underlying protocol. This class 21 * allows customizing HTTP connection settings. 22 */ 23 public abstract class HttpTransport extends Transport { 24 /** 25 * factory for creating HTTP connections 26 * 27 * @since 3.3 28 */ 29 protected static HttpConnectionFactory connectionFactory = new JDKHttpConnectionFactory(); 30 31 /** 32 * Get the {@link org.eclipse.jgit.transport.http.HttpConnectionFactory} 33 * used to create new connections 34 * 35 * @return the {@link org.eclipse.jgit.transport.http.HttpConnectionFactory} 36 * used to create new connections 37 * @since 3.3 38 */ 39 public static HttpConnectionFactory getConnectionFactory() { 40 return connectionFactory; 41 } 42 43 /** 44 * Set the {@link org.eclipse.jgit.transport.http.HttpConnectionFactory} to 45 * be used to create new connections 46 * 47 * @param cf 48 * connection factory 49 * @since 3.3 50 */ 51 public static void setConnectionFactory(HttpConnectionFactory cf) { 52 connectionFactory = cf; 53 } 54 55 /** 56 * Create a new transport instance. 57 * 58 * @param local 59 * the repository this instance will fetch into, or push out of. 60 * This must be the repository passed to 61 * {@link #open(Repository, URIish)}. 62 * @param uri 63 * the URI used to access the remote repository. This must be the 64 * URI passed to {@link #open(Repository, URIish)}. 65 */ 66 protected HttpTransport(Repository local, URIish uri) { 67 super(local, uri); 68 } 69 70 /** 71 * Create a minimal HTTP transport instance not tied to a single repository. 72 * 73 * @param uri a {@link org.eclipse.jgit.transport.URIish} object. 74 */ 75 protected HttpTransport(URIish uri) { 76 super(uri); 77 } 78 }