org.eclipse.jgit.transport

## Class TransportHttp

- java.lang.Object
- - org.eclipse.jgit.transport.Transport
  - - org.eclipse.jgit.transport.HttpTransport
    - - org.eclipse.jgit.transport.TransportHttp

All Implemented Interfaces:
  PackTransport, WalkTransport

    public class TransportHttp
    extends HttpTransport
    implements WalkTransport, PackTransport

Transport over HTTP and FTP protocols.

If the transport is using HTTP and the remote HTTP service is Git-aware (speaks the "smart-http protocol") this client will automatically take advantage of the additional Git-specific HTTP extensions. If the remote service does not support these extensions, the client will degrade to direct file fetching.

If the remote (server side) repository does not have the specialized Git support, object files are retrieved directly through standard HTTP GET (or binary FTP GET) requests. This make it easy to serve a Git repository through a standard web host provider that does not offer specific support for Git.

See Also:
  `WalkFetchConnection`

### Nested Class Summary

### Nested classes/interfaces inherited from class org.eclipse.jgit.transport.Transport

`Transport.Operation`

### Field Summary

### Fields inherited from class org.eclipse.jgit.transport.HttpTransport

`connectionFactory`

### Fields inherited from class org.eclipse.jgit.transport.Transport

`DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri`

### Method Summary

Methods
`void` `close()` Close any resources used by this transport.
`protected HttpConnection` `httpOpen(String method, URL u)` Open an HTTP connection.
`FetchConnection` `openFetch()` Begins a new connection for fetching from the remote repository.
`PushConnection` `openPush()` Begins a new connection for pushing into the remote repository.
`void` `setUseSmartHttp(boolean on)` Toggle whether or not smart HTTP transport should be used.

### Methods inherited from class org.eclipse.jgit.transport.HttpTransport

`getConnectionFactory, setConnectionFactory`

### Methods inherited from class org.eclipse.jgit.transport.Transport

`applyConfig, fetch, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, getCredentialsProvider, getOptionReceivePack, getOptionUploadPack, getPackConfig, getTagOpt, getTimeout, getTransportProtocols, getURI, isCheckFetchedObjects, isDryRun, isFetchThin, isPushThin, isRemoveDeletedRefs, open, open, open, open, open, open, open, openAll, openAll, openAll, openAll, push, push, register, setCheckFetchedObjects, setCredentialsProvider, setDryRun, setFetchThin, setOptionReceivePack, setOptionUploadPack, setPackConfig, setPushThin, setRemoveDeletedRefs, setTagOpt, setTimeout, unregister`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### setUseSmartHttp

    public void setUseSmartHttp(boolean on)

Toggle whether or not smart HTTP transport should be used.

This flag exists primarily to support backwards compatibility testing within a testing framework, there is no need to modify it in most applications.

Parameters:
  `on` - if `true` (default), smart HTTP is enabled.

#### openFetch

    public FetchConnection openFetch()
                              throws TransportException,
                                     NotSupportedException

Description copied from class: `Transport`
Begins a new connection for fetching from the remote repository.

If the transport has no local repository, the fetch connection can only be used for reading remote refs.

Specified by:
  `openFetch` in class `Transport`
Returns:
  a fresh connection to fetch from the remote repository.
Throws:
  `TransportException` - the remote connection could not be established.
  `NotSupportedException` - the implementation does not support fetching.

#### openPush

    public PushConnection openPush()
                            throws NotSupportedException,
                                   TransportException

Description copied from class: `Transport`
Begins a new connection for pushing into the remote repository.

Specified by:
  `openPush` in class `Transport`
Returns:
  a fresh connection to push into the remote repository.
Throws:
  `NotSupportedException` - the implementation does not support pushing.
  `TransportException` - the remote connection could not be established

#### close

    public void close()

Description copied from class: `Transport`
Close any resources used by this transport.

If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

Specified by:
  `close` in class `Transport`

#### httpOpen

    protected HttpConnection httpOpen(String method,
                          URL u)
                               throws IOException

Open an HTTP connection.

Parameters:
  `method` -
  `u` -
Returns:
  the connection
Throws:
  `IOException`
Since:
  3.3