You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jignesh Malkan <JM...@axeda.com> on 2008/08/14 15:32:08 UTC

JDK vs HttpClient

Hi,

 

I am trying to find the reasons to use HttpClient over JDK if app is
running in JDK 1.5 or higher.

Keep in mind most production environments allow users to access URL only
on port 80/443. Most proxies will not allow going through any other
ports.

 

Following line of code using JDK does all the magic including proxy
detection, authentication if required. It even does NTLM Authenticate
without prompting.

 

URL url = new URL( myUrl );

//  Try to set header values to improve PROXY performance

//  These are unnecessary for direct access, but don't hurt

URLConnection con = url.openConnection();

con.setRequestProperty("Connection","keep-alive");

 

 

Can anyone tell me why should I go through so much extra lines of code
and adding new third party JARs like HttpClient when this functionality
is available in JDK since version 1.4.2?

 

 

Jiggy.


RE: JDK vs HttpClient

Posted by Jignesh Malkan <JM...@axeda.com>.
I did not have to set any System properties and it still worked.

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Thursday, August 14, 2008 4:09 PM
To: HttpClient User Discussion
Subject: Re: JDK vs HttpClient

On 14/08/2008, Jignesh Malkan <JM...@axeda.com> wrote:
> Hi,
>
>
>
>  I am trying to find the reasons to use HttpClient over JDK if app is
>  running in JDK 1.5 or higher.
>
>  Keep in mind most production environments allow users to access URL
only
>  on port 80/443. Most proxies will not allow going through any other
>  ports.
>
>
>
>  Following line of code using JDK does all the magic including proxy
>  detection, authentication if required. It even does NTLM Authenticate
>  without prompting.
>

AFAIK, proxy detection requires system properties to be set.

AFAIK, NTLM is supported on Windows only due to MS licensing
restrictions.

>
>  URL url = new URL( myUrl );
>
>  //  Try to set header values to improve PROXY performance
>
>  //  These are unnecessary for direct access, but don't hurt
>
>  URLConnection con = url.openConnection();
>
>  con.setRequestProperty("Connection","keep-alive");
>

It's simple - too simple.

There's no control over connection reuse.

You can't plug in your own socket factory, so it's impossible to do
things such as simulating slow connections.

>
>
>
>  Can anyone tell me why should I go through so much extra lines of
code
>  and adding new third party JARs like HttpClient when this
functionality
>  is available in JDK since version 1.4.2?
>
>
>
>
>
>  Jiggy.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: JDK vs HttpClient

Posted by sebb <se...@gmail.com>.
On 14/08/2008, Jignesh Malkan <JM...@axeda.com> wrote:
> Hi,
>
>
>
>  I am trying to find the reasons to use HttpClient over JDK if app is
>  running in JDK 1.5 or higher.
>
>  Keep in mind most production environments allow users to access URL only
>  on port 80/443. Most proxies will not allow going through any other
>  ports.
>
>
>
>  Following line of code using JDK does all the magic including proxy
>  detection, authentication if required. It even does NTLM Authenticate
>  without prompting.
>

AFAIK, proxy detection requires system properties to be set.

AFAIK, NTLM is supported on Windows only due to MS licensing restrictions.

>
>  URL url = new URL( myUrl );
>
>  //  Try to set header values to improve PROXY performance
>
>  //  These are unnecessary for direct access, but don't hurt
>
>  URLConnection con = url.openConnection();
>
>  con.setRequestProperty("Connection","keep-alive");
>

It's simple - too simple.

There's no control over connection reuse.

You can't plug in your own socket factory, so it's impossible to do
things such as simulating slow connections.

>
>
>
>  Can anyone tell me why should I go through so much extra lines of code
>  and adding new third party JARs like HttpClient when this functionality
>  is available in JDK since version 1.4.2?
>
>
>
>
>
>  Jiggy.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: JDK vs HttpClient

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2008-08-15 at 10:05 -0400, Jignesh Malkan wrote:
> Hi Raymond,
> 
> Thanks for your input.
> 
> Can you please explain "it's about performing
> scalable http requests on web servers"?
> 
> Can you also point me to the documentation or a sample application that
> help me compare the performance? 
> 

http://wiki.apache.org/HttpComponents/HttpClient3vsHttpClient4vsHttpCore

Oleg


