commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick GH (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (VFS-560) File can't be downloaded if HTTP HEAD on base url fails
Date Wed, 04 Feb 2015 11:43:35 GMT

    [ https://issues.apache.org/jira/browse/VFS-560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14304987#comment-14304987
] 

Patrick GH commented on VFS-560:
--------------------------------

I have reproduced the problem with the following code:
{code:java}public class TestPgh {

    public static void main(String[] args) throws FileSystemException{
        StandardFileSystemManager fileSystemManager = new StandardFileSystemManager();

        fileSystemManager.init();

        FileObject srcFile = fileSystemManager.resolveFile("https://server1.com/images/4/1/7/1/prev_14044171.jpg");
        FileObject dstFile = fileSystemManager.resolveFile("/Users/pgh/Desktop/image.jpg");

        dstFile.copyFrom(srcFile, new AllFileSelector());


        fileSystemManager.close();
    }

}{code}

The result was:
{noformat}
12:34:11.221 [main] INFO  o.a.c.v.i.StandardFileSystemManager - Using "/var/folders/7h/6fvqgj9x4bz6fbn0l_213qxr0000gn/T/vfs_cache"
as temporary files store.
12:34:11.311 [main] DEBUG o.a.c.v.i.StandardFileSystemManager - Skipping provider "org.apache.commons.vfs2.provider.webdav.WebdavFileProvider"
because required class "org.apache.jackrabbit.webdav.client.methods.DavMethod" is not available.
12:34:11.337 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.useragent
= Jakarta Commons-HttpClient/3.1
12:34:11.339 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.version
= HTTP/1.1
12:34:11.340 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.connection-manager.class
= class org.apache.commons.httpclient.SimpleHttpConnectionManager
12:34:11.341 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.cookie-policy
= default
12:34:11.341 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.element-charset
= US-ASCII
12:34:11.341 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.protocol.content-charset
= ISO-8859-1
12:34:11.342 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.method.retry-handler
= org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@6ee1dac2
12:34:11.343 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.dateparser.patterns
= [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE,
dd-MMM-yyyy HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy
HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss
z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy
HH:mm:ss z]
12:34:11.345 [main] DEBUG o.a.commons.httpclient.HttpClient - Java version: 1.6.0_65
12:34:11.346 [main] DEBUG o.a.commons.httpclient.HttpClient - Java vendor: Apple Inc.
12:34:11.346 [main] DEBUG o.a.commons.httpclient.HttpClient - Java class path: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/Users/Shared/development/projects_git/processsystem3/agent-vfsagent/target/classes:/Users/pgh/.m2/repository/de/laudert/processsystem3/laudert/ps-core/3.0.6-17/ps-core-3.0.6-17.jar:/Users/pgh/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.5/jcl-over-slf4j-1.7.5.jar:/Users/pgh/.m2/repository/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar:/Users/pgh/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar:/Users/pgh/.m2/repository/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13.jar:/Users/pgh/.m2/repository/org/jdom/jdom/1.1.3/jdom-1.1.3.jar:/Users/pgh/.m2/repository/org/apache/commons/commons-lang3/3.0.1/commons-lang3-3.0.1.jar:/Users/pgh/.m2/repository/de/laudert/processsystem3/laudert/ps-agent/3.0.6-17/ps-agent-3.0.6-17.jar:/Users/pgh/.m2/repository/commons-daemon/commons-daemon/1.0.7/commons-daemon-1.0.7.jar:/Users/pgh/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/pgh/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/Users/pgh/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar:/Users/pgh/.m2/repository/org/springframework/spring-context/3.2.5.RELEASE/spring-context-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/org/springframework/spring-aop/3.2.5.RELEASE/spring-aop-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/pgh/.m2/repository/org/springframework/spring-beans/3.2.5.RELEASE/spring-beans-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/org/springframework/spring-core/3.2.5.RELEASE/spring-core-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/pgh/.m2/repository/org/springframework/spring-expression/3.2.5.RELEASE/spring-expression-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/org/apache/commons/commons-vfs2/2.0-SNAPSHOT/commons-vfs2-2.0-SNAPSHOT.jar:/Users/pgh/.m2/repository/org/apache/maven/scm/maven-scm-api/1.4/maven-scm-api-1.4.jar:/Users/pgh/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar:/Users/pgh/.m2/repository/org/apache/maven/scm/maven-scm-provider-svnexe/1.4/maven-scm-provider-svnexe-1.4.jar:/Users/pgh/.m2/repository/org/apache/maven/scm/maven-scm-provider-svn-commons/1.4/maven-scm-provider-svn-commons-1.4.jar:/Users/pgh/.m2/repository/regexp/regexp/1.3/regexp-1.3.jar:/Users/pgh/.m2/repository/com/jcraft/jsch/0.1.50/jsch-0.1.50.jar:/Users/pgh/.m2/repository/commons-net/commons-net/3.1/commons-net-3.1.jar:/Users/pgh/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/Users/pgh/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.jar:/Users/pgh/.m2/repository/org/springframework/spring-jdbc/3.2.5.RELEASE/spring-jdbc-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/org/springframework/spring-tx/3.2.5.RELEASE/spring-tx-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/org/springframework/spring-orm/3.2.5.RELEASE/spring-orm-3.2.5.RELEASE.jar:/Users/pgh/.m2/repository/mysql/mysql-connector-java/5.1.20/mysql-connector-java-5.1.20.jar:/Applications/IntelliJ
IDEA 12.app/lib/idea_rt.jar
12:34:11.346 [main] DEBUG o.a.commons.httpclient.HttpClient - Operating system name: Mac OS
X
12:34:11.346 [main] DEBUG o.a.commons.httpclient.HttpClient - Operating system architecture:
x86_64
12:34:11.346 [main] DEBUG o.a.commons.httpclient.HttpClient - Operating system version: 10.10.2
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SUN 1.6: SUN (DSA key/parameter
generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore;
PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy;
JavaLoginConfig Configuration)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - Apple 1.0: Apple Provider (implements
DES, Triple DES, AES, Blowfish, PBE, Diffie-Hellman, HMAC/MD5, HMAC/SHA1)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SunRsaSign 1.5: Sun RSA signature
provider
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SunJSSE 1.6: Sun JSSE provider(PKCS12,
SunX509 key/trust factories, SSLv3, TLSv1)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SunJCE 1.6: SunJCE Provider
(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SunJGSS 1.0: Sun (Kerberos v5,
SPNEGO)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SunSASL 1.5: Sun SASL provider(implements
client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for:
DIGEST-MD5, GSSAPI, CRAM-MD5)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - XMLDSig 1.0: XMLDSig (DOM XMLSignatureFactory;
DOM KeyInfoFactory)
12:34:11.390 [main] DEBUG o.a.commons.httpclient.HttpClient - SunPCSC 1.6: Sun PC/SC provider
12:34:11.400 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.connection-manager.max-per-host
= {HostConfiguration[host=https://server1.com]=5}
12:34:11.400 [main] DEBUG o.a.c.h.params.DefaultHttpParams - Set parameter http.connection-manager.max-total
= 50
12:34:11.418 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - HttpConnectionManager.getConnection:
 config = HostConfiguration[host=https://server1.com], timeout = 0
12:34:11.419 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - Allocating new connection,
hostConfig=HostConfiguration[host=https://server1.com]
12:34:11.422 [main] DEBUG o.a.c.httpclient.HttpConnection - Open connection to server1.com:443
12:34:11.759 [main] DEBUG httpclient.wire.header - >> "HEAD / HTTP/1.1[\r][\n]"
12:34:11.762 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Adding Host request header
12:34:11.773 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
12:34:11.773 [main] DEBUG httpclient.wire.header - >> "Host: server1.com[\r][\n]"
12:34:11.773 [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
12:34:11.992 [main] DEBUG httpclient.wire.header - << "HTTP/1.1 302 Found[\r][\n]"
12:34:11.992 [main] DEBUG httpclient.wire.header - << "HTTP/1.1 302 Found[\r][\n]"
12:34:11.993 [main] DEBUG httpclient.wire.header - << "Date: Wed, 04 Feb 2015 11:34:11
GMT[\r][\n]"
12:34:11.993 [main] DEBUG httpclient.wire.header - << "Server: Apache/2.2.16 (Debian)[\r][\n]"
12:34:11.993 [main] DEBUG httpclient.wire.header - << "Location: http://www.server2.com[\r][\n]"
12:34:11.994 [main] DEBUG httpclient.wire.header - << "Vary: Accept-Encoding[\r][\n]"
12:34:11.994 [main] DEBUG httpclient.wire.header - << "Content-Type: text/html; charset=iso-8859-1[\r][\n]"
12:34:11.994 [main] DEBUG httpclient.wire.header - << "[\r][\n]"
12:34:11.994 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Resorting to protocol version
default close connection policy
12:34:11.994 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Should NOT close connection, using
HTTP/1.1
12:34:11.994 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Redirect required
12:34:11.994 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Redirect requested to location
'http://www.server2.com'
12:34:12.007 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Redirecting from 'https://server1.com:443/'
to 'http://www.server2.com
12:34:12.007 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Execute redirect 1 of 100
12:34:12.007 [main] DEBUG o.a.c.httpclient.HttpConnection - Releasing connection back to connection
manager.
12:34:12.007 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - Freeing connection,
hostConfig=HostConfiguration[host=https://server1.com]
12:34:12.008 [main] DEBUG o.a.c.h.util.IdleConnectionHandler - Adding connection at: 1423049652008
12:34:12.008 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - Notifying no-one, there
are no waiting threads
12:34:12.008 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - HttpConnectionManager.getConnection:
 config = HostConfiguration[host=http://www.server2.com], timeout = 0
12:34:12.008 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - Allocating new connection,
hostConfig=HostConfiguration[host=http://www.server2.com]
12:34:12.008 [main] DEBUG o.a.c.httpclient.HttpConnection - Open connection to www.server2.com:80
12:34:12.011 [main] DEBUG httpclient.wire.header - >> "HEAD / HTTP/1.1[\r][\n]"
12:34:12.011 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Adding Host request header
12:34:12.011 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
12:34:12.011 [main] DEBUG httpclient.wire.header - >> "Host: www.server2.com[\r][\n]"
12:34:12.011 [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
12:34:12.012 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Closing the connection.
12:34:12.013 [main] INFO  o.a.c.httpclient.HttpMethodDirector - I/O exception (org.apache.commons.httpclient.NoHttpResponseException)
caught when processing request: The server www.server2.com failed to respond
12:34:12.020 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - The server www.server2.com
failed to respond
org.apache.commons.httpclient.NoHttpResponseException: The server www.server2.com failed to
respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735) ~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098) ~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) [commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) [commons-httpclient-3.1.jar:na]
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:148)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:50)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.http.HttpFileProvider.doCreateFileSystem(HttpFileProvider.java:83)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:103)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:65)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at de.test.TestPgh.main(TestPgh.java:18) [classes/:na]
12:34:12.021 [main] INFO  o.a.c.httpclient.HttpMethodDirector - Retrying request
12:34:12.021 [main] DEBUG o.a.c.httpclient.HttpConnection - Open connection to www.server2.com:80
12:34:12.021 [main] DEBUG httpclient.wire.header - >> "HEAD / HTTP/1.1[\r][\n]"
12:34:12.021 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Adding Host request header
12:34:12.021 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
12:34:12.022 [main] DEBUG httpclient.wire.header - >> "Host: www.server2.com[\r][\n]"
12:34:12.022 [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
12:34:12.023 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Closing the connection.
12:34:12.023 [main] INFO  o.a.c.httpclient.HttpMethodDirector - I/O exception (org.apache.commons.httpclient.NoHttpResponseException)
caught when processing request: The server www.server2.com failed to respond
12:34:12.023 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - The server www.server2.com
failed to respond
org.apache.commons.httpclient.NoHttpResponseException: The server www.server2.com failed to
respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735) ~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098) ~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) [commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) [commons-httpclient-3.1.jar:na]
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:148)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:50)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.http.HttpFileProvider.doCreateFileSystem(HttpFileProvider.java:83)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:103)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:65)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at de.test.TestPgh.main(TestPgh.java:18) [classes/:na]
12:34:12.023 [main] INFO  o.a.c.httpclient.HttpMethodDirector - Retrying request
12:34:12.023 [main] DEBUG o.a.c.httpclient.HttpConnection - Open connection to www.server2.com:80
12:34:12.024 [main] DEBUG httpclient.wire.header - >> "HEAD / HTTP/1.1[\r][\n]"
12:34:12.024 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Adding Host request header
12:34:12.024 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
12:34:12.024 [main] DEBUG httpclient.wire.header - >> "Host: www.server2.com[\r][\n]"
12:34:12.024 [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
12:34:12.025 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Closing the connection.
12:34:12.026 [main] INFO  o.a.c.httpclient.HttpMethodDirector - I/O exception (org.apache.commons.httpclient.NoHttpResponseException)
caught when processing request: The server www.server2.com failed to respond
12:34:12.026 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - The server www.server2.com
failed to respond
org.apache.commons.httpclient.NoHttpResponseException: The server www.server2.com failed to
respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735) ~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098) ~[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
[commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) [commons-httpclient-3.1.jar:na]
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) [commons-httpclient-3.1.jar:na]
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:148)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:50)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.http.HttpFileProvider.doCreateFileSystem(HttpFileProvider.java:83)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:103)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:65)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605)
[commons-vfs2-2.0-SNAPSHOT.jar:2.0-SNAPSHOT]
	at de.test.TestPgh.main(TestPgh.java:18) [classes/:na]
