users@grizzly.java.net

Re: Issue creating simple blocking http client.

From: Daniel Feist <dfeist_at_gmail.com>
Date: Wed, 8 Oct 2014 08:44:21 +0100

Hi,

Thats was it yes, just what I was looking for. For some reason the
cookbook page isn't easy to find from grizzly home page.

Separate question: Is there an example anywhere of building a http proxy
with grizzly

thanks,


On Fri, Oct 3, 2014 at 12:58 AM, Oleksiy Stashok <oleksiy.stashok_at_oracle.com
> wrote:

> Hi Dan,
>
> you definitely don't have to create FilterChain per request.
> I think your case is pretty similar to what is described in the cookbook
> [1].
>
> Please let us know if you have more questions.
>
> WBR,
> Alexey.
>
> [1] https://grizzly.java.net/cookbook.html
>
>
> On 02.10.14 16:43, Daniel Feist wrote:
>
>> Hi,
>>
>> While I have successfully been using grizzly for a few day server-side,
>> i've run into an issue attempting to build a simple http client that sends
>> a body using POST and then receives a body in return from the server.
>>
>> I've been able to put together a filter chain with a custom Filter that
>> will send "Hello World" and receive and print the response easily enough,
>> But I can't work out how to use this from within a blocking method with a
>> signature of type "Response execute(Request req)" without creating a new
>> filterChain each time and giving it an filter using an inner class with
>> access to the request payload and able to write the response somewhere
>> where it can be used as a return value of the method.
>>
>> I write using connection.write() and connction.read(), but while the
>> write() is fine, the read doesn't produce any result because the response
>> by this type has already been processed in another thread (via a selector
>> registered on the channel with 'READ' interest i presume)
>>
>> (BTW I'm attempting to use this with a connection-pool.)
>>
>> Should I be creating a new filterChain for each request (is this even
>> possible when using connection pool) or there something much more obvious
>> that I'm missing?
>>
>> thanks,
>>
>> Dan
>>
>
>