You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Maneesh Sharma <Ma...@sun.com> on 2003/01/10 08:19:05 UTC

protocol support

Hi ,
Can anyone tell me how do i get my program to support ftp,gopher and 
other protocols? currently I am getting the following exception:
java.lang.IllegalStateException: unsupported protocol: 'ftp'
at 
org.apache.commons.httpclient.Protocol.lazyRegisterProtocol(Protocol.java:188)
at org.apache.commons.httpclient.Protocol.getProtocol(Protocol.java:150)
at 
org.apache.commons.httpclient.HostConfiguration.setHost(HostConfiguration.java:185)
at 
org.apache.commons.httpclient.HostConfiguration.setHost(HostConfiguration.java:221)
at GTest.dispatch(GTest.java:750)
at GTest.execute(GTest.java:571)
at org.apache.tools.ant.Task.perform(Task.java:319)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
at org.apache.tools.ant.Main.runBuild(Main.java:610)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)


TIA
Maneesh.




Re: protocol support

Posted by Simon Roberts <si...@fifthweb.net>.
Not that it actually works for in the current codebase (for
MultiThreadedHttpConnectionManager, for multiple connections to the same
host, anyway), as I noted.  I can submit a patch that adds the the Protocol
to the key used in the connection pool, if y'like.


----- Original Message -----
From: "Ortwin Glück" <or...@nose.ch>
To: "Commons HttpClient Project" <co...@jakarta.apache.org>
Sent: Friday, January 10, 2003 9:30 PM
Subject: Re: protocol support


> You can register your own protocols via
> Protocol.registerProtocol(String, Protocol). However HttpClient is only
> meant to handle http and https. FTP, Gopher and others are not handled
> by HttpClient. The main use of registerProtocol method is to register
> custom SocketFactories. So you would mostly register protocols like
> 'https1', 'https2' for different client certificates with SSL.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.441 / Virus Database: 247 - Release Date: 9/01/2003


Re: protocol support

Posted by Ortwin Glück <or...@nose.ch>.
Maneesh,

You can register your own protocols via 
Protocol.registerProtocol(String, Protocol). However HttpClient is only 
meant to handle http and https. FTP, Gopher and others are not handled 
by HttpClient. The main use of registerProtocol method is to register 
custom SocketFactories. So you would mostly register protocols like 
'https1', 'https2' for different client certificates with SSL.

Odi

Maneesh Sharma wrote:
> Hi ,
> Can anyone tell me how do i get my program to support ftp,gopher and 
> other protocols? currently I am getting the following exception:
> java.lang.IllegalStateException: unsupported protocol: 'ftp'
> at 
> org.apache.commons.httpclient.Protocol.lazyRegisterProtocol(Protocol.java:188) 
> 
> at org.apache.commons.httpclient.Protocol.getProtocol(Protocol.java:150)
> at 
> org.apache.commons.httpclient.HostConfiguration.setHost(HostConfiguration.java:185) 
> 
> at 
> org.apache.commons.httpclient.HostConfiguration.setHost(HostConfiguration.java:221) 
> 
> at GTest.dispatch(GTest.java:750)
> at GTest.execute(GTest.java:571)
> at org.apache.tools.ant.Task.perform(Task.java:319)
> at org.apache.tools.ant.Target.execute(Target.java:309)
> at org.apache.tools.ant.Target.performTasks(Target.java:336)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
> at org.apache.tools.ant.Main.runBuild(Main.java:610)
> at org.apache.tools.ant.Main.start(Main.java:196)
> at org.apache.tools.ant.Main.main(Main.java:235)
> 
> 
> TIA
> Maneesh.
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>

-- 
_________________________________________________________________
  NOSE applied intelligence ag
                                    [www]      http://www.nose.ch
  ortwin glück                      [email] ortwin.glueck@nose.ch
  hardturmstrasse 171               [pgp key]          0x81CF3416
  8005 zurich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12