>Is this for the builder pattern ?
Yep.
It is used very widely across JAX-RS, so we thought it will be convenient to
use it in a client as well.

Btw, I think it's a great solution to use a ClientHandler for Basic
Authentication (or other security issues), since it divides code to business
code and security related code. Business code should not care about security
(if possible of course), while handler takes care only of security.
So if properly designed, the business code won't change when a security
schema is changed (let's say you decide to use Digest instead of Basic, or
NTLM, or SAML), the only responsibility will be to replace the handler.


About sending Basic Authentication manually: it's fine. Of course if you use
SSL.
But I think Apache HttpClient does it a bit better: it sends Authorization
header only after it receives 401.


On Thu, Oct 1, 2009 at 7:10 PM, Stefan Witte <[email protected]> wrote:

> Exactly the way i did the authentication... but i use a ClientHandler
> because i didn't find the client.header(..) method. I stumbled upon the
> handler(..) method by accident.
>
> I don't understand why these method's are not called add<something>(..) eg.
> addHeader(..). Wouldn't that be more intuitive and common practise ?
> Same for client.contentType etc. Why not client.setContentType(..) ?
>
> Is this for the builder pattern ?
>
> ------------------------------
> *From:* Bryant Luk <[email protected]>
> *To:* [email protected]
> *Sent:* Thursday, October 1, 2009 3:47:54 PM
> *Subject:* Re: FW: Basic Authentication in WINK Client
>
> Try looking at:
>
> http://matthiaswessendorf.wordpress.com/2009/08/27/twitter-status-post-with-apache-wink/
> which uses the Apache Wink client that uses basic auth to post to Twitter.
>
> On Thu, Oct 1, 2009 at 8:15 AM, Shukrun, Eytan <[email protected]>
> wrote:
> >
> > How do I do Basic Authentication in WINK Client
> >
> >
>
>
>
> --
>
> - Bryant Luk
>
>

Reply via email to