Felix
Felix

Reputation: 5629

remove route listing in playframework

Playframework displays a whole list of all available routes if you call a wrong route. that looks like that:

enter image description here

Is there a way to deactivate this listing?

Thanks in advance.

Upvotes: 1

Views: 83

Answers (2)

Andriy Kuba
Andriy Kuba

Reputation: 8263

It does this only in the development mode, it's for easy debugging.

In the production mode, the list would be empty.

Upvotes: 2

vkt
vkt

Reputation: 1459

Play provides the default error handling mechanism

You can override the onClientError

   override def onClientError(request: RequestHeader, statusCode: Int, message: String): Future[Result] =
    statusCode match {

      case NOT_FOUND =>
        Future.successful {
          NotFound(Json.obj("error" -> s"Resource  ${request.uri} is invalid"))//or whatever error message you want.
        }
    }

Upvotes: 1

Related Questions