O'Reilly logo

Play for Java by Nicolas Leroux and Sietse de Kaper

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Controllers—handling HTTP requests

This chapter covers

  • How to use controllers
  • Using action methods and results
  • Using routing to wire URLs to action methods
  • Composing actions with interceptors
  • Using the different scopes

In this chapter we’ll explain in detail one of the key concepts of the Play framework MVC paradigm: the controller. We’ll take a closer look at our warehouse web application and at the same time explain how interaction with a web client works in Play.

We’ll start by explaining controllers, and from there we’ll examine action methods and how we can return results to web clients. We’ll then see how to use routes to link HTTP requests to a controller’s action method. After that, we’ll look at what interceptors ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required