12:34:12.026 [main] INFO  o.a.c.httpclient.HttpMethodDirector - Retrying request
12:34:12.026 [main] DEBUG o.a.c.httpclient.HttpConnection - Open connection to www.server2.com:80
12:34:12.027 [main] DEBUG httpclient.wire.header - >> "HEAD / HTTP/1.1[\r][\n]"
12:34:12.027 [main] DEBUG o.a.c.httpclient.HttpMethodBase - Adding Host request header
12:34:12.027 [main] DEBUG httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
12:34:12.027 [main] DEBUG httpclient.wire.header - >> "Host: www.server2.com[\r][\n]"
12:34:12.027 [main] DEBUG httpclient.wire.header - >> "[\r][\n]"
12:34:12.028 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Closing the connection.
12:34:12.028 [main] DEBUG o.a.c.httpclient.HttpMethodDirector - Method retry handler returned
false. Automatic recovery will not be attempted
12:34:12.029 [main] DEBUG o.a.c.httpclient.HttpConnection - Releasing connection back to connection
manager.
12:34:12.029 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - Freeing connection,
hostConfig=HostConfiguration[host=http://www.server2.com]
12:34:12.029 [main] DEBUG o.a.c.h.util.IdleConnectionHandler - Adding connection at: 1423049652029
12:34:12.029 [main] DEBUG o.a.c.h.MultiThreadedHttpConnectionManager - Notifying no-one, there
are no waiting threads
Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Could not connect
to HTTP server on "server1.com".
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:152)
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:50)
	at org.apache.commons.vfs2.provider.http.HttpFileProvider.doCreateFileSystem(HttpFileProvider.java:83)
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:103)
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:65)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605)
	at de.test.TestPgh.main(TestPgh.java:18)
Caused by: org.apache.commons.httpclient.NoHttpResponseException: The server www.server2.com
failed to respond
	at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
	at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
	at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
	at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
	at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
	at org.apache.commons.vfs2.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:148)
	... 9 more
{noformat}

> File can't be downloaded if HTTP HEAD on base url fails
> -------------------------------------------------------
>
>                 Key: VFS-560
>                 URL: https://issues.apache.org/jira/browse/VFS-560
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Patrick GH
>
> When i try to download a File via HTTP a HEAD-Request on the base url is executed before
the actual download. In my case the result is a redirect (HTTP 302) to another server. This
server is not available due to firewall restrictions and so the following HEAD request fails.
The actual GET request to retrieve the file is never performed.
> Example:
> Url: http://server1.com/files/2015/image.jpg
> 1. commons-vfs sends HEAD request to http://server1.com/ (not http://server1.com/files/2015/image.jpg)
> 2. Server returns HTTP 302 with redirect to http://server2.com/
> 3. commons-vfs sends HEAD request to http://server2.com/
> 4. Request fails because server2.com is not available (firewall)
> 5. image.jpg is not downloaded 
> Why is this HEAD request on the base url necessary? The file can be downloaded directly
without problems.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message