Custom Controller
Create and use a Custom Controller.
The example is based on DemoResultController
from scala-adapters.
By default no Play-Controller is needed. When does it make sense to create a Custom Controller:
- More simple or semantic URLs.
- Provide functionality that is not related to Job Processing.
Constraints
- You have created the project with scala-adapters-g8.
- You have your Custom Page ready (custom-page).
- A basic understanding of Play Controller and -Routes (see Play).
Create a Controller
We will create a Controller to provide the custom-page on the root URL http://localhost:9000
.
Add the Routing
Let’s add the Route in conf/routes
:
Now we use for / our Controller, everything else is still delegated to the adapters.Routes
.
Check Result
Running the Project and running the Job,
should give you now your Custom page on http://localhost:9000
.