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
A route matcher on a boolean condition.
A route matcher on a boolean condition. Does not extract any route parameters.
Represents an HTTP content encoding.
Scalatra handler for gzipped responses.
Represents the value of a content negotiation header.
A collection of methods that affect the control flow of routes.
The core Scalatra DSL.
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 with prepareCsrfToken
.
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
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.
FlashMapSupport
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")) }
FlashMap
An action and the multi-map of route parameters to invoke it with.
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.
A path pattern optionally matches a request path and extracts path parameters.
Parses a string into a path pattern for routing.
Path pattern parser based on Rack::Mount::Strexp, which is used by Rails.
An implementation of Rails' path pattern syntax
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.
A route matcher from which a URI can be generated from route parameters.
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.
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.
The base implementation of the Scalatra DSL.
The base implementation of the Scalatra DSL. Intended to be portable to all supported backends.
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.
ScalatraServlet
Add some implicits
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
ScalatraFilter
This trait provides session support for stateful applications.
A Sinatra-compatible route path pattern parser.
An implementation of Sinatra's path pattern syntax.
Redirects unsecured requests to the corresponding secure URL.
Adds support for generating URIs from routes and their params.
Defines type classes and helper methods for well known content-negotiation headers.
Immediately halts processing of a request.
Immediately halts processing of a request. Can be called from either a before filter or a route.
the status to set on the response, or null to leave the status unchanged.
a result to render through the render pipeline as the body
headers to add to the response
Immediately exits from the current route.
Immediately exits from the current route.