I'm trying to send clients a 303 See Other with Location header and a response body detailing why they're being redirected (which seems allowed per RFC 2616) using Play 2.3.10:
package example;
import play.mvc.Controller;
import play.mvc.Result;
import play.mvc.Results;
public class SeeOtherExample extends Controller {
public Result seeOtherExample() {
response().setHeader(LOCATION, "http://example.com");
return Results.status(SEE_OTHER, "You were redirected because...");
}
}
But the response body comes back empty when I include the location header. Omitting the header causes the body to be returned correctly, but of course I need the header as well.
Also, it appears to be something specific about the Location header. Setting other headers do not cause the body to be omitted.
What's the best way to send back a Location header and a response body?