linkedin / play-restli   0.1.17

BSD 2-clause "Simplified" License GitHub

A library that simplifies building restli services on top of the play server.

Scala versions: 2.12 2.11

Play ❤️ ️ Build Status Latest Version

Use the Play Framework as the backend for your service with play-restli!


Add play-restli to your plugin dependencies along with play and sbt-restli:

// project/plugins.sbt
addSbtPlugin("" % "sbt-play-restli" % "<version>")
addSbtPlugin("com.linkedin.sbt-restli" % "sbt-restli" % "<version>")
addSbtPlugin("" % "sbt-plugin" % "<version>")


See sbt-restli for detailed instructions on setting up a project using sbt.

Apply your preferred play plugin (PlayService, PlayJava, or PlayScala) to your server project alongside the RestliModelPlugin.

PlayService is a minimal play plugin delivered with play 2.6.8+, and is the recommended plugin for use with play-restli. If you choose to use one of other play plugins, we recommend disabling PlayLayoutPlugin in order to use the standard Maven project structure.

Finally, create the play configuration file (src/main/resources/application.conf if using the default Maven structure (recommended), or conf/application.conf if using play structure) and specify the list of packages which contain resources.

restli.resourcePackages = ["com.example.fortune.impl"]

Advanced Configuration

Play-restli allows you to fully configure through your play application.conf. All values shown are defaults, only restli.resourcePackages is required.

restli {
  # List of packages containing resources.
  resourcePackages = []
  # Maximum request body size (non-streaming).
  memoryThresholdBytes = 1G
  # Stream request/response bodies.
  useStream = false

  # Apply filters outside the play context path (play.http.context).
  applyFiltersGlobally = false

  rest {
    # List of RestFilters to apply to each request and response.
    filters = []
    # RestliServerApi implementation. Converts play requests to requests.
    server = ""
  stream {
    # List of StreamFilters to apply to each streaming request and response.
    filters = []
    # RestliServerStreamApi implementation. Converts play requests to requests.
    server = ""
  # ResourceFactory implementation. Factory which instantiates resources. 
  # Default resource factory delegates to the play injector.
  resourceFactory = ""
  # RestliConfigProvider implementation. Creates the configuration. 
  # Default provider adds resource packages from the "restli.resourcePackages" setting. 
  configProvider = ""
  # EngineProvider implementation. Creates the ParSeq engine.
  # Default provider creates an engine with numCores + 1 execution threads, and a 
  # single thread for timer scheduling.
  engineProvider = ""

  # HttpDispatcherProvider implementation. Creates the HttpDispatcher.
  # Default provider uses the config, resource factory, engine, and filters defined above.
  httpDispatcherProvider = ""


Note: If you copy-paste an example, make sure to specify the play-restli version in project/plugins.sbt.

Complete examples are located in the plugin sbt-test directory.

  • Restli-structure-play-service uses the recommended approach, leveraging the recently introduced PlayService plugin.
  • Restli-structure-play-java uses the PlayJava plugin, but disables PlayLayoutPlugin in order to use the standard project structure. If using scala, PlayScala can be used instead.
  • Play-structure uses the PlayJava plugin, but does not disable PlayLayoutPlugin, thus using the default play project structure. This is unidiomatic for a service, but is nevertheless supported.