Alexander Chepurnoy

The Web of Mind

Learn Play! Framework by Example

| Comments

Play! Framework is probably the most popular Web framework for Scala Language(and one of the most popular Web frameworks for Java too). It’s stateless, it’s elegant, it’s a good friend of functional reactive programming.

To learn framework, the site contains very good tutorial, also there are some samples within ‘samples’ folder. And I’m happy to present another option to dive into the framework.

The sample application was developed with aim to test Mechanize Framework, but GistLabs published it as standalone application.

Application contains following examples:

  • Controllers with different response codes: 302 redirect, 302 infinite redirect, 466 code, internal server error with custom message
  • Cookies examples: printing cookies got in request, setting cookie
  • XML examples: simple XML document output and echoing value passed in an input XML document passed with PUT request
  • JSON example: echoing value passed in an input JSON document passed with PUT request
  • Not-Modified example: on first request Etag/Cache-Control headers are sent in response, then Not-Modified result sent
  • Forms: GET/POST forms, POST form with validation
  • Files: single file upload, multiple files upload, POST/PUT/GET service example(create a file with random filename on POST, create a file with specified filename on PUT, then get file with GET request)
  • Auth: login to see secret token, or try to access secret area directly(with redirect to index page)

Pull sources from GitHub and learn Play! by example!

P.S. Next part of the story will be about different Play! sample applications around the Web

Comments