hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zulfi Umrani" <zumr...@novell.com>
Subject Re: HttpURLconnection, POST & Authentication
Date Mon, 09 Jun 2003 22:21:57 GMT
So what you are saying is that I can use HttpClient APIs and execute the
method and then wrap that method in HttpURLConnection so that I am using
java.net APIs to get the response? In other words I can not use it like
java.net API for making requests. Is that correct? If NOT, how can I use
this class to do Authentication? It does not have any methods which take
Credentials as argument. Neither does it take HttpState as one of the
arguments in the constructor. If you have a sample code that will be
great.

Thanks.

>>> becke@u.washington.edu 6/9/2003 9:08:53 PM >>>
Yes, this class unfortunately serves little purpose.  As specified in 
the JavaDocs it only acts as a wrapper for an already executed 
HttpMethod.  It really only provides access for querying an HttpClient

response with the java.net API.

Mike

On Monday, June 9, 2003, at 06:00 PM, Zulfi Umrani wrote:

> Thanks for the info. I believe you have a HttpURLConnection class
which
> is a wrapper on java.net.HttpURLConnection. Wouldn't that work to do
> POST+Authentication?
>
>>>> adrian@intencha.com 6/9/2003 8:51:06 PM >>>
> Hello again,
> HttpClient works differently to HttpURLConnection because despite
> initial impressions they do different things.  If you want the
ability
>
> to change between Http libraries, you need to provide an abstraction
> layer in the form of a single class that handles all the HTTP stuff
for
>
> your app and then you only have to change that class when you change
> libraries (or implement subclasses for different libraries and use
the
>
> factory pattern).
>
> So essentially the answer is no, unless you write a wrapper around
> HttpClient to map HttpURLConnection type calls to HttpClient calls.
> I'm not sure how much success you'll have with that.  I would
strongly
>
> urge you to take some time and redesign your Http code so that it's
> more flexible and separate as your entire application will likely
> benefit as a result.
>
> Regards,
>
> Adrian Sutton.
>
> On Tuesday, June 10, 2003, at 07:34  AM, Zulfi Umrani wrote:
>
>> I am trying to do POST using HttpURLConnection. Also I would like
to
> do
>> Basic/Digest/NTLM Authentication at the same time. Since most of my
>> earlier code is done using java.net.HttpURLConnection, I would like
> to
>> maintain the APIs such as getOutputStream(), getInputStream() and
>> get/setHeader().
>> Does anyone know how can I do that using the 2.0 version?
>>
>> Thanks,
>> Zulfi
>>
>>
>
---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org 
>> For additional commands, e-mail:
>> commons-httpclient-dev-help@jakarta.apache.org 
>>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-httpclient-dev-unsubscribe@jakarta.apache.org 
> For additional commands, e-mail:
> commons-httpclient-dev-help@jakarta.apache.org 
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org 
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org 
>


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


Mime
View raw message