Play-Rest API with Java – basic response


I’m new in the server-side , and I’m trying to learn how to use play in rest api with java and restangular. I made a project for java in the intellij. I want the GET request to return an html page and not html.scala page.
how do I change this function that it will return the app/views/index.html instead the app/views/index.html.scala

also if someone have a good website to learn from, it will help a lot

the function in java :

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public static Result index() {
        return ok(index.render("Your new application is ready."));


the routes page :

# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Home page
GET     /                           controllers.Application.index

# Map static resources from the /public folder to the /assets URL path
GET     /assets/*file     "/public", file)


I found a similar question with good answer with a lot of examples.
you can find it here.
The easiest way is to make a GET request for the / and to send the destination also, like this:

# Home page
GET     /                 "/public",file="index.html") 

Answered By – Ariel Livshits

Answer Checked By – Timothy Miller (AngularFixing Admin)

Leave a Reply

Your email address will not be published.