Frage

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 ?

War es hilfreich?

Lösung

I think it should be:

     @Override
     public Result apply(WS.Response response) throws Throwable {
          return ok(response.getBody()).as(response.getHeader("Content-Type"));
     }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top