/** * @deprecated use {@link Result#contentType()} instead. */ @Deprecated public static String contentType(Content content) { return content.contentType(); }
public Status(play.api.mvc.Results.Status status, Content content, Codec codec) { if(content == null) { throw new NullPointerException("null content"); } wrappedResult = status.apply( content, play.core.j.JavaResults.writeContent(content.contentType(), codec) ); }
/** * Create an entity from the given content. * * @param content The content. * @param charset The charset. * * @return the HTTP entity. */ public static final HttpEntity fromContent(Content content, String charset) { String body; if (content instanceof Xml) { // See https://github.com/playframework/playframework/issues/2770 body = content.body().trim(); } else { body = content.body(); } return new Strict(ByteString.fromString(body, charset), Optional.of(content.contentType() + "; charset=" + charset)); }
/** * Create an entity from the given content. * * @param content The content. * @param charset The charset. * * @return the HTTP entity. */ public static final HttpEntity fromContent(Content content, String charset) { String body; if (content instanceof Xml) { // See https://github.com/playframework/playframework/issues/2770 body = content.body().trim(); } else { body = content.body(); } return new Strict(ByteString.fromString(body, charset), Optional.of(content.contentType() + "; charset=" + charset)); }
/** * Create an entity from the given content. * * @param content The content. * @param charset The charset. * * @return the HTTP entity. */ public static final HttpEntity fromContent(Content content, String charset) { String body; if (content instanceof Xml) { // See https://github.com/playframework/playframework/issues/2770 body = content.body().trim(); } else { body = content.body(); } return new Strict(ByteString.fromString(body, charset), Optional.of(content.contentType() + "; charset=" + charset)); }