> 
> Jiggy
> 
> -----Original Message-----
> From: raykroeker@gmail.com [mailto:raykroeker@gmail.com] On Behalf Of
> Raymond Kroeker
> Sent: Thursday, August 14, 2008 12:00 PM
> To: HttpClient User Discussion
> Subject: Re: JDK vs HttpClient
> 
> Hi Jiggy,
>   Http client isn't about opening connections; it's about performing
> scalable http requests on web servers.  Try writing a sample to
> actually do this and you will quickly discover the value that http
> client provides.
> 
> Raymond
> 
> On Thu, Aug 14, 2008 at 06:32, Jignesh Malkan <JM...@axeda.com> wrote:
> > Hi,
> >
> >
> >
> > I am trying to find the reasons to use HttpClient over JDK if app is
> > running in JDK 1.5 or higher.
> >
> > Keep in mind most production environments allow users to access URL
> only
> > on port 80/443. Most proxies will not allow going through any other
> > ports.
> >
> >
> >
> > Following line of code using JDK does all the magic including proxy
> > detection, authentication if required. It even does NTLM Authenticate
> > without prompting.
> >
> >
> >
> > URL url = new URL( myUrl );
> >
> > //  Try to set header values to improve PROXY performance
> >
> > //  These are unnecessary for direct access, but don't hurt
> >
> > URLConnection con = url.openConnection();
> >
> > con.setRequestProperty("Connection","keep-alive");
> >
> >
> >
> >
> >
> > Can anyone tell me why should I go through so much extra lines of code
> > and adding new third party JARs like HttpClient when this
> functionality
> > is available in JDK since version 1.4.2?
> >
> >
> >
> >
> >
> > Jiggy.
> >
> >
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: JDK vs HttpClient

Posted by Jignesh Malkan <JM...@axeda.com>.
Hi Raymond,

Thanks for your input.

Can you please explain "it's about performing
scalable http requests on web servers"?

Can you also point me to the documentation or a sample application that
help me compare the performance? 


Jiggy

-----Original Message-----
From: raykroeker@gmail.com [mailto:raykroeker@gmail.com] On Behalf Of
Raymond Kroeker
Sent: Thursday, August 14, 2008 12:00 PM
To: HttpClient User Discussion
Subject: Re: JDK vs HttpClient

Hi Jiggy,
  Http client isn't about opening connections; it's about performing
scalable http requests on web servers.  Try writing a sample to
actually do this and you will quickly discover the value that http
client provides.

Raymond

On Thu, Aug 14, 2008 at 06:32, Jignesh Malkan <JM...@axeda.com> wrote:
> Hi,
>
>
>
> I am trying to find the reasons to use HttpClient over JDK if app is
> running in JDK 1.5 or higher.
>
> Keep in mind most production environments allow users to access URL
only
> on port 80/443. Most proxies will not allow going through any other
> ports.
>
>
>
> Following line of code using JDK does all the magic including proxy
> detection, authentication if required. It even does NTLM Authenticate
> without prompting.
>
>
>
> URL url = new URL( myUrl );
>
> //  Try to set header values to improve PROXY performance
>
> //  These are unnecessary for direct access, but don't hurt
>
> URLConnection con = url.openConnection();
>
> con.setRequestProperty("Connection","keep-alive");
>
>
>
>
>
> Can anyone tell me why should I go through so much extra lines of code
> and adding new third party JARs like HttpClient when this
functionality
> is available in JDK since version 1.4.2?
>
>
>
>
>
> Jiggy.
>
>



-- 
---------------------------------------------------------
Raymond Kroeker

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: JDK vs HttpClient

Posted by Raymond Kroeker <ra...@raykroeker.com>.
Hi Jiggy,
  Http client isn't about opening connections; it's about performing
scalable http requests on web servers.  Try writing a sample to
actually do this and you will quickly discover the value that http
client provides.

Raymond

On Thu, Aug 14, 2008 at 06:32, Jignesh Malkan <JM...@axeda.com> wrote:
> Hi,
>
>
>
> I am trying to find the reasons to use HttpClient over JDK if app is
> running in JDK 1.5 or higher.
>
> Keep in mind most production environments allow users to access URL only
> on port 80/443. Most proxies will not allow going through any other
> ports.
>
>
>
> Following line of code using JDK does all the magic including proxy
> detection, authentication if required. It even does NTLM Authenticate
> without prompting.
>
>
>
> URL url = new URL( myUrl );
>
> //  Try to set header values to improve PROXY performance
>
> //  These are unnecessary for direct access, but don't hurt
>
> URLConnection con = url.openConnection();
>
> con.setRequestProperty("Connection","keep-alive");
>
>
>
>
>
> Can anyone tell me why should I go through so much extra lines of code
> and adding new third party JARs like HttpClient when this functionality
> is available in JDK since version 1.4.2?
>
>
>
>
>
> Jiggy.
>
>



-- 
---------------------------------------------------------
Raymond Kroeker

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org