Class AbstractHttpClientWagon

  • All Implemented Interfaces:
    org.apache.maven.wagon.StreamingWagon, org.apache.maven.wagon.Wagon

    public abstract class AbstractHttpClientWagon
    extends org.apache.maven.wagon.StreamWagon
    Author:
    Michal Maczka, James William Dumay
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int SC_TOO_MANY_REQUESTS
      See RFC6585
      • Fields inherited from class org.apache.maven.wagon.AbstractWagon

        authenticationInfo, DEFAULT_BUFFER_SIZE, interactive, proxyInfo, repository, sessionEventSupport, transferEventSupport
      • Fields inherited from interface org.apache.maven.wagon.Wagon

        DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int backoff​(int wait, java.lang.String url)  
      protected java.lang.String calculateRelocatedUrl​(org.apache.http.HttpResponse response)  
      protected void cleanupGetTransfer​(org.apache.maven.wagon.resource.Resource resource)  
      void closeConnection()  
      protected org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpUriRequest httpMethod)  
      void fillInputData​(org.apache.maven.wagon.InputData inputData)  
      void fillOutputData​(org.apache.maven.wagon.OutputData outputData)  
      protected org.apache.http.client.AuthCache getAuthCache()  
      BasicAuthScope getBasicAuthScope()
      Get the override values for standard HttpClient AuthScope
      protected org.apache.http.client.CredentialsProvider getCredentialsProvider()  
      static org.apache.http.impl.client.CloseableHttpClient getHttpClient()  
      HttpConfiguration getHttpConfiguration()  
      java.util.Properties getHttpHeaders()  
      int getInitialBackoffSeconds()  
      static int getMaxBackoffWaitSeconds()  
      BasicAuthScope getProxyBasicAuthScope()
      Get the override values for proxy HttpClient AuthScope
      protected java.lang.String getURL​(org.apache.maven.wagon.repository.Repository repository)
      getUrl Implementors can override this to remove unwanted parts of the url such as role-hints
      protected java.lang.String getUserAgent​(org.apache.http.client.methods.HttpUriRequest method)  
      protected void mkdirs​(java.lang.String dirname)  
      void openConnectionInternal()  
      void put​(java.io.File source, java.lang.String resourceName)  
      void putFromStream​(java.io.InputStream stream, java.lang.String destination)  
      void putFromStream​(java.io.InputStream stream, java.lang.String destination, long contentLength, long lastModified)  
      protected void putFromStream​(java.io.InputStream stream, org.apache.maven.wagon.resource.Resource resource)  
      boolean resourceExists​(java.lang.String resourceName)  
      void setBasicAuthScope​(BasicAuthScope basicAuth)
      Set the override values for standard HttpClient AuthScope
      void setHeaders​(org.apache.http.client.methods.HttpUriRequest method)  
      void setHttpConfiguration​(HttpConfiguration httpConfiguration)  
      void setHttpHeaders​(java.util.Properties httpHeaders)  
      void setInitialBackoffSeconds​(int initialBackoffSeconds)  
      static void setPersistentPool​(boolean persistentPool)  
      static void setPoolingHttpClientConnectionManager​(org.apache.http.impl.conn.PoolingHttpClientConnectionManager poolingHttpClientConnectionManager)  
      void setProxyBasicAuthScope​(BasicAuthScope proxyAuth)
      Set the override values for proxy HttpClient AuthScope
      • Methods 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, 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 Detail

      • SC_TOO_MANY_REQUESTS

        protected static final int SC_TOO_MANY_REQUESTS
        See RFC6585
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractHttpClientWagon

        public AbstractHttpClientWagon()
    • Method Detail

      • backoff

        protected int backoff​(int wait,
                              java.lang.String url)
                       throws java.lang.InterruptedException,
                              org.apache.maven.wagon.TransferFailedException
        Throws:
        java.lang.InterruptedException
        org.apache.maven.wagon.TransferFailedException
      • openConnectionInternal

        public void openConnectionInternal()
        Specified by:
        openConnectionInternal in class org.apache.maven.wagon.AbstractWagon
      • closeConnection

        public void closeConnection()
        Specified by:
        closeConnection in class org.apache.maven.wagon.StreamWagon
      • getHttpClient

        public static org.apache.http.impl.client.CloseableHttpClient getHttpClient()
      • setPersistentPool

        public static void setPersistentPool​(boolean persistentPool)
      • setPoolingHttpClientConnectionManager

        public static void setPoolingHttpClientConnectionManager​(org.apache.http.impl.conn.PoolingHttpClientConnectionManager poolingHttpClientConnectionManager)
      • put

        public void put​(java.io.File source,
                        java.lang.String resourceName)
                 throws org.apache.maven.wagon.TransferFailedException,
                        org.apache.maven.wagon.ResourceDoesNotExistException,
                        org.apache.maven.wagon.authorization.AuthorizationException
        Specified by:
        put in interface org.apache.maven.wagon.Wagon
        Overrides:
        put in class org.apache.maven.wagon.StreamWagon
        Throws:
        org.apache.maven.wagon.TransferFailedException
        org.apache.maven.wagon.ResourceDoesNotExistException
        org.apache.maven.wagon.authorization.AuthorizationException
      • putFromStream

        public void putFromStream​(java.io.InputStream stream,
                                  java.lang.String destination,
                                  long contentLength,
                                  long lastModified)
                           throws org.apache.maven.wagon.TransferFailedException,
                                  org.apache.maven.wagon.ResourceDoesNotExistException,
                                  org.apache.maven.wagon.authorization.AuthorizationException
        Specified by:
        putFromStream in interface org.apache.maven.wagon.StreamingWagon
        Overrides:
        putFromStream in class org.apache.maven.wagon.StreamWagon
        Throws:
        org.apache.maven.wagon.TransferFailedException
        org.apache.maven.wagon.ResourceDoesNotExistException
        org.apache.maven.wagon.authorization.AuthorizationException
      • calculateRelocatedUrl

        protected java.lang.String calculateRelocatedUrl​(org.apache.http.HttpResponse response)
      • mkdirs

        protected void mkdirs​(java.lang.String dirname)
                       throws org.apache.http.HttpException,
                              java.io.IOException
        Throws:
        org.apache.http.HttpException
        java.io.IOException
      • resourceExists

        public boolean resourceExists​(java.lang.String resourceName)
                               throws org.apache.maven.wagon.TransferFailedException,
                                      org.apache.maven.wagon.authorization.AuthorizationException
        Specified by:
        resourceExists in interface org.apache.maven.wagon.Wagon
        Overrides:
        resourceExists in class org.apache.maven.wagon.AbstractWagon
        Throws:
        org.apache.maven.wagon.TransferFailedException
        org.apache.maven.wagon.authorization.AuthorizationException
      • execute

        protected org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpUriRequest httpMethod)
                                                                        throws org.apache.http.HttpException,
                                                                               java.io.IOException
        Throws:
        org.apache.http.HttpException
        java.io.IOException
      • setHeaders

        public void setHeaders​(org.apache.http.client.methods.HttpUriRequest method)
      • getUserAgent

        protected java.lang.String getUserAgent​(org.apache.http.client.methods.HttpUriRequest method)
      • getURL

        protected java.lang.String getURL​(org.apache.maven.wagon.repository.Repository repository)
        getUrl Implementors can override this to remove unwanted parts of the url such as role-hints
        Parameters:
        repository -
        Returns:
      • setHttpConfiguration

        public void setHttpConfiguration​(HttpConfiguration httpConfiguration)
      • getBasicAuthScope

        public BasicAuthScope getBasicAuthScope()
        Get the override values for standard HttpClient AuthScope
        Returns:
        the basicAuth
      • setBasicAuthScope

        public void setBasicAuthScope​(BasicAuthScope basicAuth)
        Set the override values for standard HttpClient AuthScope
        Parameters:
        basicAuth - the AuthScope to set
      • getProxyBasicAuthScope

        public BasicAuthScope getProxyBasicAuthScope()
        Get the override values for proxy HttpClient AuthScope
        Returns:
        the proxyAuth
      • setProxyBasicAuthScope

        public void setProxyBasicAuthScope​(BasicAuthScope proxyAuth)
        Set the override values for proxy HttpClient AuthScope
        Parameters:
        proxyAuth - the AuthScope to set
      • fillInputData

        public void fillInputData​(org.apache.maven.wagon.InputData inputData)
                           throws org.apache.maven.wagon.TransferFailedException,
                                  org.apache.maven.wagon.ResourceDoesNotExistException,
                                  org.apache.maven.wagon.authorization.AuthorizationException
        Specified by:
        fillInputData in class org.apache.maven.wagon.StreamWagon
        Throws:
        org.apache.maven.wagon.TransferFailedException
        org.apache.maven.wagon.ResourceDoesNotExistException
        org.apache.maven.wagon.authorization.AuthorizationException
      • cleanupGetTransfer

        protected void cleanupGetTransfer​(org.apache.maven.wagon.resource.Resource resource)
        Overrides:
        cleanupGetTransfer in class org.apache.maven.wagon.AbstractWagon
      • putFromStream

        public void putFromStream​(java.io.InputStream stream,
                                  java.lang.String destination)
                           throws org.apache.maven.wagon.TransferFailedException,
                                  org.apache.maven.wagon.ResourceDoesNotExistException,
                                  org.apache.maven.wagon.authorization.AuthorizationException
        Specified by:
        putFromStream in interface org.apache.maven.wagon.StreamingWagon
        Overrides:
        putFromStream in class org.apache.maven.wagon.StreamWagon
        Throws:
        org.apache.maven.wagon.TransferFailedException
        org.apache.maven.wagon.ResourceDoesNotExistException
        org.apache.maven.wagon.authorization.AuthorizationException
      • putFromStream

        protected void putFromStream​(java.io.InputStream stream,
                                     org.apache.maven.wagon.resource.Resource resource)
                              throws org.apache.maven.wagon.TransferFailedException,
                                     org.apache.maven.wagon.authorization.AuthorizationException,
                                     org.apache.maven.wagon.ResourceDoesNotExistException
        Overrides:
        putFromStream in class org.apache.maven.wagon.StreamWagon
        Throws:
        org.apache.maven.wagon.TransferFailedException
        org.apache.maven.wagon.authorization.AuthorizationException
        org.apache.maven.wagon.ResourceDoesNotExistException
      • getHttpHeaders

        public java.util.Properties getHttpHeaders()
      • setHttpHeaders

        public void setHttpHeaders​(java.util.Properties httpHeaders)
      • fillOutputData

        public void fillOutputData​(org.apache.maven.wagon.OutputData outputData)
                            throws org.apache.maven.wagon.TransferFailedException
        Specified by:
        fillOutputData in class org.apache.maven.wagon.StreamWagon
        Throws:
        org.apache.maven.wagon.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()