users@jersey.java.net

Re: [Jersey] A Jersey Client doing HTTP Cache

From: Imran M Yousuf <imyousuf_at_smartitengineering.com>
Date: Tue, 12 Oct 2010 10:26:31 +0600

Hi Paul,

On Tue, Oct 12, 2010 at 9:38 AM, Imran M Yousuf
<imyousuf_at_smartitengineering.com> wrote:
>> <skip />
>> I have done an initial set of refactoring based on your patch.
>>
>
> Thank you very much. I have noted the changes below and will try using
> them and then let you know :).
> <skip />

I have successfully used them. The changes done to incorporate the
latest change is here -
http://github.com/imyousuf/smart-util/commit/d430b01b3ec37e12e757d3434e797a9142d94d98

>
>> I decided to remove the thread local logic from
>> DefaultApacheHttpMethodProcessor (renamed to
>> DefaultApacheHttpMethodExecutor) as that seems to be something specific to
>> your requirements. So ApacheHttpMethodProcessor (renamed to
>> ApacheHttpMethodExecutor) only has one method.
>>

I agree with both the changes, introduced thread local in
jersey-cache-client instead.

>> From what i can tell you want to override DefaultApacheHttpMethodExecutor
>> and override, or reuse, ApacheHttpClientHandler perhaps delegated.
>>

I wanted to leave the executor used in composition and didn't need to
extend it and Handler in my case is not a child but totally different.

>> Note that i moved the configuration in the constructor of
>> DefaultApacheHttpMethodExecutor to the constructor of
>> ApacheHttpClientHandler, this is associated with the setting of pre-emptive
>> authentication and timeouts for configiuration on the  Apache HttpClient and
>> not really specific to the method execution itself.
>>

Not related to method execution directly, but IMHO, it is indirectly
as it controls how to authorize and how long to wait for server.
Furthermore, as you might have noticed in the change in GitHub above,
due to moving it away from executor I needed to set them in my custom
client handler and I am afraid that would be the case always for other
users as well. How can we have it a common place so that I or others
who might want to use do not have rewrite these few lines of code?

>> Please let me know if this is sufficient for you,
>> Paul.

Well, its sufficient, I do mind writing the 2 settings repeatedly, but
I would have preferred not to :).

Thank you once again.

Imran

>>
>>
>> On Oct 5, 2010, at 11:51 AM, Imran M Yousuf wrote:
>>
>>> No probs at all :), just wanted to give a reminder :).
>>>
>>> Thanks,
>>>
>>> Imran
>>>
>>> On Tue, Oct 5, 2010 at 3:41 PM, Paul Sandoz <Paul.Sandoz_at_oracle.com>
>>> wrote:
>>>>
>>>> On Oct 5, 2010, at 10:59 AM, Imran M Yousuf wrote:
>>>>
>>>>> Hi Paul,
>>>>>
>>>>> Any update on the patch :).
>>>>>
>>>>
>>>> No, sorry, at the last minute i took last week off. Still processing
>>>> email...
>>>>
>>>> Paul.
>>>>
>>>>> Regards,
>>>>>
>>>>> Imran
>>>>>
>>>>> On Fri, Sep 10, 2010 at 3:13 PM, Paul Sandoz <Paul.Sandoz_at_oracle.com>
>>>>> wrote:
>>>>>>
>>>>>> Hi Imran,
>>>>>>
>>>>>> Thanks for dong this. It is unlikely i will get around to reviewing
>>>>>> this
>>>>>> until after J1 is has finished. Is that OK with you?
>>>>>>
>>>>>> Paul.
>>>>>>
>>>>>> On Sep 10, 2010, at 10:50 AM, Imran M Yousuf wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have uploaded a patch for refactoring the client modules so that I
>>>>>>> can re-use the apache client code in the cacheable client. The patch
>>>>>>> is attached to the following issue.
>>>>>>> https://jersey.dev.java.net/issues/show_bug.cgi?id=583
>>>>>>>
>>>>>>> After making the change I have already made changes to the cacheable
>>>>>>> client and now its workable with the new changes. This seems to work
>>>>>>> fine. The changes are as follows -
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> http://github.com/imyousuf/smart-util/commits/jersey-cache-client-with-apache-client
>>>>>>> Now the jersey cacheable client will support custom ResponseResolver
>>>>>>> for HTTPCache4J. Thus the client handler is written such that it works
>>>>>>> no matter what resolver is set.
>>>>>>>
>>>>>>> Waiting eagerly for your feedback.
>>>>>>>
>>>>>>> Thank you,
>>>>>>>
>>>>>>> --
>>>>>>> Imran M Yousuf
>>>>>>> Twitter: @imyousuf - http://twitter.com/imyousuf
>>>>>>> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
>>>>>>> Mobile: +880-1711402557
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Imran M Yousuf
>>>>> Entrepreneur & CEO
>>>>> Smart IT Engineering Ltd.
>>>>> 25/5B, Block F, Haji Chinu Miah Road Bylane
>>>>> Joint Quarter, Mohammadpur
>>>>> Dhaka - 1207, Bangladesh
>>>>> Email: imran_at_smartitengineering.com
>>>>> Twitter: @imyousuf - http://twitter.com/imyousuf
>>>>> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
>>>>> Mobile: +880-1711402557
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Imran M Yousuf
>>> Entrepreneur & CEO
>>> Smart IT Engineering Ltd.
>>> 25/5B, Block F, Haji Chinu Miah Road Bylane
>>> Joint Quarter, Mohammadpur
>>> Dhaka - 1207, Bangladesh
>>> Email: imran_at_smartitengineering.com
>>> Twitter: @imyousuf - http://twitter.com/imyousuf
>>> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
>>> Mobile: +880-1711402557
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
>
>
> --
> Imran M Yousuf
> Entrepreneur & CEO
> Smart IT Engineering Ltd.
> 25/5B, Block F, Haji Chinu Miah Road Bylane
> Joint Quarter, Mohammadpur
> Dhaka - 1207, Bangladesh
> Email: imran_at_smartitengineering.com
> Twitter: @imyousuf - http://twitter.com/imyousuf
> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
> Mobile: +880-1711402557
>



-- 
Imran M Yousuf
Entrepreneur & CEO
Smart IT Engineering Ltd.
25/5B, Block F, Haji Chinu Miah Road Bylane
Joint Quarter, Mohammadpur
Dhaka - 1207, Bangladesh
Email: imran_at_smartitengineering.com
Twitter: @imyousuf - http://twitter.com/imyousuf
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557