Packages

t

org.scalatra

CoreDsl

trait CoreDsl extends Handler with Control with ScalatraContext with ServletApiImplicits

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CoreDsl
  2. ScalatraContext
  3. CookieContext
  4. SessionSupport
  5. ServletApiImplicits
  6. Control
  7. Handler
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def after(transformers: RouteTransformer*)(block: ⇒ 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.

  2. abstract def before(transformers: RouteTransformer*)(block: ⇒ 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.

  3. abstract def delete(transformers: RouteTransformer*)(block: ⇒ Any): Route

    See also

    get

  4. abstract 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.

  5. abstract def get(transformers: RouteTransformer*)(block: ⇒ Any): Route

    The Scalatra DSL core methods take a list of org.scalatra.RouteMatcher and a block as the action body.

    The Scalatra DSL core methods take a list of org.scalatra.RouteMatcher and 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.ScalatraBase#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 org.scalatra.RouteMatcher, so you can write code naturally.

    get("/", request.getRemoteHost == "127.0.0.1") { "Hello localhost!" }
  6. abstract def handle(request: HttpServletRequest, res: HttpServletResponse): Unit

    Handles a request and writes to the response.

    Handles a request and writes to the response.

    Definition Classes
    Handler
  7. abstract def head(transformers: RouteTransformer*)(block: ⇒ Any): Route

    See also

    head

  8. abstract def methodNotAllowed(block: (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.

  9. abstract def notFound(block: ⇒ Any): Unit

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

  10. abstract def options(transformers: RouteTransformer*)(block: ⇒ Any): Route

    See also

    get

  11. abstract def patch(transformers: RouteTransformer*)(block: ⇒ Any): Route

    See also

    patch

  12. abstract def post(transformers: RouteTransformer*)(block: ⇒ Any): Route

    See also

    get

  13. abstract def put(transformers: RouteTransformer*)(block: ⇒ Any): Route

    See also

    get

  14. implicit abstract def request: HttpServletRequest
    Definition Classes
    ScalatraContext
  15. implicit abstract def response: HttpServletResponse
    Definition Classes
    ScalatraContext
  16. abstract def servletContext: ServletContext
    Definition Classes
    ScalatraContext
  17. abstract def trap(codes: Range)(block: ⇒ Any): Unit

    Error handler for HTTP response status code range.

    Error handler for HTTP response status code range. You can intercept every response code previously specified with #status or even generic 404 error.

      trap(403) {
       "You are not authorized"
      }
    }*

    }}

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def contentType: String

    Gets the content type of the current response.

    Gets the content type of the current response.

    Definition Classes
    ScalatraContext
  7. def contentType_=(contentType: String): Unit

    Sets the content type of the current response.

    Sets the content type of the current response.

    Definition Classes
    ScalatraContext
  8. implicit def cookieOptions: CookieOptions
    Definition Classes
    CookieContext
  9. def cookies(implicit request: HttpServletRequest): SweetCookies
    Definition Classes
    CookieContext
  10. implicit def enrichRequest(request: HttpServletRequest): RichRequest
    Definition Classes
    ServletApiImplicits
  11. implicit def enrichResponse(response: HttpServletResponse): RichResponse
    Definition Classes
    ServletApiImplicits
  12. implicit def enrichServletContext(servletContext: ServletContext): RichServletContext
    Definition Classes
    ServletApiImplicits
  13. implicit def enrichSession(session: HttpSession): RichSession
    Definition Classes
    ServletApiImplicits
  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def format_=(formatValue: String): Unit

    Explicitly sets the request-scoped format.

    Explicitly sets the request-scoped format. This takes precedence over whatever was inferred from the request.

    Definition Classes
    ScalatraContext
  18. def format_=(formatValue: Symbol): Unit

    Explicitly sets the request-scoped format.

    Explicitly sets the request-scoped format. This takes precedence over whatever was inferred from the request.

    Definition Classes
    ScalatraContext
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  20. def halt(result: ActionResult): Nothing
    Definition Classes
    Control
  21. def halt[T](status: Integer = null, body: T = (), headers: Map[String, String] = Map.empty, reason: String = null)(implicit arg0: Manifest[T]): Nothing

    Immediately halts processing of a request.

    Immediately halts processing of a request. Can be called from either a before filter or a route.

    status

    the status to set on the response, or null to leave the status unchanged.

    body

    a result to render through the render pipeline as the body

    headers

    headers to add to the response

    reason

    the HTTP status reason to set, or null to leave unchanged.

    Definition Classes
    Control
  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  27. def pass(): Nothing

    Immediately exits from the current route.

    Immediately exits from the current route.

    Definition Classes
    Control
  28. implicit def scalatraContext: ScalatraContext
    Attributes
    protected[this]
    Definition Classes
    ScalatraContext
  29. def session(key: Symbol)(implicit request: HttpServletRequest): Any
    Definition Classes
    SessionSupport
  30. def session(key: String)(implicit request: HttpServletRequest): Any
    Definition Classes
    SessionSupport
  31. implicit def session(implicit request: HttpServletRequest): HttpSession

    The current session.

    The current session. Creates a session if none exists.

    Definition Classes
    SessionSupport
  32. def sessionOption(implicit request: HttpServletRequest): Option[HttpSession]

    The current session.

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

    Definition Classes
    SessionSupport
  33. def status: Int

    Gets the status code of the current response.

    Gets the status code of the current response.

    Definition Classes
    ScalatraContext
  34. def status_=(code: Int): Unit

    Sets the status code of the current response.

    Sets the status code of the current response.

    Definition Classes
    ScalatraContext
  35. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  36. def toString(): String
    Definition Classes
    AnyRef → Any
  37. def trap(code: Int)(block: ⇒ Any): Unit

    See also

    error

  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def status(code: Int): Unit
    Definition Classes
    ScalatraContext
    Annotations
    @deprecated
    Deprecated

    (Since version 2.1.0) Use status_=(Int) instead

Inherited from ScalatraContext

Inherited from CookieContext

Inherited from SessionSupport

Inherited from ServletApiImplicits

Inherited from Control

Inherited from Handler

Inherited from AnyRef

Inherited from Any

Ungrouped