You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Polar Humenn <ph...@iona.com> on 2007/03/12 20:26:34 UTC
http: HttpURLConnection
It appears that the URLConnection used in the HTTPConduit is always the
subject of
of an if(connection instanceof HttpURLConnection) predicate when some
things need to be set. My question is, since this is an "http" conduit,
and it is specifically based on the HttpURLConnection, why isn't this
just set as such? What is the purpose of performing operations on a
URLConnection that is not an HttpURLConnection? Is this Conduit used for
anything other than HTTP?
Cheers,
-Polar
RE: http: HttpURLConnection
Posted by "Glynn, Eoghan" <eo...@iona.com>.
This usage pattern has been in situ since the very first version of the
Celtix HTTP client transport AFAIK.
I'm open to correction, but it seems obvious that the intention is to
respect the fact that java.net.URLConnection is a basic extension point
for Java to support future protocols.
For example, suppose J2SE added jabber support in the form of a new
java.net.XmppURLConnection class.
Then the following code:
URLConnection connection = new
URL("xmpp:user@host?message&subject=post").openConnection();
would obviously yield a XmppURLConnection instead of a
HttpURLConnection.
Now before anyone goes nuts on the accuracy or otherwise of this
example, the point is there may be further protocols added to J2SE
stable in the form of new URLConnection sub-classes, that don't
necessarily sub-class from HttpURLConnection.
Now our HTTP transport as it stands is not actually restricted to HTTP
URLs, and could in fact be used over any protocol for which there is
URLConnection-sytle support, as long as the HTTP ConduitInitiator is
registered with the ConduitInitiatorManager against the corresponding
namespace. Hence we don't down-cast the URLConnection returned form
URL.openConnection() to a HttpURLConnection ...
/Eoghan
> -----Original Message-----
> From: Polar Humenn [mailto:phumenn@iona.com]
> Sent: 12 March 2007 19:27
> To: cxf-dev@incubator.apache.org
> Subject: http: HttpURLConnection
>
> It appears that the URLConnection used in the HTTPConduit is
> always the subject of of an if(connection instanceof
> HttpURLConnection) predicate when some things need to be set.
> My question is, since this is an "http" conduit, and it is
> specifically based on the HttpURLConnection, why isn't this
> just set as such? What is the purpose of performing
> operations on a URLConnection that is not an
> HttpURLConnection? Is this Conduit used for anything other than HTTP?
>
>
> Cheers,
> -Polar
>