package scalatra
- Alphabetic
- By Inheritance
- scalatra
- Control
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type Action = () => Any
- case class ActionResult(status: ResponseStatus, 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.
- 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 DefaultValue[Z] extends AnyRef
A DefaultValue in type Z provides a default value for a given type Z
A DefaultValue in type Z provides a default value for a given type Z
- Annotations
- @implicitNotFound("No default value found for type ${Z}. Try to implement an implicit org.scalatra.DefaultValue for this type.")
- trait DefaultValueImplicits extends AnyRef
- trait DefaultValueMethods extends AnyRef
- trait DefaultValues extends DefaultValueMethods with DefaultValueImplicits
- trait DynamicScope extends RequestResponseScope
The Scalatra DSL requires a dynamically scoped request and response.
The Scalatra DSL requires a dynamically scoped request and response. This trick is explained in greater detail in Gabriele Renzi's blog post about Step, out of which Scalatra grew:
http://www.riffraff.info/2009/4/11/step-a-scala-web-picoframework
- 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 MutableMapWithIndifferentAccess[Any] with 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.
FlashMap behaves like org.scalatra.util.MapWithIndifferentAccess. By default, anything placed in the map is available to the current request and next request, and is then discarded.
- 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
- trait GZipSupport extends Handler
Scalatra handler for gzipped responses.
- trait Handler extends AnyRef
A
Handler
is the Scalatra abstraction for an object that operates on a request/response pair. - sealed trait HttpMethod extends AnyRef
- abstract class HttpVersion extends Ordered[HttpVersion]
- trait Initializable extends AnyRef
Trait representing an object that can't be fully initialized by its constructor.
Trait representing an object that can't be fully initialized by its constructor. Useful for unifying the initialization process of an HttpServlet and a Filter.
- 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
_method
request parameter is set, the value of the_method
parameter is treated as the request's method. - type MultiParams = MultiMap
- type Params = MultiMapHeadView[String, String] with MapWithIndifferentAccess[String]
- 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
- case class ResponseStatus(code: Int, message: String) extends Ordered[ResponseStatus] with Product with Serializable
- 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 with CookieSupport
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] with MapWithIndifferentAccess[String]
- trait ScalatraParamsImplicits extends AnyRef
Add some implicits
- abstract class 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 class 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
Deprecated Type Members
- trait CookieSupport extends AnyRef
- Annotations
- @deprecated
- Deprecated
(Since version 2.2) You can remove this mixin, it's included in core by default
- trait GetResponseStatusSupport extends AnyRef
- Annotations
- @deprecated
- Deprecated
(Since version 2.1.0) No longer necessary after upgrade to Servlet 3.0
- type ScalatraKernel = ServletBase
- Annotations
- @deprecated
- Deprecated
(Since version 2.1.0) Use org.scalatra.servlet.ServletBase if you depend on the Servlet API, or org.scalatra.ScalatraBase if you don't.
- trait TypedParamSupport extends ScalatraBase
- Annotations
- @deprecated
- Deprecated
(Since version 2.2) This got folded into core, so you can remove the TypeParamSupport trait safely.
- trait UrlSupport extends AnyRef
Provides utility methods for the creation of URL strings.
Provides utility methods for the creation of URL strings. Supports context-relative and session-aware URLs. Should behave similarly to JSTL's <c:url> tag.
- Annotations
- @deprecated
- Deprecated
(Since version 2.1.0) This functionality has been subsumed by ScalatraBase.
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, 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
- 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
- object Connect extends HttpMethod with Product with Serializable
- object Cookie extends Serializable
- object CookieSupport
- object CorsSupport
- object Created
- object CsrfTokenSupport
- object DefaultValueMethods extends DefaultValueMethods
- object DefaultValues extends DefaultValues
- object Delete extends HttpMethod with Product with Serializable
- object ExpectationFailed
- object FailedDependency
- object FlashMapSupport
- object Forbidden
- object Found
- object GatewayTimeout
- object GenerateId
- object Get extends HttpMethod with Product with Serializable
- object Gone
- object HTTPVersionNotSupported
- object Head extends HttpMethod with Product with Serializable
- object Http extends Scheme with Product with Serializable
- object Http10 extends HttpVersion
- object Http11 extends HttpVersion
- object HttpMethod
- 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
- object Options extends HttpMethod with Product with Serializable
- object PartialContent
- object Patch extends HttpMethod with Product with Serializable
- object PathPatternParser
- object PaymentRequired
- object PermanentRedirect
- object Post extends HttpMethod with Product with Serializable
- object PreconditionFailed
- object PreconditionRequired
- object ProxyAuthenticationRequired
- object Put extends HttpMethod with Product with Serializable
- object RailsPathPatternParser
- object RequestEntityTooLarge
- object RequestHeaderFieldsTooLarge
- object RequestTimeout
- object RequestURITooLong
- object RequestedRangeNotSatisfiable
- object ResetContent
- object ResponseStatus extends Serializable
- object Route extends Serializable
- object RouteTransformer
- object ScalatraBase
- object ScalatraContext
- object ScalatraKernel
- object ScalatraParamsImplicits extends ScalatraParamsImplicits with DefaultImplicitConversions
- object ScalatraServlet extends Serializable
- object SeeOther
- object ServiceUnavailable
- object SinatraPathPatternParser
- object TemporaryRedirect
- object TooManyRequests
- 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