New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters not working #66

jkischkel opened this Issue Oct 28, 2013 · 1 comment


2 participants

jkischkel commented Oct 28, 2013

Hey, I'm using the latest version of finatra, but it seem that filters are not working as described here:

I built a single file example with a filter that throws an exception to isolate the problem:

package com.fintest

import com.twitter.finatra._
import com.twitter.finagle._
import com.twitter.finagle.http.{Request => FinagleRequest}
import com.twitter.finagle.http.{Response => FinagleResponse}

class Example extends Controller {
  get("/") { request =>

class MyServer extends FinatraServer {
    val controller = new Example()
    addFilter(new TestFilter)

class TestFilter extends SimpleFilter[FinagleRequest, FinagleResponse] with App {

  def apply(
    request: FinagleRequest,
    service: Service[FinagleRequest, FinagleResponse]) = {
    service(request) map { response =>
        throw new Exception("!") // this is never executed

object Runner {
    def main(args: Array[String]): Unit = {
        val server = new MyServer()

The exception is never thrown. Any idea why this is the case?


This comment has been minimized.

salomvary commented Oct 28, 2013

Ugly workaround:

class MyServer extends FinatraServer {
    val controller = new Example()

    override def allFilters(baseService: Service[FinagleRequest, FinagleResponse]):
        Service[FinagleRequest, FinagleResponse] = {
      filters = filters ++ Seq(new TestFilter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment