Unfiltered 0.8.1 released

31 views
Skip to first unread message

Nathan Hamblen

unread,
Aug 10, 2014, 3:00:48 PM8/10/14
to unfilter...@googlegroups.com
Server builders finally refactored for a Scala 2.8+ world!

http://notes.implicit.ly/post/94356562949/unfiltered-0-8-1

In other news, the Unfiltered github repository is now using release
branches. The current default branch is 0.8.2, so most pull requests
should go into that branch. Release version tags will be prefixed with a
v from now on, as is a more common convention. The last release is
tagged both ways, 0.8.1 and v0.8.1 .

We'll also be tagging PRs with milestones so that it's easier to report
on them at release time.

Crazy Frog

unread,
Aug 22, 2014, 6:50:42 AM8/22/14
to unfilter...@googlegroups.com
Does Directives work with netty ?

Erlend Hamnaberg

unread,
Aug 22, 2014, 6:58:36 AM8/22/14
to unfilter...@googlegroups.com
yes, but only the synchronous version.

-E


--
You received this message because you are subscribed to the Google Groups "Unfiltered" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unfiltered-sca...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Doug Tangren

unread,
Aug 22, 2014, 8:30:43 AM8/22/14
to unfilter...@googlegroups.com


On Aug 22, 2014 6:58 AM, "Erlend Hamnaberg" <nga...@gmail.com> wrote:
>
> yes, but only the synchronous version.

Since an async intent's return type is unit it's up to the request responder to complete the request which doesn't fit well with a directive s type signature. Pull requests are welcome!

Jon-Anders Teigen

unread,
Aug 22, 2014, 9:15:23 AM8/22/14
to unfilter...@googlegroups.com
async type signature could also be expressed as Request => Future[Response], which would be suitable for directives if they were rewritten to work with any monad.

which demonstrates this.

Not really sure I like it in its current form, but atleast it proves that its possible

/j

Doug Tangren

unread,
Aug 22, 2014, 2:04:53 PM8/22/14
to unfilter...@googlegroups.com
On Fri, Aug 22, 2014 at 9:15 AM, Jon-Anders Teigen <jte...@gmail.com> wrote:
async type signature could also be expressed as Request => Future[Response], which would be suitable for directives if they were rewritten to work with any monad.

which demonstrates this.

Not really sure I like it in its current form, but atleast it proves that its possible

If you can, can you try to sync that up with the latest release branch. I'd like to move that forward. @chrslws and I were actually just talking about this yesterday. I can help out too.
Message has been deleted

Crazy Frog

unread,
Aug 22, 2014, 6:49:58 PM8/22/14
to unfilter...@googlegroups.com
I quickly hacked up this which seems to work:

      .plan(Planify {

        case req  =>

          (AsyncDirective{
              x[ReceivedMessage, Any](req) orElse y[ReceivedMessage, Any](req)
            })(req)

      })

  }

  object AsyncDirective {

    def apply[A,B](intent: PartialFunction[HttpRequest[A] with Async.Responder[B],
      Directive[A, ResponseFunction[B], Unit]]): PartialFunction[HttpRequest[A] with Async.Responder[B], Unit] = {

      case req =>
        if (intent.isDefinedAt(req)) intent(req)(req)
        else req.respond(NotFound)

    }

  }


  def x[A,B](req: HttpRequest[A] with Async.Responder[B]): PartialFunction[HttpRequest[A] with Async.Responder[B], Directive[A, ResponseFunction[B], Unit]] = {

    case Path("/x/") =>

      for {
        _ <- GET
      } yield for {
        x <- future { scala.concurrent.blocking { scala.math.pow(100, 110) } }
      } yield {
        val out = s"""x=$x"""
        req.respond(Ok ~> ResponseString(out))
      }

  }

  def y[A,B](req: HttpRequest[A] with Async.Responder[B]): PartialFunction[HttpRequest[A] with Async.Responder[B], Directive[A, ResponseFunction[B], Unit]] = {

    case Path("/y/") =>

      for {
        _ <- GET
      } yield {
        req.respond(Ok ~> Html5(<h1> hello y</h1>))
      }

  }



On Monday, 11 August 2014 05:00:48 UTC+10, n8han wrote:

Nathan Hamblen

unread,
Aug 24, 2014, 10:29:26 PM8/24/14
to unfilter...@googlegroups.com
On 08/22/2014 09:15 AM, Jon-Anders Teigen wrote:
> async type signature could also be expressed as Request =>
> Future[Response], which would be suitable for directives if they were
> rewritten to work with any monad.

We did this a while back, just decided to put it in a new `future`
package rather than replace the existing `async` plans.

https://github.com/unfiltered/unfiltered/blob/0.8.2/netty/src/main/scala/future/plans.scala#L14-L17

Nathan
Reply all
Reply to author
Forward
0 new messages