commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: [vfs] - Problem with httpclient
Date Tue, 08 Feb 2011 00:55:20 GMT
The question I have is why this is flagged as "vfs" and isn't being asked on the httpclient
mailing list?

Ralph

On Feb 7, 2011, at 8:12 AM, Ismael Marín Carrión wrote:

> Hi all,
> 
> I would like to recall my question. Briefly, httpclient is not able to
> connect to a HTTP server, which has opened a GASS session, using a URI
> such as: http://localhost:8180/opt/mytext.txt , where /opt/mytext.txt is
> on /. However, using a web server or tomcat servlet container,
> httpclient has not problems.
> 
> Tracking the code, in the generateRequestLine method of
> HttpMethodBase.java, it does not receives the correct path.
> 
> protected static String generateRequestLine(HttpConnection connection,
>        String name, String requestPath, String query, String version)
> 
> Thus, for the GASS session , requestPath shows:
> HEAD / HTTP/1.1 , instead of HEAD /opt/mytext.txt HTTP/1.1
> 
> But, using a URI of tomcat, such as http://localhost:8080/index.jsp , it
> shows:
> HEAD /index.jsp HTTP/1.1
> 
> I hope it clarifies the problem. Any comment or suggestion is welcome.
> Regards.
> 
> 
> On Thu, 2011-02-03 at 17:27 +0100, Ismael Marín Carrión wrote:
> 
>> Dear Martin, thanks for your response.
>> 
>> The GASS session does not uses the port 80 (and magno is a local
>> domain). It opens a HTTP session such as
>> 
>> $ globus-gass-server -i -p 8180
>> http://localhost:8180
>> 
>> 
>> and so, you can transfer files using the globus-url-copy (in a grid
>> environment) or simply, using wget to a URI such as
>> http://localhost:8180/out/test.txt, where /out/test.txt is on /, the
>> file is downloaded.
>> 
>> It seems rare since using a URI of a web server or tomcat servlet, this
>> application has not problems. So, I guess that httpclient is not ready
>> for this kind of HTTP services, no?
>> 
>> By other hand, the application previously set the HostConfiguration,
>> client.setHostConfiguration(config);. I am not the developer of this
>> code, and so I unknown some details.
>> 
>> Regards. 
>> 
>> On Thu, 2011-02-03 at 11:09 -0500, Martin Gainty wrote:
>>> ssh username@magno (or whatever the IP is assigned to magno in hosts file)
>>>> netstat -ab | grep 80
>>> 
>>> //if you do not have HTTPServer running on 80 you will get no results
>>> //if you do have HTTPServer running on Port 80 you should see output
>>> 
>>> //also if your HttpClient executeMethod is declared as 
>>> public int executeMethod(HostConfiguration hostconfig, final HttpMethod method,
final HttpState state)
>>> throws IOException, HttpException 
>>> 
>>> //you should call executeMethod with all of the params initialised e.g.
>>> try
>>> {
>>> int n=client.executeMethod(hostconfig,method,state)
>>> }
>>> catch(IOException ioe)
>>> {
>>> log.debug("Handle your IOException from client.executeMethod here");
>>> }
>>> catch(HttpException http_exception)
>>> {
>>> log.debug("Handle your HttpException from client.executeMethod here");
>>> }
>>> 
>>> Saludos Cordiales,
>>> Martin Gainty 
>>> ______________________________________________ 
>>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>> 
>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung
einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen
und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur.
N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert
à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant
donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.
>>> 
>>> 
>>> 
>>> 
>>>> Date: Thu, 3 Feb 2011 16:20:33 +0100
>>>> From: i.marin@fdi.ucm.es
>>>> Subject: Re: [vfs] - Problem with httpclient
>>>> To: user@commons.apache.org
>>>> 
>>>> I would like to emphasize that the URI is given by a insecure Globus
>>>> GASS session (the files are transfered using wget, so the session is
>>>> ok). This code does not fail with other kind of URIs.
>>>> 
>>>> Thus, are this kind of URIs valid for httpclient?
>>>> 
>>>> Regards.
>>>> 
>>>> On Wed, 2011-02-02 at 10:13 +0100, Ismael Marín Carrión wrote:
>>>>> Dear all,
>>>>> 
>>>>> I am working in the development of a driver for a Grid system. In our
>>>>> tests, we are using GridSAM, which use the httpclient and commons-vfs.
>>>>> 
>>>>> I am writing you to get some advise of how solving the next problem.
>>>>> 
>>>>> GridSAM invokes httpclient classes from the HttpClientFactory class
>>>>> (org.apache.commons.vfs.provider.http), in the method
>>>>> createConnection().
>>>>> 
>>>>> public static HttpClient createConnection(HttpFileSystemConfigBuilder
>>>>> builder, String scheme,
>>>>>                                              String hostname, int port,
>>>>> String username,
>>>>>                                              String password,
>>>>> FileSystemOptions fileSystemOptions)
>>>>>            throws FileSystemException
>>>>>    {
>>>>>             ....
>>>>>            client.executeMethod(new HeadMethod());
>>>>>            ....
>>>>>     }
>>>>> 
>>>>> I am not using any authentication mechanism, and so username and passwd
>>>>> are null, but hostname, port and scheme has the proper values.
>>>>> 
>>>>> Thus, in executeMethod() method of the HttpClient class:
>>>>> 
>>>>> public int executeMethod(HostConfiguration hostconfig,
>>>>>        final HttpMethod method, final HttpState state)
>>>>>        throws IOException, HttpException  {
>>>>>        ....
>>>>>         HostConfiguration defaulthostconfig = getHostConfiguration();
>>>>>        if (hostconfig == null) {
>>>>>            hostconfig = defaulthostconfig;
>>>>>        }
>>>>>        URI uri = method.getURI();
>>>>>       ....
>>>>> }
>>>>> 
>>>>> I received a null value for uri, while the hostconfig object has values
>>>>> for host attribute, but not for localAddress attribute or any other.
>>>>> Later it causes a NoHttpResponseException. 
>>>>> 
>>>>> The complete stack is:
>>>>> 
>>>>> 2011-02-01 17:11:49,050 ERROR [TransferAgentFactory] source URI is not
>>>>> resolvable
>>>>> org.apache.commons.vfs.FileSystemException: Could not connect to HTTP
>>>>> server on "magno".
>>>>> at
>>>>> org.apache.commons.vfs.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:186)
>>>>> at
>>>>> org.apache.commons.vfs.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:53)
>>>>> at
>>>>> org.apache.commons.vfs.provider.http.HttpFileProvider.doCreateFileSystem(HttpFileProvider.java:97)
>>>>> at
>>>>> org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:103)
>>>>> at
>>>>> org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:82)
>>>>> at
>>>>> org.apache.commons.vfs.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:66)
>>>>> at
>>>>> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:706)
>>>>> at
>>>>> org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:623)
>>>>> at
>>>>> org.icenigrid.gridsam.core.plugin.transfer.protocol.AbstractTransferAgent.getFileObject(AbstractTransferAgent.java:239)
>>>>> at
>>>>> org.icenigrid.gridsam.core.plugin.transfer.protocol.TransferAgentFactory.resolveSourceFile(TransferAgentFactory.java:168)
>>>>> at
>>>>> org.icenigrid.gridsam.core.plugin.transfer.protocol.TransferAgentFactory.<init>(TransferAgentFactory.java:120)
>>>>> at
>>>>> org.icenigrid.gridsam.core.plugin.transfer.provider.AFTFileTransferJob.execute(AFTFileTransferJob.java:131)
>>>>> at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
>>>>> at org.quartz.simpl.SimpleThreadPool
>>>>> $WorkerThread.run(SimpleThreadPool.java:525)
>>>>> Caused by: org.apache.commons.httpclient.NoHttpResponseException: The
>>>>> server magno failed to respond
>>>>> at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(Unknown
>>>>> Source)
>>>>> at org.apache.commons.httpclient.HttpMethodBase.readResponse(Unknown
>>>>> Source)
>>>>> at org.apache.commons.httpclient.HttpMethodBase.execute(Unknown Source)
>>>>> at
>>>>> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown
Source)
>>>>> at
>>>>> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown
>>>>> Source)
>>>>> at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown
>>>>> Source)
>>>>> at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown
>>>>> Source)
>>>>> at
>>>>> org.apache.commons.vfs.provider.http.HttpClientFactory.createConnection(HttpClientFactory.java:182)
>>>>> ... 13 more
>>>>> 
>>>>> Maybe, the line numbers are not exactly correct since I have been some
>>>>> minor changes. The version of httpclient is 3.0.1 and vfs is 2.1.
>>>>> 
>>>>> I am very pleased of any help or advise. Best regards.
>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: user-help@commons.apache.org
>>>> 
>>> 		 	   		  
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>> 
> 
> 


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


Mime
View raw message