Class AbstractHttpClientWagon
java.lang.Object
org.apache.maven.wagon.AbstractWagon
org.apache.maven.wagon.StreamWagon
org.apache.maven.wagon.shared.http.AbstractHttpClientWagon
- All Implemented Interfaces:
StreamingWagon
,Wagon
- Direct Known Subclasses:
HttpWagon
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.http.client.AuthCache
private BasicAuthScope
Basic auth scope overridesprivate Closeable
private static final long
Time to live in seconds for an HTTP connection.private org.apache.http.client.CredentialsProvider
private static final TimeZone
private static org.apache.http.impl.client.CloseableHttpClient
private static org.apache.http.conn.HttpClientConnectionManager
Internal connection managerprivate HttpConfiguration
private Properties
Deprecated.Use httpConfiguration instead.private static final boolean
if using sslInsecure, certificate date issues will be ignored disabled by defaultprivate int
Initial seconds to back off when a HTTP 429 received.private static final int
The maximum amount of time we want to back off in the case of repeated HTTP 429 response codes.private static final int
Maximum concurrent connections per distinct route.private static final int
Maximum concurrent connections in total.private static boolean
use http(s) connection pool mechanism.private BasicAuthScope
Proxy basic auth scope overridesprivate static final String
The type of the retry handler, defaults tostandard
.private static final int
Number of retries for the retry handler, defaults to 3.private static final String
Comma-separated list of non-retryable exception classes.private static final boolean
Whether or not methods that have successfully sent their request will be retried, defaults tofalse
.protected static final int
See RFC6585private static final String
The type of the serviceUnavailableRetryStrategy, defaults tonone
.private static final int
Maximum number of retries when using a serviceUnavailableRetryStrategy.private static final int
Interval in milliseconds between retries when using a serviceUnavailableRetryStrategy.private static final boolean
If enabled, ssl hostname verifier does not check hostname.private static final boolean
skip failure on certificate validity checks.Fields inherited from class org.apache.maven.wagon.AbstractWagon
authenticationInfo, BUFFER_SEGMENT_SIZE, DEFAULT_BUFFER_SIZE, interactive, MAXIMUM_BUFFER_SIZE, MINIMUM_AMOUNT_OF_TRANSFER_CHUNKS, proxyInfo, repository, sessionEventSupport, transferEventSupport
Fields inherited from interface org.apache.maven.wagon.Wagon
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
private String
Builds a complete URL string from the repository URL and the relative path of the resource passed.private String
Builds a complete URL string from the repository URL and the relative path of the resource passed.protected void
cleanupGetTransfer
(Resource resource) void
private static org.apache.http.config.Registry
<org.apache.http.auth.AuthSchemeProvider> private static org.apache.http.impl.client.CloseableHttpClient
private static org.apache.http.impl.conn.PoolingHttpClientConnectionManager
private static org.apache.http.client.HttpRequestRetryHandler
private static org.apache.http.client.ServiceUnavailableRetryStrategy
protected org.apache.http.client.methods.CloseableHttpResponse
execute
(org.apache.http.client.methods.HttpUriRequest httpMethod) private void
fillInputData
(int wait, InputData inputData) void
fillInputData
(InputData inputData) void
fillOutputData
(OutputData outputData) protected org.apache.http.client.AuthCache
Get the override values for standard HttpClient AuthScopeprotected org.apache.http.client.CredentialsProvider
static org.apache.http.impl.client.CloseableHttpClient
int
static int
private static Collection
<Class<? extends IOException>> Get the override values for proxy HttpClient AuthScopeprotected String
getURL
(Repository repository) getUrl Implementors can override this to remove unwanted parts of the url such as role-hintsprotected String
getUserAgent
(org.apache.http.client.methods.HttpUriRequest method) protected void
void
private void
void
Copy a file from local system to remoteprivate void
put
(InputStream stream, Resource resource, File source) private void
private void
void
putFromStream
(InputStream stream, String destination) void
putFromStream
(InputStream stream, String destination, long contentLength, long lastModified) Copy from a local input stream to remote.protected void
putFromStream
(InputStream stream, Resource resource) private boolean
resourceExists
(int wait, String resourceName) boolean
resourceExists
(String resourceName) Check if a remote resource existsvoid
setBasicAuthScope
(BasicAuthScope basicAuth) Set the override values for standard HttpClient AuthScopevoid
setHeaders
(org.apache.http.client.methods.HttpUriRequest method) void
setHttpConfiguration
(HttpConfiguration httpConfiguration) void
setHttpHeaders
(Properties httpHeaders) void
setInitialBackoffSeconds
(int initialBackoffSeconds) static void
setPersistentPool
(boolean persistent) static void
setPoolingHttpClientConnectionManager
(org.apache.http.impl.conn.PoolingHttpClientConnectionManager poolingHttpClientConnectionManager) void
setProxyBasicAuthScope
(BasicAuthScope proxyAuth) Set the override values for proxy HttpClient AuthScopeMethods inherited from class org.apache.maven.wagon.StreamWagon
checkInputStream, checkOutputStream, get, getIfNewer, getIfNewerToStream, getInputStream, getOutputStream, getToStream
Methods inherited from class org.apache.maven.wagon.AbstractWagon
addSessionListener, addTransferListener, cleanupPutTransfer, connect, connect, connect, connect, connect, connect, createParentDirectories, disconnect, finishGetTransfer, finishPutTransfer, fireGetCompleted, fireGetInitiated, fireGetStarted, firePutCompleted, firePutInitiated, firePutStarted, fireSessionConnectionRefused, fireSessionDebug, fireSessionDisconnected, fireSessionDisconnecting, fireSessionError, fireSessionLoggedIn, fireSessionLoggedOff, fireSessionOpened, fireSessionOpening, fireTransferDebug, fireTransferError, fireTransferProgress, getAuthenticationInfo, getBufferCapacityForTransfer, getFileList, getPath, getPermissionsOverride, getProxyInfo, getProxyInfo, getReadTimeout, getRepository, getSessionEventSupport, getTimeout, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, openConnection, postProcessListeners, putDirectory, putTransfer, putTransfer, removeSessionListener, removeTransferListener, setInteractive, setPermissionsOverride, setReadTimeout, setSessionEventSupport, setTimeout, setTransferEventSupport, supportsDirectoryCopy, transfer, transfer, transfer, transfer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.maven.wagon.Wagon
addSessionListener, addTransferListener, connect, connect, connect, connect, connect, connect, disconnect, getFileList, getReadTimeout, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, putDirectory, removeSessionListener, removeTransferListener, setInteractive, setReadTimeout, setTimeout, supportsDirectoryCopy
-
Field Details
-
GMT_TIME_ZONE
-
persistentPool
private static boolean persistentPooluse http(s) connection pool mechanism. enabled by default -
SSL_INSECURE
private static final boolean SSL_INSECUREskip failure on certificate validity checks. disabled by default -
IGNORE_SSL_VALIDITY_DATES
private static final boolean IGNORE_SSL_VALIDITY_DATESif using sslInsecure, certificate date issues will be ignored disabled by default -
SSL_ALLOW_ALL
private static final boolean SSL_ALLOW_ALLIf enabled, ssl hostname verifier does not check hostname. Disable this will use a browser compat hostname verifier disabled by default -
MAX_CONN_PER_ROUTE
private static final int MAX_CONN_PER_ROUTEMaximum concurrent connections per distinct route. 20 by default -
MAX_CONN_TOTAL
private static final int MAX_CONN_TOTALMaximum concurrent connections in total. 40 by default -
CONN_TTL
private static final long CONN_TTLTime to live in seconds for an HTTP connection. After that time, the connection will be dropped. Intermediates tend to drop connections after some idle period. Set to -1 to maintain connections indefinitely. This value defaults to 300 seconds.- Since:
- 3.2
-
httpClientConnectionManager
private static org.apache.http.conn.HttpClientConnectionManager httpClientConnectionManagerInternal connection manager -
SC_TOO_MANY_REQUESTS
protected static final int SC_TOO_MANY_REQUESTSSee RFC6585- See Also:
-
initialBackoffSeconds
private int initialBackoffSecondsInitial seconds to back off when a HTTP 429 received. Subsequent 429 responses result in exponental backoff. 5 by default- Since:
- 2.7
-
MAX_BACKOFF_WAIT_SECONDS
private static final int MAX_BACKOFF_WAIT_SECONDSThe maximum amount of time we want to back off in the case of repeated HTTP 429 response codes.- Since:
- 2.7
-
RETRY_HANDLER_CLASS
The type of the retry handler, defaults tostandard
. Values can beinvalid @link
{@link default
invalid reference
StandardHttpRequestRetryHandler
- Since:
- 3.2
-
RETRY_HANDLER_REQUEST_SENT_ENABLED
private static final boolean RETRY_HANDLER_REQUEST_SENT_ENABLEDWhether or not methods that have successfully sent their request will be retried, defaults tofalse
. Note: only used for default and standard retry handlers.- Since:
- 3.2
-
RETRY_HANDLER_COUNT
private static final int RETRY_HANDLER_COUNTNumber of retries for the retry handler, defaults to 3. Note: only used for default and standard retry handlers.- Since:
- 3.2
-
RETRY_HANDLER_EXCEPTIONS
Comma-separated list of non-retryable exception classes. Note: only used for default retry handler.- Since:
- 3.2
-
SERVICE_UNAVAILABLE_RETRY_STRATEGY_CLASS
The type of the serviceUnavailableRetryStrategy, defaults tonone
. Values can beinvalid @link
{@link default
invalid reference
StandardServiceUnavailableRetryStrategy
-
SERVICE_UNAVAILABLE_RETRY_STRATEGY_RETRY_INTERVAL
private static final int SERVICE_UNAVAILABLE_RETRY_STRATEGY_RETRY_INTERVALInterval in milliseconds between retries when using a serviceUnavailableRetryStrategy. 1000 by default -
SERVICE_UNAVAILABLE_RETRY_STRATEGY_MAX_RETRIES
private static final int SERVICE_UNAVAILABLE_RETRY_STRATEGY_MAX_RETRIESMaximum number of retries when using a serviceUnavailableRetryStrategy. 5 by default -
httpClient
private static org.apache.http.impl.client.CloseableHttpClient httpClient -
credentialsProvider
private org.apache.http.client.CredentialsProvider credentialsProvider -
authCache
private org.apache.http.client.AuthCache authCache -
closeable
-
httpHeaders
Deprecated.Use httpConfiguration instead. -
httpConfiguration
- Since:
- 1.0-beta-6
-
basicAuth
Basic auth scope overrides- Since:
- 2.8
-
proxyAuth
Proxy basic auth scope overrides- Since:
- 2.8
-
-
Constructor Details
-
AbstractHttpClientWagon
public AbstractHttpClientWagon()
-
-
Method Details
-
backoff
-
createConnManager
private static org.apache.http.impl.conn.PoolingHttpClientConnectionManager createConnManager() -
createRetryHandler
private static org.apache.http.client.HttpRequestRetryHandler createRetryHandler() -
createAuthSchemeRegistry
private static org.apache.http.config.Registry<org.apache.http.auth.AuthSchemeProvider> createAuthSchemeRegistry() -
getNonRetryableExceptions
-
createClient
private static org.apache.http.impl.client.CloseableHttpClient createClient() -
openConnectionInternal
public void openConnectionInternal()- Specified by:
openConnectionInternal
in classAbstractWagon
-
closeConnection
public void closeConnection()- Specified by:
closeConnection
in classStreamWagon
-
getHttpClient
public static org.apache.http.impl.client.CloseableHttpClient getHttpClient() -
setPersistentPool
public static void setPersistentPool(boolean persistent) -
setPoolingHttpClientConnectionManager
public static void setPoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager poolingHttpClientConnectionManager) -
put
public void put(File source, String resourceName) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException Description copied from interface:Wagon
Copy a file from local system to remote- Specified by:
put
in interfaceWagon
- Overrides:
put
in classStreamWagon
- Parameters:
source
- the local fileresourceName
- the remote destination- Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException
-
putFromStream
public void putFromStream(InputStream stream, String destination, long contentLength, long lastModified) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException Description copied from interface:StreamingWagon
Copy from a local input stream to remote.- Specified by:
putFromStream
in interfaceStreamingWagon
- Overrides:
putFromStream
in classStreamWagon
- Parameters:
stream
- the local streamdestination
- the remote destination- Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException
-
put
private void put(InputStream stream, Resource resource, File source) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException -
put
private void put(Resource resource, File source, org.apache.http.HttpEntity httpEntity) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException -
buildUrl
Builds a complete URL string from the repository URL and the relative path of the resource passed.- Parameters:
resource
- the resource to extract the relative path from.- Returns:
- the complete URL
-
buildUrl
Builds a complete URL string from the repository URL and the relative path of the resource passed.- Parameters:
resourceName
- the resourcerelative path- Returns:
- the complete URL
-
put
private void put(Resource resource, File source, org.apache.http.HttpEntity httpEntity, String url) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException -
put
private void put(int wait, Resource resource, File source, org.apache.http.HttpEntity httpEntity, String url) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException -
mkdirs
- Throws:
org.apache.http.HttpException
IOException
-
resourceExists
public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException Description copied from interface:Wagon
Check if a remote resource exists- Specified by:
resourceExists
in interfaceWagon
- Overrides:
resourceExists
in classAbstractWagon
- Parameters:
resourceName
-- Returns:
- whether the resource exists or not
- Throws:
TransferFailedException
- if there's an error trying to access the remote sideAuthorizationException
- if not authorized to verify the existence of the resource
-
resourceExists
private boolean resourceExists(int wait, String resourceName) throws TransferFailedException, AuthorizationException -
execute
protected org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpUriRequest httpMethod) throws org.apache.http.HttpException, IOException - Throws:
org.apache.http.HttpException
IOException
-
setHeaders
public void setHeaders(org.apache.http.client.methods.HttpUriRequest method) -
getUserAgent
-
getURL
getUrl Implementors can override this to remove unwanted parts of the url such as role-hints- Parameters:
repository
-- Returns:
-
getHttpConfiguration
-
getBasicAuthScope
Get the override values for standard HttpClient AuthScope- Returns:
- the basicAuth
-
getProxyBasicAuthScope
Get the override values for proxy HttpClient AuthScope- Returns:
- the proxyAuth
-
fillInputData
public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - Specified by:
fillInputData
in classStreamWagon
- Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException
-
fillInputData
private void fillInputData(int wait, InputData inputData) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException -
cleanupGetTransfer
- Overrides:
cleanupGetTransfer
in classAbstractWagon
-
putFromStream
public void putFromStream(InputStream stream, String destination) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - Specified by:
putFromStream
in interfaceStreamingWagon
- Overrides:
putFromStream
in classStreamWagon
- Parameters:
stream
- the local streamdestination
- the remote destination- Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException
-
putFromStream
protected void putFromStream(InputStream stream, Resource resource) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException - Overrides:
putFromStream
in classStreamWagon
- Throws:
TransferFailedException
AuthorizationException
ResourceDoesNotExistException
-
getHttpHeaders
-
setHttpHeaders
-
fillOutputData
- Specified by:
fillOutputData
in classStreamWagon
- Throws:
TransferFailedException
-
getCredentialsProvider
protected org.apache.http.client.CredentialsProvider getCredentialsProvider() -
getAuthCache
protected org.apache.http.client.AuthCache getAuthCache() -
getInitialBackoffSeconds
public int getInitialBackoffSeconds() -
setInitialBackoffSeconds
public void setInitialBackoffSeconds(int initialBackoffSeconds) -
getMaxBackoffWaitSeconds
public static int getMaxBackoffWaitSeconds()
-