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.AuthCacheprivate BasicAuthScopeBasic auth scope overridesprivate Closeableprivate static final longTime to live in seconds for an HTTP connection.private org.apache.http.client.CredentialsProviderprivate static final TimeZoneprivate static org.apache.http.impl.client.CloseableHttpClientprivate static org.apache.http.conn.HttpClientConnectionManagerInternal connection managerprivate HttpConfigurationprivate PropertiesDeprecated.Use httpConfiguration instead.private static final booleanif using sslInsecure, certificate date issues will be ignored disabled by defaultprivate intInitial seconds to back off when a HTTP 429 received.private static final intThe maximum amount of time we want to back off in the case of repeated HTTP 429 response codes.private static final intMaximum concurrent connections per distinct route.private static final intMaximum concurrent connections in total.private static booleanuse http(s) connection pool mechanism.private BasicAuthScopeProxy basic auth scope overridesprivate static final StringThe type of the retry handler, defaults tostandard.private static final intNumber of retries for the retry handler, defaults to 3.private static final StringComma-separated list of non-retryable exception classes.private static final booleanWhether or not methods that have successfully sent their request will be retried, defaults tofalse.protected static final intSee RFC6585private static final StringThe type of the serviceUnavailableRetryStrategy, defaults tonone.private static final intMaximum number of retries when using a serviceUnavailableRetryStrategy.private static final intInterval in milliseconds between retries when using a serviceUnavailableRetryStrategy.private static final booleanIf enabled, ssl hostname verifier does not check hostname.private static final booleanskip 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, transferEventSupportFields inherited from interface org.apache.maven.wagon.Wagon
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intprivate StringBuilds a complete URL string from the repository URL and the relative path of the resource passed.private StringBuilds a complete URL string from the repository URL and the relative path of the resource passed.protected voidcleanupGetTransfer(Resource resource) voidprivate static org.apache.http.config.Registry<org.apache.http.auth.AuthSchemeProvider>private static org.apache.http.impl.client.CloseableHttpClientprivate static org.apache.http.impl.conn.PoolingHttpClientConnectionManagerprivate static org.apache.http.client.HttpRequestRetryHandlerprivate static org.apache.http.client.ServiceUnavailableRetryStrategyprotected org.apache.http.client.methods.CloseableHttpResponseexecute(org.apache.http.client.methods.HttpUriRequest httpMethod) private voidfillInputData(int wait, InputData inputData) voidfillInputData(InputData inputData) voidfillOutputData(OutputData outputData) protected org.apache.http.client.AuthCacheGet the override values for standard HttpClient AuthScopeprotected org.apache.http.client.CredentialsProviderstatic org.apache.http.impl.client.CloseableHttpClientintstatic intprivate static Collection<Class<? extends IOException>>Get the override values for proxy HttpClient AuthScopeprotected StringgetURL(Repository repository) getUrl Implementors can override this to remove unwanted parts of the url such as role-hintsprotected StringgetUserAgent(org.apache.http.client.methods.HttpUriRequest method) protected voidvoidprivate voidvoidCopy a file from local system to remoteprivate voidput(InputStream stream, Resource resource, File source) private voidprivate voidvoidputFromStream(InputStream stream, String destination) voidputFromStream(InputStream stream, String destination, long contentLength, long lastModified) Copy from a local input stream to remote.protected voidputFromStream(InputStream stream, Resource resource) private booleanresourceExists(int wait, String resourceName) booleanresourceExists(String resourceName) Check if a remote resource existsvoidsetBasicAuthScope(BasicAuthScope basicAuth) Set the override values for standard HttpClient AuthScopevoidsetHeaders(org.apache.http.client.methods.HttpUriRequest method) voidsetHttpConfiguration(HttpConfiguration httpConfiguration) voidsetHttpHeaders(Properties httpHeaders) voidsetInitialBackoffSeconds(int initialBackoffSeconds) static voidsetPersistentPool(boolean persistent) static voidsetPoolingHttpClientConnectionManager(org.apache.http.impl.conn.PoolingHttpClientConnectionManager poolingHttpClientConnectionManager) voidsetProxyBasicAuthScope(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, getToStreamMethods 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, transferMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 be {@link default DefaultHttpRequestRetryHandler}, orStandardHttpRequestRetryHandler, or a fully qualified name class with a no-arg.- 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 be {@link default DefaultServiceUnavailableRetryStrategy}, orStandardServiceUnavailableRetryStrategy, or a fully qualified name class with a no-arg or none to not use a ServiceUnavailableRetryStrategy. -
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:
openConnectionInternalin classAbstractWagon
-
closeConnection
public void closeConnection()- Specified by:
closeConnectionin 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:WagonCopy a file from local system to remote- Specified by:
putin interfaceWagon- Overrides:
putin classStreamWagon- Parameters:
source- the local fileresourceName- the remote destination- Throws:
TransferFailedExceptionResourceDoesNotExistExceptionAuthorizationException
-
putFromStream
public void putFromStream(InputStream stream, String destination, long contentLength, long lastModified) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException Description copied from interface:StreamingWagonCopy from a local input stream to remote.- Specified by:
putFromStreamin interfaceStreamingWagon- Overrides:
putFromStreamin classStreamWagon- Parameters:
stream- the local streamdestination- the remote destination- Throws:
TransferFailedExceptionResourceDoesNotExistExceptionAuthorizationException
-
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.HttpExceptionIOException
-
resourceExists
public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException Description copied from interface:WagonCheck if a remote resource exists- Specified by:
resourceExistsin interfaceWagon- Overrides:
resourceExistsin classAbstractWagon- 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.HttpExceptionIOException
-
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:
fillInputDatain classStreamWagon- Throws:
TransferFailedExceptionResourceDoesNotExistExceptionAuthorizationException
-
fillInputData
private void fillInputData(int wait, InputData inputData) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException -
cleanupGetTransfer
- Overrides:
cleanupGetTransferin classAbstractWagon
-
putFromStream
public void putFromStream(InputStream stream, String destination) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException - Specified by:
putFromStreamin interfaceStreamingWagon- Overrides:
putFromStreamin classStreamWagon- Parameters:
stream- the local streamdestination- the remote destination- Throws:
TransferFailedExceptionResourceDoesNotExistExceptionAuthorizationException
-
putFromStream
protected void putFromStream(InputStream stream, Resource resource) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException - Overrides:
putFromStreamin classStreamWagon- Throws:
TransferFailedExceptionAuthorizationExceptionResourceDoesNotExistException
-
getHttpHeaders
-
setHttpHeaders
-
fillOutputData
- Specified by:
fillOutputDatain 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()
-