package scalatra
- Alphabetic
- By Inheritance
- scalatra
- Control
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type Action = () => Any
- case class ActionResult(status: Int, body: Any, headers: Map[String, String]) extends Product with Serializable
- trait ApiFormats extends ScalatraBase
Adds support for mapping and inferring formats to content types.
Adds support for mapping and inferring formats to content types.
$ - Provides a request-scoped format variable $ - Maps formats to content types and vice versa $ - Augments the content-type inferrer to use the format
- abstract class AsyncResult extends ScalatraContext
- final class BooleanBlockRouteMatcher extends RouteMatcher
A route matcher on a boolean condition.
A route matcher on a boolean condition. Does not extract any route parameters.
- trait ContentEncoding extends AnyRef
Represents an HTTP content encoding.
- trait ContentEncodingSupport extends Handler
Scalatra handler for gzipped responses.
- case class ContentNegotiation[T](value: T, q: Float = 1) extends Product with Serializable
Represents the value of a content negotiation header.
- type ContentTypeInferrer = PartialFunction[Any, String]
- trait Control extends AnyRef
A collection of methods that affect the control flow of routes.
- case class Cookie(name: String, value: String)(implicit cookieOptions: CookieOptions = CookieOptions()) extends Product with Serializable
- trait CookieContext extends AnyRef
- case class CookieOptions(domain: String = "", path: String = "", maxAge: Int = -1, secure: Boolean = false, comment: String = "", httpOnly: Boolean = false, version: Int = 0, encoding: String = "UTF-8") extends Product with Serializable
- trait CoreDsl extends Handler with Control with ScalatraContext with ServletApiImplicits
The core Scalatra DSL.
- type CoreStack = CorsSupport with FutureSupport with FlashMapSupport
- type CoreStackNoFlash = CorsSupport with FutureSupport
- type CoreStackNoFlashWithCsrf = CoreStackNoFlash with CsrfTokenSupport
- type CoreStackNoFlashWithXsrf = CoreStackNoFlash with XsrfTokenSupport
- type CoreStackWithCsrf = CoreStack with CsrfTokenSupport
- type CoreStackWithXsrf = CoreStack with XsrfTokenSupport
- trait CorsSupport extends Handler with Initializable
- trait CsrfTokenSupport extends AnyRef
Provides cross-site request forgery protection.
Provides cross-site request forgery protection.
Adds a before filter. If a request is determined to be forged, the
handleForgery()hook is invoked. Otherwise, a token for the next request is prepared withprepareCsrfToken. - trait DynamicScope extends RequestResponseScope
The Scalatra DSL requires a dynamically scoped request and response.
- type ErrorHandler = PartialFunction[Throwable, Any]
- case class ExtensionMethod(name: String) extends HttpMethod with Product with Serializable
- type FileUploadStack = FutureSupport with FlashMapSupport with FileUploadSupport
- class FlashMap extends Serializable
A FlashMap is the data structure used by org.scalatra.FlashMapSupport to allow passing temporary values between sequential actions.
A FlashMap is the data structure used by org.scalatra.FlashMapSupport to allow passing temporary values between sequential actions.
As of Scalatra 2.7.x, it does not directly inherit Map.
- See also
FlashMapSupport
- trait FlashMapSupport extends Handler
Allows an action to set key-value pairs in a transient state that is accessible only to the next action and is expired immediately after that.
Allows an action to set key-value pairs in a transient state that is accessible only to the next action and is expired immediately after that. This is especially useful when using the POST-REDIRECT-GET pattern to trace the result of an operation.
post("/article/create") { // create session flash("notice") = "article created successfully" redirect("/home") } get("/home") { // this will access the value set in previous action stuff_with(flash("notice")) }
- See also
FlashMap
- type FullCoreStack = CoreStack with FileUploadSupport
- trait FutureSupport extends AsyncSupport
- type FuturesAndFlashStack = FutureSupport with FlashMapSupport
- type FuturesAndFlashStackWithCsrf = FuturesAndFlashStack with CsrfTokenSupport
- type FuturesAndFlashStackWithXsrf = FuturesAndFlashStack with XsrfTokenSupport
- case class HaltException(status: Option[Int], headers: Map[String, String], body: Any) extends Throwable with NoStackTrace with Product with Serializable
- sealed trait HttpMethod extends AnyRef
- abstract class HttpVersion extends Ordered[HttpVersion]
- trait LifeCycle extends ServletApiImplicits
- case class MatchedRoute(action: Action, multiParams: MultiParams) extends Product with Serializable
An action and the multi-map of route parameters to invoke it with.
- trait MethodOverride extends Handler with ServletApiImplicits
Mixin for clients that only support a limited set of HTTP verbs.
Mixin for clients that only support a limited set of HTTP verbs. If the request is a POST and the
_methodrequest parameter is set, the value of the_methodparameter is treated as the request's method. - type MultiParams = Map[String, Seq[String]]
- type Params = MultiMapHeadView[String, String]
- class PassException extends Throwable with NoStackTrace
- case class PathPattern(regex: Regex, captureGroupNames: List[String] = Nil) extends Product with Serializable
A path pattern optionally matches a request path and extracts path parameters.
- trait PathPatternParser extends AnyRef
Parses a string into a path pattern for routing.
- final class PathPatternRouteMatcher extends RouteMatcher
- class RailsPathPatternParser extends RegexPathPatternParser
Path pattern parser based on Rack::Mount::Strexp, which is used by Rails.
- final class RailsRouteMatcher extends RouteMatcher with ReversibleRouteMatcher
An implementation of Rails' path pattern syntax
- trait RegexPathPatternParser extends PathPatternParser with RegexParsers
- final class RegexRouteMatcher extends RouteMatcher
A route matcher for regular expressions.
A route matcher for regular expressions. Useful for cases that are more complex than are supported by Sinatra- or Rails-style routes.
- type RenderPipeline = PartialFunction[Any, Any]
- trait RequestResponseScope extends AnyRef
- trait ReversibleRouteMatcher extends AnyRef
A route matcher from which a URI can be generated from route parameters.
- case class Route(routeMatchers: Seq[RouteMatcher] = Seq.empty, action: Action, contextPath: (HttpServletRequest) => String = _ => "", metadata: Map[Symbol, Any] = Map.empty) extends Product with Serializable
A route is a set of matchers and an action.
A route is a set of matchers and an action. A route is considered to match if all of its route matchers return Some. If a route matches, its action may be invoked. The route parameters extracted by the matchers are made available to the action.
- trait RouteMatcher extends RouteTransformer
A route matcher is evaluated in the context it was created and returns a a (possibly empty) multi-map of parameters if the route is deemed to match.
- class RouteRegistry extends AnyRef
- trait RouteTransformer extends AnyRef
- trait ScalatraBase extends ScalatraContext with CoreDsl with DynamicScope with Initializable with ServletApiImplicits with ScalatraParamsImplicits with DefaultImplicitConversions with SessionSupport
The base implementation of the Scalatra DSL.
The base implementation of the Scalatra DSL. Intended to be portable to all supported backends.
- trait ScalatraContext extends ServletApiImplicits with SessionSupport with CookieContext
- class ScalatraException extends Exception
- trait ScalatraFilter extends Filter with ServletBase
An implementation of the Scalatra DSL in a filter.
An implementation of the Scalatra DSL in a filter. You may prefer a filter to a ScalatraServlet if:
$ - you are sharing a URL space with another servlet or filter and want to delegate unmatched requests. This is very useful when migrating legacy applications one page or resource at a time.
Unlike a ScalatraServlet, does not send 404 or 405 errors on non-matching routes. Instead, it delegates to the filter chain.
If in doubt, extend ScalatraServlet instead.
- See also
ScalatraServlet
- class ScalatraParams extends MultiMapHeadView[String, String]
- trait ScalatraParamsImplicits extends AnyRef
Add some implicits
- trait ScalatraServlet extends HttpServlet with ServletBase with Initializable
An implementation of the Scalatra DSL in a servlet.
An implementation of the Scalatra DSL in a servlet. This is the recommended base trait for most Scalatra applications. Use a servlet if:
$ - your Scalatra routes run in a subcontext of your web application. $ - you want Scalatra to have complete control of unmatched requests. $ - you think you want a filter just for serving static content with the default servlet; ScalatraServlet can do this too $ - you don't know the difference
- See also
ScalatraFilter
- sealed trait Scheme extends AnyRef
- trait SessionSupport extends AnyRef
This trait provides session support for stateful applications.
- class SinatraPathPatternParser extends RegexPathPatternParser
A Sinatra-compatible route path pattern parser.
- final class SinatraRouteMatcher extends RouteMatcher with ReversibleRouteMatcher
An implementation of Sinatra's path pattern syntax.
- trait SslRequirement extends Handler with ServletApiImplicits
Redirects unsecured requests to the corresponding secure URL.
- final class StatusCodeRouteMatcher extends RouteMatcher
- class SweetCookies extends ServletApiImplicits
- trait UrlGeneratorSupport extends AnyRef
Adds support for generating URIs from routes and their params.
- trait XsrfTokenSupport extends AnyRef
Value Members
- val EnvironmentKey: String
- val MultiParamsKey: String
- def halt(result: ActionResult): Nothing
- Definition Classes
- Control
- def halt[T](status: Integer = null, body: T = (), headers: Map[String, String] = Map.empty): 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
- Definition Classes
- Control
- def pass(): Nothing
Immediately exits from the current route.
Immediately exits from the current route.
- Definition Classes
- Control
- object Accepted
- object AlreadyReported
- object ApiFormats
- object BadGateway
- object BadRequest
- object Conflict
- case object Connect extends HttpMethod with Product with Serializable
- object ContentEncoding
- object ContentNegotiation extends Serializable
Defines type classes and helper methods for well known content-negotiation headers.
- object Cookie extends Serializable
- object CookieSupport
- object CorsSupport
- object Created
- object CsrfTokenSupport
- case object Delete extends HttpMethod with Product with Serializable
- object ExpectationFailed
- object FailedDependency
- object FlashMapSupport
- object Forbidden
- object Found
- object GatewayTimeout
- object GenerateId
- case object Get extends HttpMethod with Product with Serializable
- object Gone
- object HTTPVersionNotSupported
- case object Head extends HttpMethod with Product with Serializable
- case object Http extends Scheme with Product with Serializable
- object Http10 extends HttpVersion
- object Http11 extends HttpVersion
- object HttpMethod
- case object Https extends Scheme with Product with Serializable
- object IMUsed
- object InsufficientStorage
- object InternalServerError
- object LengthRequired
- object Locked
- object LoopDetected
- object MethodNotAllowed
- object MethodOverride
- object MovedPermanently
- object MultiStatus
- object MultipleChoices
- object NetworkAuthenticationRequired
- object NoContent
- object NonAuthoritativeInformation
- object NotAcceptable
- object NotExtended
- object NotFound
- object NotImplemented
- object NotModified
- object Ok
- case object Options extends HttpMethod with Product with Serializable
- object PartialContent
- case object Patch extends HttpMethod with Product with Serializable
- object PathPatternParser
- object PaymentRequired
- object PermanentRedirect
- case object Post extends HttpMethod with Product with Serializable
- object PreconditionFailed
- object PreconditionRequired
- object ProxyAuthenticationRequired
- case object Put extends HttpMethod with Product with Serializable
- object RailsPathPatternParser
- object RequestEntityTooLarge
- object RequestHeaderFieldsTooLarge
- object RequestTimeout
- object RequestURITooLong
- object RequestedRangeNotSatisfiable
- object ResetContent
- object Route extends Serializable
- object RouteTransformer
- object ScalatraBase
- object ScalatraContext
- object ScalatraParamsImplicits extends ScalatraParamsImplicits with DefaultImplicitConversions
- object SeeOther
- object ServiceUnavailable
- object SinatraPathPatternParser
- object TemporaryRedirect
- object TooManyRequests
- case object Trace extends HttpMethod with Product with Serializable
- object Unauthorized
- object UnprocessableEntity
- object UnsupportedMediaType
- object UpgradeRequired
- object UriDecoder
- object UrlGenerator extends UrlGeneratorSupport
- object UseProxy
- object VariantAlsoNegotiates
- object XsrfTokenSupport