Re: [vfs]Issue creating HttpClient timeout

2016-07-27 Thread Bernd Eckenfels
Hello,

I am not sure I understand how the configuration of HTTPClient with
HttpConnectionManagerParams works. Especially not what the 

* ConnectionManager set methods must be called after the host & port
* and proxy host & port are set in the HostConfiguration.

comment means. But I guess since you have problems with missing
timeouts, the way it is currently done does not work.

Can you please open a JIRA for this problem?

https://issues.apache.org/jira/browse/VFS

If you want you can also attach your patch. I hope somebody who is more
familier with Apache HttpClient can comment on it.

Gruss
Bernd



 Am Mon, 25 Jul 2016
12:04:48 -0700 schrieb Feiyi Xiang :

> Hi,
> 
> My name is Ben and recently we met an issue that the thread got stuck
> during the http connection using HttpClient. And It showed that the
> connection timeout was set to 0, which was not what we set. let me
> briefly show here how we are using VFS2: Create a FileSystemOptions
> with timeout set:
> 
> final FileSystemOptions fso = new FileSystemOptions();
> final HttpFileSystemConfigBuilder httpBuilder =
> HttpFileSystemConfigBuilder.getInstance();
> httpBuilder.setConnectionTimeout(fso, connectionTimeout);
> httpBuilder.setSoTimeout(fso, soTimeout);
> 
> Create a FileObject using FileSystemManager:
> 
> vfs2FileManager.resolveFile(fileLocation, fso);
> 
> Finally get the input stream using DefaultFileContent:
> 
> final InputStream instr = fileObject.getInputStream();
> 
> We noticed that in executeMethod() of HttpMethodDirector, line 153,
> it is setting the connection timeout using client's params. However,
> in HttpClientFactory, it's setting fileSystemOptions in
> connectionMgrParams, and the HttpClient's params would not have this
> value. So we did the following to make it work: In package
> org.apache.commons.vfs2.provider.http, HttpClientFactory, added line
> 148 and 149:
> client.getParams().setConnectionManagerTimeout(connectionMgrParams.getConnectionTimeout());
> client.getParams().setSoTimeout(connectionMgrParams.getSoTimeout());
> Please let me know your thought about this and if there is a patch
> needed, or is there something we are missing or doing wrong ?
> 
> Thanks!
> 
> Ben
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[vfs]Issue creating HttpClient timeout

2016-07-25 Thread Feiyi Xiang
Hi,

My name is Ben and recently we met an issue that the thread got stuck during 
the http connection using HttpClient. And It showed that the connection timeout 
was set to 0, which was not what we set.
let me briefly show here how we are using VFS2:
Create a FileSystemOptions with timeout set:

final FileSystemOptions fso = new FileSystemOptions();
final HttpFileSystemConfigBuilder httpBuilder = 
HttpFileSystemConfigBuilder.getInstance();
httpBuilder.setConnectionTimeout(fso, connectionTimeout);
httpBuilder.setSoTimeout(fso, soTimeout);

Create a FileObject using FileSystemManager:

vfs2FileManager.resolveFile(fileLocation, fso);

Finally get the input stream using DefaultFileContent:

final InputStream instr = fileObject.getInputStream();

We noticed that in executeMethod() of HttpMethodDirector, line 153, it is 
setting the connection timeout using client's params. However,
in HttpClientFactory, it's setting fileSystemOptions in connectionMgrParams, 
and the HttpClient's params would not have this value.
So we did the following to make it work:
In package org.apache.commons.vfs2.provider.http, HttpClientFactory, added line 
148 and 149:
client.getParams().setConnectionManagerTimeout(connectionMgrParams.getConnectionTimeout());
client.getParams().setSoTimeout(connectionMgrParams.getSoTimeout());
Please let me know your thought about this and if there is a patch needed, or 
is there something we are missing or doing wrong ?

Thanks!

Ben

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org