JSONP filter for Play framework
Scala
Latest commit 27adf45 Jun 16, 2014 @julienrf fix readme
Permalink
Failed to load latest commit information.
project Merge branch 'play2.3' of github.com:xolvo/play-jsonp-filter into xol… Jun 16, 2014
src Merge branch 'play2.3' of github.com:xolvo/play-jsonp-filter into xol… Jun 16, 2014
.gitignore
LICENSE v1.1 Jun 16, 2014
README.md fix readme Jun 16, 2014
build.sbt Merge branch 'play2.3' of github.com:xolvo/play-jsonp-filter into xol… Jun 16, 2014

README.md

JSONP filter for Play! framework

This filter enables JSONP on your existing API: any resource that returns a JSON content will return a JavaScript fragment if there is an additional callback parameter in the query string.

For example, if the resource /foo gives the following JSON result: {"foo": "bar"}, the resource /foo?callback=f will give the following JavaScript result: f({"foo": "bar"});.

Installation

Add the following dependency to your build definition:

libraryDependencies += "org.julienrf" %% "play-jsonp-filter" % "1.2"

The 1.2 version is compatible with Play 2.3.x.

Usage

Add the julienrf.play.jsonp.Jsonp filter to your Global object:

import play.api.mvc.WithFilters
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import julienrf.play.jsonp.Jsonp

object Global extends WithFilters(new Jsonp)

See the API documentation for more information on the parameters you can pass to the Jsonp constructor.

Changelog

  • v1.2: support for Play 2.3.x ;
  • v1.1: support for Play 2.2.x.

License

This content is released under the MIT License.