org.scalatra

ScalatraFilter

trait ScalatraFilter extends Filter with ScalatraKernel with Initializable

linear super types: ScalatraKernel, ServletApiImplicits, Initializable, CoreDsl, Handler, Filter, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. ScalatraFilter
  2. ScalatraKernel
  3. ServletApiImplicits
  4. Initializable
  5. CoreDsl
  6. Handler
  7. Filter
  8. AnyRef
  9. Any
Visibility
  1. Public
  2. All
Impl.
  1. Concrete
  2. Abstract

Type Members

  1. type Config = FilterConfig

    definition classes: ScalatraFilterInitializable
  2. case class HaltException (status: Option[Int], reason: Option[String], headers: Map[String, String], body: Any) extends RuntimeException with Product

    attributes: protected
  3. class PassException extends RuntimeException

    attributes: protected[scalatra]

Value Members

  1. def != (arg0: AnyRef) : Boolean

    attributes: final
    definition classes: AnyRef
  2. def != (arg0: Any) : Boolean

    o != arg0 is the same as !(o == (arg0)).

    o != arg0 is the same as !(o == (arg0)).

    arg0

    the object to compare against this object for dis-equality.

    returns

    false if the receiver object is equivalent to the argument; true otherwise.

    attributes: final
    definition classes: Any
  3. def ## () : Int

    attributes: final
    definition classes: AnyRef → Any
  4. def $asInstanceOf [T0] () : T0

    attributes: final
    definition classes: AnyRef
  5. def $isInstanceOf [T0] () : Boolean

    attributes: final
    definition classes: AnyRef
  6. def == (arg0: AnyRef) : Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    attributes: final
    definition classes: AnyRef
  7. def == (arg0: Any) : Boolean

    o == arg0 is the same as o.equals(arg0).

    o == arg0 is the same as o.equals(arg0).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    attributes: final
    definition classes: Any
  8. val _params : MultiMapHeadView[String, String] with MapWithIndifferentAccess[String]

    attributes: protected
    definition classes: ScalatraKernel
  9. val _request : DynamicVariable[HttpServletRequest]

    attributes: protected
    definition classes: ScalatraKernel
  10. val _response : DynamicVariable[HttpServletResponse]

    attributes: protected
    definition classes: ScalatraKernel
  11. def addRoute (verb: String, routeMatchers: Iterable[RouteMatcher], action: ⇒ Any) : Route

    attributes: protected[scalatra]
    definition classes: ScalatraKernel
      deprecated:
    1. Use addRoute(HttpMethod, Iterable[RouteMatcher], =>Any)

  12. def addRoute (method: HttpMethod, routeMatchers: Iterable[RouteMatcher], action: ⇒ Any) : Route

    Prepends a new route for the given HTTP method.

    Prepends a new route for the given HTTP method.

    Can be overriden so that subtraits can use their own logic. Possible examples: - restricting protocols - namespace routes based on class name - raising errors on overlapping entries.

    This is the method invoked by get(), post() etc.

    attributes: protected
    definition classes: ScalatraKernel
      see also:
    1. org.scalatra.ScalatraKernel.removeRoute

  13. def after (routeMatchers: RouteMatcher*)(fun: ⇒ Any) : Unit

    Adds a filter to run after the route.

    Adds a filter to run after the route. The filter only runs if each routeMatcher returns Some. If the routeMatchers list is empty, the filter runs for all routes.

    definition classes: ScalatraKernelCoreDsl
  14. def afterAll (block: ⇒ Any) : Unit

    attributes: final
    definition classes: CoreDsl
      deprecated:
    1. Use after() { ... }

  15. def afterSome (routeMatchers: RouteMatcher*)(block: ⇒ Any) : Unit

    attributes: final
    definition classes: CoreDsl
      deprecated:
    1. Use after(RouteMatcher*) { ... }

  16. def asInstanceOf [T0] : T0

    This method is used to cast the receiver object to be of type T0.

    This method is used to cast the receiver object to be of type T0.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression1.asInstanceOf[String] will throw a ClassCastException at runtime, while the expressionList(1).asInstanceOf[List[String]] will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested typed.

    returns

    the receiver object.

    attributes: final
    definition classes: Any
  17. def before (routeMatchers: RouteMatcher*)(fun: ⇒ Any) : Unit

    Adds a filter to run before the route.

    Adds a filter to run before the route. The filter only runs if each routeMatcher returns Some. If the routeMatchers list is empty, the filter runs for all routes.

    definition classes: ScalatraKernelCoreDsl
  18. def beforeAll (block: ⇒ Any) : Unit

    attributes: final
    definition classes: CoreDsl
      deprecated:
    1. Use before() { ... }

  19. def beforeSome (routeMatchers: RouteMatcher*)(block: ⇒ Any) : Unit

    attributes: final
    definition classes: CoreDsl
      deprecated:
    1. Use before(RouteMatcher*) { ... }

  20. implicit def booleanBlock2RouteMatcher (block: ⇒ Boolean) : RouteMatcher

    attributes: protected implicit
    definition classes: ScalatraKernel
  21. def clone () : AnyRef

    This method creates and returns a copy of the receiver object.

    This method creates and returns a copy of the receiver object.

    The default implementation of the clone method is platform dependent.

    returns

    a copy of the receiver object.

    attributes: protected[lang]
    definition classes: AnyRef
  22. def contentType : String

    Gets the content type of the current response.

    Gets the content type of the current response.

    definition classes: CoreDsl
  23. def contentTypeInferrer : ContentTypeInferrer

    attributes: protected
    definition classes: ScalatraKernel
  24. def contentType_= (contentType: String) : Unit

    Sets the content type of the current response.

    Sets the content type of the current response.

    definition classes: CoreDsl
  25. val defaultCharacterEncoding : String

    attributes: protected
    definition classes: ScalatraKernel
  26. def delete (routeMatchers: RouteMatcher*)(action: ⇒ Any) : Route

    definition classes: ScalatraKernelCoreDsl
      see also:
    1. get

  27. def destroy () : Unit

    definition classes: ScalatraFilter → Filter
  28. def doFilter (request: ServletRequest, response: ServletResponse, chain: FilterChain) : Unit

    definition classes: ScalatraFilter → Filter
  29. var doMethodNotAllowed : (Set[HttpMethod]) ⇒ Any

    attributes: protected
    definition classes: ScalatraKernel
  30. var doNotFound : Action

    attributes: protected
    definition classes: ScalatraFilterScalatraKernel
  31. def environment : String

    definition classes: ScalatraKernel
  32. def eq (arg0: AnyRef) : Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

    The eq method implements an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation] on non-null instances of AnyRef: * It is reflexive: for any non-null instance x of type AnyRef, x.eq(x) returns true. * It is symmetric: for any non-null instances x and y of type AnyRef, x.eq(y) returns true if and only if y.eq(x) returns true. * It is transitive: for any non-null instances x, y, and z of type AnyRef if x.eq(y) returns true and y.eq(z) returns true, then x.eq(z) returns true.

    Additionally, the eq method has three other properties. * It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of x.eq(y) consistently returns true or consistently returns false. * For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false. * null.eq(null) returns true.

    When overriding the equals or hashCode methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

    arg0

    the object to compare against this object for reference equality.

    returns

    true if the argument is a reference to the receiver object; false otherwise.

    attributes: final
    definition classes: AnyRef
  33. def equals (arg0: Any) : Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation]: * It is reflexive: for any instance x of type Any, x.equals(x) should return true. * It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true. * It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same scala.Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef → Any
  34. def error (handler: ErrorHandler) : Unit

    Defines an error handler for exceptions thrown in either the before block or a route action.

    Defines an error handler for exceptions thrown in either the before block or a route action.

    If the error handler does not match, the result falls through to the previously defined error handler. The default error handler simply rethrows the exception.

    The error handler is run before the after filters, and the result is rendered like a standard response. It is the error handler's responsibility to set any appropriate status code.

    definition classes: ScalatraKernelCoreDsl
  35. var errorHandler : ErrorHandler

    attributes: protected
    definition classes: ScalatraKernel
  36. def executeRoutes () : Unit

    attributes: protected
    definition classes: ScalatraKernel
  37. def filterChain : FilterChain

    attributes: protected
  38. def finalize () : Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

    The details of when and if the finalize method are invoked, as well as the interaction between finalizeand non-local returns and exceptions, are all platform dependent.

    attributes: protected[lang]
    definition classes: AnyRef
  39. def get (routeMatchers: RouteMatcher*)(action: ⇒ Any) : Route

    The Scalatra DSL core methods take a list of RouteMatcherand a block as the action body.

    The Scalatra DSL core methods take a list of RouteMatcherand a block as the action body. The return value of the block is rendered through the pipeline and sent to the client as the response body.

    See org.scalatra.ScalatraKernel.renderResponseBody for the detailed behaviour and how to handle your response body more explicitly, and see how different return types are handled.

    The block is executed in the context of a CoreDsl instance, so all the methods defined in this trait are also available inside the block.

      get("/") {
        <form action="/echo">
          <label>Enter your name</label>
          <input type="text" name="name"/>
        </form>
      }
    
      post("/echo") {
        "hello {params('name)}!"
      }
    

    ScalatraKernel provides implicit transformation from boolean blocks, strings and regular expressions to RouteMatcher, so you can write code naturally.

      get("/", request.getRemoteHost == "127.0.0.1") { "Hello localhost!" }
    
    definition classes: ScalatraKernelCoreDsl
  40. def getClass () : java.lang.Class[_]

    Returns a representation that corresponds to the dynamic class of the receiver object.

    Returns a representation that corresponds to the dynamic class of the receiver object.

    The nature of the representation is platform dependent.

    returns

    a representation that corresponds to the dynamic class of the receiver object.

    attributes: final
    definition classes: AnyRef
  41. def halt [T] (status: Integer, body: T, headers: Map[String, String], reason: String)(implicit arg0: Manifest[T]) : Nothing

    Immediately halts the current action.

    Immediately halts the current action. If called within a before filter, prevents the action from executing. Any matching after filters will still execute.

    status

    set as the response's HTTP status code. Ignored if null.

    body

    rendered to the response body through the response pipeline.

    headers

    added as headers to the response. Previously set headers are retained

    reason

    set as the HTTP status reason. Ignored if null or if status is null.

    definition classes: ScalatraKernelCoreDsl
  42. def handle (request: HttpServletRequest, response: HttpServletResponse) : Unit

    Accesses the request/response pair, possibly altering them

    Accesses the request/response pair, possibly altering them

    definition classes: ScalatraKernelHandler
  43. def hashCode () : Int

    Returns a hash code value for the object.

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    returns

    the hash code value for the object.

    definition classes: AnyRef → Any
  44. def init (filterConfig: FilterConfig) : Unit

    definition classes: ScalatraFilter → Filter
  45. def initParameter (name: String) : Option[String]

    definition classes: ScalatraKernel
  46. def initialize (config: FilterConfig) : Unit

    A hook to initialize the class with some configuration after it has been constructed.

    A hook to initialize the class with some configuration after it has been constructed.

    Not called init because GenericServlet doesn't override it, and then we get into https://lampsvn.epfl.ch/trac/scala/ticket/2497.

    definition classes: ScalatraFilterScalatraKernelInitializable
  47. def invoke (matchedRoute: MatchedRoute) : Option[Any]

    attributes: protected
    definition classes: ScalatraKernel
  48. def isDevelopmentMode : Boolean

    definition classes: ScalatraKernel
  49. def isInstanceOf [T0] : Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

    This method is used to test whether the dynamic type of the receiver object is T0.

    Note that the test result of the test is modulo Scala's erasure semantics. Therefore the expression1.isInstanceOf[String] will return false, while the expression List(1).isInstanceOf[List[String]] will return true. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested typed.

    returns

    true if the receiver object is an instance of erasure of type T0; false otherwise.

    attributes: final
    definition classes: Any
  50. def methodNotAllowed (f: (Set[HttpMethod]) ⇒ Any) : Unit

    Defines a block to run if matching routes are found only for other methods.

    Defines a block to run if matching routes are found only for other methods. The set of matching methods is passed to the block.

    definition classes: ScalatraKernelCoreDsl
  51. def multiParams : MultiParams

    A multi-map of the current parameters.

    A multi-map of the current parameters. Parameters may come from: - the query string - the POST body - the route matchers of the currently executing route

    The map has a default value of Seq.empty.

    definition classes: ScalatraKernelCoreDsl
  52. def ne (arg0: AnyRef) : Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

    o.ne(arg0) is the same as !(o.eq(arg0)).

    arg0

    the object to compare against this object for reference dis-equality.

    returns

    false if the argument is not a reference to the receiver object; true otherwise.

    attributes: final
    definition classes: AnyRef
  53. def notFound (fun: ⇒ Any) : Unit

    Defines a block to run if no matching routes are found, or if all matching routes pass.

    Defines a block to run if no matching routes are found, or if all matching routes pass.

    definition classes: ScalatraKernelCoreDsl
  54. def notify () : Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    attributes: final
    definition classes: AnyRef
  55. def notifyAll () : Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    attributes: final
    definition classes: AnyRef
  56. def options (routeMatchers: RouteMatcher*)(action: ⇒ Any) : Route

    definition classes: ScalatraKernelCoreDsl
      see also:
    1. org.scalatra.ScalatraKernel.get

  57. def params : MultiMapHeadView[String, String] with MapWithIndifferentAccess[String]

    A map of the current parameters.

    A map of the current parameters. The map contains the head of every non-empty value in multiParams.

    definition classes: ScalatraKernelCoreDsl
  58. def pass () : Nothing

    Immediately passes execution to the next matching route.

    Immediately passes execution to the next matching route.

    definition classes: ScalatraKernelCoreDsl
  59. def patch (routeMatchers: RouteMatcher*)(action: ⇒ Any) : Route

    definition classes: ScalatraKernelCoreDsl
      see also:
    1. org.scalatra.ScalatraKernel.get

  60. implicit def pathPatternParser2RouteMatcher (pattern: PathPattern) : RouteMatcher

    Path pattern is decoupled from requests.

    Path pattern is decoupled from requests. This adapts the PathPattern to a RouteMatcher by supplying the request path.

    attributes: protected implicit
    definition classes: ScalatraKernel
  61. def post (routeMatchers: RouteMatcher*)(action: ⇒ Any) : Route

    definition classes: ScalatraKernelCoreDsl
      see also:
    1. get

  62. def put (routeMatchers: RouteMatcher*)(action: ⇒ Any) : Route

    definition classes: ScalatraKernelCoreDsl
      see also:
    1. get

  63. def redirect (uri: String) : Unit

    Sends a redirect response.

    Sends a redirect response.

    definition classes: CoreDsl
  64. implicit def regex2RouteMatcher (regex: Regex) : RouteMatcher

    attributes: protected implicit
    definition classes: ScalatraKernel
  65. def removeRoute (method: String, route: Route) : Unit

    attributes: protected
    definition classes: ScalatraKernel
  66. def removeRoute (method: HttpMethod, route: Route) : Unit

    removes _all_ the actions of a given route for a given HTTP method.

    removes _all_ the actions of a given route for a given HTTP method. If addRoute is overriden this should probably be overriden too.

    attributes: protected
    definition classes: ScalatraKernel
      see also:
    1. org.scalatra.ScalatraKernel.addRoute

  67. def renderPipeline : RenderPipeline

    The render pipeline is a partial function of Any => Any.

    The render pipeline is a partial function of Any => Any. It is called recursively until it returns (). () indicates that the response has been rendered.

    attributes: protected
    definition classes: ScalatraKernel
  68. def renderResponse (actionResult: Any) : Unit

    attributes: protected
    definition classes: ScalatraKernel
  69. def renderResponseBody (actionResult: Any) : Unit

    attributes: protected
    definition classes: ScalatraKernel
  70. implicit def request : HttpServletRequest

    The current request

    The current request

    attributes: implicit
    definition classes: ScalatraKernelCoreDsl
  71. def requestPath : String

    definition classes: ScalatraFilterScalatraKernel
  72. implicit def requestWrapper (r: HttpServletRequest) : RichRequest

    attributes: implicit
    definition classes: ServletApiImplicits
  73. implicit def response : HttpServletResponse

    The current response.

    The current response.

    attributes: implicit
    definition classes: ScalatraKernelCoreDsl
  74. lazy val routes : RouteRegistry

    attributes: protected
    definition classes: ScalatraKernel
  75. def runFilters (filters: Traversable[Route]) : Unit

    attributes: protected
    definition classes: ScalatraKernel
  76. def runRoutes (routes: Traversable[Route]) : Stream[Any]

    attributes: protected
    definition classes: ScalatraKernel
  77. var servletContext : ServletContext

    The current servlet context

    The current servlet context

    definition classes: ScalatraFilterScalatraKernelCoreDsl
  78. implicit def servletContextWrapper (sc: ServletContext) : RichServletContext

    attributes: implicit
    definition classes: ServletApiImplicits
  79. implicit def session : HttpSession

    The current HTTP session.

    The current HTTP session. Creates a session if none exists.

    attributes: implicit
    definition classes: CoreDsl
  80. def sessionOption : Option[HttpSession]

    The current HTTP session.

    The current HTTP session. If none exists, None is returned.

    definition classes: CoreDsl
  81. implicit def sessionWrapper (s: HttpSession) : RichSession

    attributes: implicit
    definition classes: ServletApiImplicits
  82. def status (code: Int) : Unit

    Sets the status code of the current response.

    Sets the status code of the current response.

    definition classes: CoreDsl
  83. implicit def string2RouteMatcher (path: String) : RouteMatcher

    Pluggable way to convert Strings into RouteMatchers.

    Pluggable way to convert Strings into RouteMatchers. By default, we interpret them the same way Sinatra does.

    attributes: protected implicit
    definition classes: ScalatraKernel
  84. def synchronized [T0] (arg0: T0) : T0

    attributes: final
    definition classes: AnyRef
  85. def toString () : String

    Returns a string representation of the object.

    Returns a string representation of the object.

    The default representation is platform dependent.

    returns

    a string representation of the object.

    definition classes: AnyRef → Any
  86. def wait () : Unit

    attributes: final
    definition classes: AnyRef
  87. def wait (arg0: Long, arg1: Int) : Unit

    attributes: final
    definition classes: AnyRef
  88. def wait (arg0: Long) : Unit

    attributes: final
    definition classes: AnyRef
  89. def withRouteMultiParams [S] (matchedRoute: Option[MatchedRoute])(thunk: ⇒ S) : S

    attributes: protected
    definition classes: ScalatraKernel

Inherited from ScalatraKernel

Inherited from ServletApiImplicits

Inherited from Initializable

Inherited from CoreDsl

Inherited from Handler

Inherited from Filter

Inherited from AnyRef

Inherited from Any