Question

I am making a Web service call from Java Play framework. Below is the code.

WS.url(url).get().map(
    new F.Function<WS.Response, Result>() {
         @Override
         public Result apply(WS.Response response) throws Throwable {
              return ok(response.getBody())
         }
    }
);

How do I return the content type as the content type of the WS.Response ?

Was it helpful?

Solution

I think it should be:

     @Override
     public Result apply(WS.Response response) throws Throwable {
          return ok(response.getBody()).as(response.getHeader("Content-Type"));
     }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top