commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gunnlaugur Thor Briem" <g...@dimon.is>
Subject RE: [HttpClient] REPOST: Handlers for HttpClient?
Date Wed, 12 Jun 2002 17:35:16 GMT
> That would probably mean that we would need to create implementations
> for java.net.URL, java.net.HttpURLConnection and maybe also for
> java.net.URLConnection. URL is a final class, so I don't know how it
> would be possible to get it to return something different with
> URL.openConnection().
> 
> Do you think it would be possible?

To control what URL returns from url.openConnection, you can
either install a URLStreamHandlerFactory using the method
URL.setURLStreamHandlerFactory(URLStreamHandlerFactory fac),
see http://java.sun.com/j2se/1.3/docs/api/java/net/URL.html,
or (less drastically) control the behavior of the default
URLStreamHandlerFactory implementation: define your handlers
with a particular naming convention and list their packages
in the system property java.protocol.handler.pkgs. See this:
http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/
for enough details to work with.

Both approaches unfortunately require tweaking the global
configuration of the JVM, which may be annoying to those
working in servlet/J2EE environments, but that's a problem
you're always stuck with when using the URLConnection
scheme -- it can only be configured globally in the JVM.

Hope that helps,

	- Gulli



> -----Original Message-----
> From: Evert Hoff [mailto:evert.hoff@pixie.co.za]
> Sent: 12. júní 2002 17:13
> To: Jakarta Commons Developers List
> Subject: Re: [HttpClient] REPOST: Handlers for HttpClient?
> 
> 
> Hi Matt,
> 
> That would probably mean that we would need to create implementations
> for java.net.URL, java.net.HttpURLConnection and maybe also for
> java.net.URLConnection. URL is a final class, so I don't know how it
> would be possible to get it to return something different with
> URL.openConnection().
> 
> Do you think it would be possible?
> 
> Evert
> 
> On Wed, 2002-06-12 at 18:27, SkyLeach wrote:
> > Nobody responded to this last time, and I still am interested in knowing the
> > answer.  Please read if you are using HttpClient and let me know...
> > 
> > thanks,
> > 
> > ----- Original Message -----
> > From: "Matt Gregory" <matthew.gregory@skyleach.com>
> > To: <commons-dev@jakarta.apache.org>
> > Sent: Tuesday, June 11, 2002 11:39 AM
> > Subject: Handlers for HttpClient?
> > 
> > 
> > > Have handler classes been created to wrap the Commons project HttpClient?
> > >
> > > In other words, can I pass the
> > > "-Djava.protocol.handler.pkgs=org.apache.commons.httpclient" directive to
> > my
> > > JVM and expect to get an org.apache.commons.httpclient.HttpConnection back
> > > from a java.net.URL.openConnection() call when I specify the "http"
> > protocol?
> > >
> > > Please let me know, and if not then I will work to extend the package now.
> > > I must have this functionality ASAP because my package, PortletStreams is
> > in
> > > production but needs cookie handling and HTTP authentication.
> > >
> > > Thanks in advance...
> > >     -Matt
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:commons-dev-help@jakarta.apache.org>
> > >
> > >
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> > 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message