Packages

  • package root
    Definition Classes
    root
  • package play

    Play framework.

    Play framework.

    Play

    http://www.playframework.com

    Definition Classes
    root
  • package api

    Contains the public API for Scala developers.

    Contains the public API for Scala developers.

    Access the current Play application
    import play.api.Play.current
    Read configuration
    val poolSize = configuration.getInt("engine.pool.size")
    Use the logger
    Logger.info("Hello!")
    Define a Plugin
    class MyPlugin(app: Application) extends Plugin
    Create adhoc applications (for testing)
    val application = Application(new File("."), this.getClass.getClassloader, None, Play.Mode.DEV)
    Definition Classes
    play
  • package routing
    Definition Classes
    api
  • package sird

    The Play "String Interpolating Routing DSL", sird for short.

    The Play "String Interpolating Routing DSL", sird for short.

    This provides: - Extractors for requests that extract requests by method, eg GET, POST etc. - A string interpolating path extractor - Extractors for binding parameters from paths to various types, eg int, long, double, bool.

    The request method extractors return the original request for further extraction.

    The path extractor supports three kinds of extracted values: - Path segment values. This is the default, eg p"/foo/$id". The value will be URI decoded, and may not traverse /'s. - Full path values. This can be indicated by post fixing the value with a *, eg p"/assets/$path*". The value will not be URI decoded, as that will make it impossible to distinguish between / and %2F. - Regex values. This can be indicated by post fixing the value with a regular expression enclosed in angle brackets. For example, p"/foo/$id<[0-9]+>. The value will not be URI decoded.

    The extractors for primitive types are merely provided for convenience, for example, p"/foo/${int(id)}" will extract id as an integer. If id is not an integer, the match will simply fail.

    Example usage:

    import play.api.routing.sird._
    import play.api.routing._
    import play.api.mvc._
    
    Router.from {
      case GET(p"/hello/$to") => Action {
        Results.Ok(s"Hello $to")
      }
      case PUT(p"/api/items/${int(id)}") => Action.async { req =>
        Items.save(id, req.body.json.as[Item]).map { _ =>
          Results.Ok(s"Saved item $id")
        }
      }
    }
    Definition Classes
    routing
  • &
  • OptionalQueryStringParameter
  • PathBindableExtractor
  • PathBindableExtractors
  • PathExtractor
  • QueryStringParameterExtractor
  • RequestMethodExtractor
  • RequestMethodExtractors
  • RequiredQueryStringParameter
  • SeqQueryStringParameter
  • UrlContext

package sird

The Play "String Interpolating Routing DSL", sird for short.

This provides: - Extractors for requests that extract requests by method, eg GET, POST etc. - A string interpolating path extractor - Extractors for binding parameters from paths to various types, eg int, long, double, bool.

The request method extractors return the original request for further extraction.

The path extractor supports three kinds of extracted values: - Path segment values. This is the default, eg p"/foo/$id". The value will be URI decoded, and may not traverse /'s. - Full path values. This can be indicated by post fixing the value with a *, eg p"/assets/$path*". The value will not be URI decoded, as that will make it impossible to distinguish between / and %2F. - Regex values. This can be indicated by post fixing the value with a regular expression enclosed in angle brackets. For example, p"/foo/$id<[0-9]+>. The value will not be URI decoded.

The extractors for primitive types are merely provided for convenience, for example, p"/foo/${int(id)}" will extract id as an integer. If id is not an integer, the match will simply fail.

Example usage:

import play.api.routing.sird._
import play.api.routing._
import play.api.mvc._

Router.from {
  case GET(p"/hello/$to") => Action {
    Results.Ok(s"Hello $to")
  }
  case PUT(p"/api/items/${int(id)}") => Action.async { req =>
    Items.save(id, req.body.json.as[Item]).map { _ =>
      Results.Ok(s"Saved item $id")
    }
  }
}
Source
package.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. sird
  2. PathBindableExtractors
  3. RequestMethodExtractors
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class OptionalQueryStringParameter extends QueryStringParameterExtractor[Option[String]]
  2. class PathBindableExtractor[T] extends AnyRef

    An extractor that extracts from a String using a play.api.mvc.PathBindable.

  3. trait PathBindableExtractors extends AnyRef

    Extractors that bind types from paths using play.api.mvc.PathBindable.

  4. class PathExtractor extends AnyRef

    The path extractor.

    The path extractor.

    Supported data types that can be extracted from:

    • play.api.mvc.RequestHeader
    • String
    • java.net.URI
    • java.net.URL
  5. type QueryString = Map[String, Seq[String]]

    The query string type

  6. trait QueryStringParameterExtractor[T] extends AnyRef
  7. class RequestMethodExtractor extends AnyRef

    An extractor that extracts requests by method.

  8. trait RequestMethodExtractors extends AnyRef

    Extractors that extract requests by method.

  9. class RequiredQueryStringParameter extends QueryStringParameterExtractor[String]
  10. class SeqQueryStringParameter extends QueryStringParameterExtractor[Seq[String]]
  11. implicit class UrlContext extends AnyRef

Value Members

  1. val ?: &.type

    Same as &, but for convenience to make the dsl look nicer when extracting query strings

  2. val DELETE: RequestMethodExtractor

    Extracts a DELETE request.

    Extracts a DELETE request.

    Definition Classes
    RequestMethodExtractors
  3. val GET: RequestMethodExtractor

    Extracts a GET request.

    Extracts a GET request.

    Definition Classes
    RequestMethodExtractors
  4. val HEAD: RequestMethodExtractor

    Extracts a HEAD request.

    Extracts a HEAD request.

    Definition Classes
    RequestMethodExtractors
  5. val OPTIONS: RequestMethodExtractor

    Extracts an OPTIONS request.

    Extracts an OPTIONS request.

    Definition Classes
    RequestMethodExtractors
  6. val PATCH: RequestMethodExtractor

    Extracts a PATCH request.

    Extracts a PATCH request.

    Definition Classes
    RequestMethodExtractors
  7. val POST: RequestMethodExtractor

    Extracts a POST request.

    Extracts a POST request.

    Definition Classes
    RequestMethodExtractors
  8. val PUT: RequestMethodExtractor

    Extracts a PUT request.

    Extracts a PUT request.

    Definition Classes
    RequestMethodExtractors
  9. val bool: PathBindableExtractor[Boolean]

    A boolean extractor.

    A boolean extractor.

    Definition Classes
    PathBindableExtractors
  10. val double: PathBindableExtractor[Double]

    A double extractor.

    A double extractor.

    Definition Classes
    PathBindableExtractors
  11. val float: PathBindableExtractor[Float]

    A float extractor.

    A float extractor.

    Definition Classes
    PathBindableExtractors
  12. val int: PathBindableExtractor[Int]

    An int extractor.

    An int extractor.

    Definition Classes
    PathBindableExtractors
  13. val long: PathBindableExtractor[Long]

    A long extractor.

    A long extractor.

    Definition Classes
    PathBindableExtractors
  14. object &

    Allow multiple parameters to be extracted

  15. object PathExtractor
  16. object QueryStringParameterExtractor

Inherited from PathBindableExtractors

Inherited from AnyRef

Inherited from Any

Ungrouped