Hi, I think I’m almost done with Play upgrade 2.4.6 to 2.6.21. Problem I’m facing right now is with WSResponse
.
First, in Play 2.4 we used to hit the node server for view and process it like:
for
GET / controllers.Application.developmentRouterIndex
we had
if (environment.mode.equals(Mode.Dev))
Action.async {
val response = wSClient.url("http://localhost:8080/").get()
response.map { res =>
Ok(res.body).withHeaders((CONTENT_TYPE, MimeTypes.HTML))
}
}
else controllers.Assets.versioned("/public/www", Asset("index.html"))
and things were loading perfectly on http://localhost:9000/
.
But after upgrade, it is giving below warning and not loading the assets correctly.
2019-01-23 18:35:40 [WARN] from akka.actor.ActorSystemImpl - Explicitly set HTTP header 'Content-Type: text/html' is ignored, explicit `Content-Type` header is not allowed. Set `HttpResponse.entity.contentType` instead.
2019-01-23 18:35:40 [WARN] from akka.actor.ActorSystemImpl - Explicitly set HTTP header 'Content-Type: text/html; charset=UTF-8' is ignored, explicit `Content-Type` header is not allowed. Set `HttpResponse.entity.contentType` instead.
2019-01-23 18:35:40 [WARN] from akka.actor.ActorSystemImpl - Explicitly set HTTP header 'Content-Length: 150' is ignored, explicit `Content-Length` header is not allowed. Use the appropriate HttpEntity subtype.
And only the index.html
plain text is getting displayed. Means, it is working but not able to bootstrap things.
I’m not able to figure the Gap, I know the static way of Assets
and ExternalAssets
is deprecated, but it can still be used right? So I’ll need to discuss this with you (experts).
On the previous version it also loaded a lot other resources like shown in the picture.
Why it is not loading these resources in the newer version, is there some different way to implement this in the newer Play?