Class DownloadFileWithHttpRequest


  • public class DownloadFileWithHttpRequest
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addHttpHeaders​(Driver driver, org.apache.http.client.methods.HttpGet httpGet)  
      protected void configureHttpGet​(org.apache.http.client.methods.HttpGet httpGet, long timeout)  
      protected org.apache.http.impl.client.CloseableHttpClient createDefaultHttpClient()  
      protected org.apache.http.protocol.HttpContext createHttpContext​(Driver driver)  
      protected org.apache.http.impl.client.CloseableHttpClient createTrustingHttpClient()
      configure HttpClient to ignore self-signed certs as described here: http://literatejava.com/networks/ignore-ssl-certificate-errors-apache-httpclient-4-4/
      java.io.File download​(Driver driver, java.lang.String relativeOrAbsoluteUrl, long timeout)  
      java.io.File download​(Driver driver, org.openqa.selenium.WebElement element, long timeout)  
      protected org.apache.http.HttpResponse executeHttpRequest​(Driver driver, java.lang.String fileToDownloadLocation, long timeout)  
      protected java.lang.String getFileName​(java.lang.String fileToDownloadLocation, org.apache.http.HttpResponse response)  
      protected java.io.File saveFileContent​(org.apache.http.HttpResponse response, java.io.File downloadedFile)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ignoreSelfSignedCerts

        protected boolean ignoreSelfSignedCerts
    • Constructor Detail

      • DownloadFileWithHttpRequest

        public DownloadFileWithHttpRequest()
    • Method Detail

      • download

        public java.io.File download​(Driver driver,
                                     org.openqa.selenium.WebElement element,
                                     long timeout)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • download

        public java.io.File download​(Driver driver,
                                     java.lang.String relativeOrAbsoluteUrl,
                                     long timeout)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • executeHttpRequest

        protected org.apache.http.HttpResponse executeHttpRequest​(Driver driver,
                                                                  java.lang.String fileToDownloadLocation,
                                                                  long timeout)
                                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • configureHttpGet

        protected void configureHttpGet​(org.apache.http.client.methods.HttpGet httpGet,
                                        long timeout)
      • createDefaultHttpClient

        protected org.apache.http.impl.client.CloseableHttpClient createDefaultHttpClient()
      • createTrustingHttpClient

        protected org.apache.http.impl.client.CloseableHttpClient createTrustingHttpClient()
                                                                                    throws java.io.IOException
        configure HttpClient to ignore self-signed certs as described here: http://literatejava.com/networks/ignore-ssl-certificate-errors-apache-httpclient-4-4/
        Throws:
        java.io.IOException
      • createHttpContext

        protected org.apache.http.protocol.HttpContext createHttpContext​(Driver driver)
      • addHttpHeaders

        protected void addHttpHeaders​(Driver driver,
                                      org.apache.http.client.methods.HttpGet httpGet)
      • getFileName

        protected java.lang.String getFileName​(java.lang.String fileToDownloadLocation,
                                               org.apache.http.HttpResponse response)
      • saveFileContent

        protected java.io.File saveFileContent​(org.apache.http.HttpResponse response,
                                               java.io.File downloadedFile)
                                        throws java.io.IOException
        Throws:
        java.io.IOException