Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion In 0.9.3, possible to compose OK with as.stream.Lines?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nathan Hamblen  
View profile  
 More options Nov 4 2012, 1:07 am
From: Nathan Hamblen <nat...@technically.us>
Date: Sun, 04 Nov 2012 01:07:27 -0400
Local: Sun, Nov 4 2012 1:07 am
Subject: Re: In 0.9.3, possible to compose OK with as.stream.Lines?

On 10/31/2012 01:10 PM, Brian Maso wrote:

> Answering my own question here...

> You can't compose the OK verb with any AsyncHandler like I'm trying to
> do (as far as I can tell), but you can get the job done by defining
> your own AsynchHandler implementation -- basically a replacement for
> the AsynchHandler returned by as.stream.Lines.apply().

> See the source for dispatch.as.stream.Lines.apply(), which basically
> just returns an AsynchHandler that: (1) ignores the response status
> code; and (2) always produces a Unit response. Its a pretty simple
> thing to write your own version that actually does pay attention to
> the response status code, and throws an appropriate exception (such as
> dispatch.StatusCode) for non-2xx responses.

If you've got some ideas for incorporating that functionality into the
API, have at it. The design is mostly guesswork, since I'm not working
on a stream consumer myself right now.

Nathan

> Brian Maso

> On Wednesday, October 31, 2012 7:09:26 AM UTC-7, Brian Maso wrote:

>     I've successfully made the transition from 0.8.8 asynch Futures to
>     0.9.3 Promises. Not that hard in the end (except for one issue,
>     which I'll post about in a separate topic).

>     One feature I couldn't figure out ever in 0.8.8 seems to continue
>     being a tough nut to crack (at least for me) in 0.9.3: how apply a
>     HeaderVerb to a streaming handler? Specifically, I'd like to do
>     something like the following:

>     val promise = someUrl / path OK as.stream.Lines({ line => ... })

>     But these things just don't compose, not as far as I can tell.
>     That is, the OK verb just won't accept the as.stream.Lines.
>     Basically the problem I have is that I need to "know" when I'm
>     getting a 4xx or 5xx response vs. a 2xx response, and react
>     accordingly. Is there a way to do such a thing? Or maybe its
>     easier than I think, and somehow I can get the status code from
>     the promise?

>     Brian Maso


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.