/** * Extracts the content as String. */ public static String contentAsString(Content content) { return content.body(); }
/** * @deprecated use {@link Result#contentType()} instead. */ @Deprecated public static String contentType(Content content) { return content.contentType(); }
/** * 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)); }
@Override public Email setBody(Html body) { try { wrappedEmail.setHtmlMsg(body.toString()); } catch (EmailException e) { throw new IllegalArgumentException("Could not set the sender of the email.", e); } return this; }
public byte[] toBytes(Html html, String documentBaseURL, List<String> fonts) { byte[] pdf = toBytes(html.body(), documentBaseURL, fonts); return pdf; }
public String generateModelProvider() { return modelProviderTemplate.render(packageName, YangModelBindingProvider.class.getName(), YangModuleInfo.class .getName()).body(); }
/** * 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)); }
/** * Extracts the content as a String. * * @param content the content. * @return the body of the content as a String. */ public static String contentAsString(Content content) { return content.body(); }
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) ); }
public static void main(String... args) { String render = Hello.render("Jake!").toString(); System.out.println(render); } }
public byte[] toBytes(Html html, String documentBaseURL) { byte[] pdf = toBytes(html.body(), documentBaseURL); return pdf; }
@Override protected String body() { String importedName = importedName(String.class); return enumTemplate.render(enums, importedName).body(); }
/** * 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)); }
/** * Extracts the content as a String. * * @param content the content. * @return the body of the content as a String. */ public static String contentAsString(Content content) { return content.body(); }
public Result ok(Html html, String documentBaseURL) { byte[] pdf = toBytes(html.body(), documentBaseURL); return Results.ok(pdf).as("application/pdf"); }
protected String body() { /** * list of all imported names for template. */ final Map<String, String> importedNames = new HashMap<>(); importedNames.put("string", importedName(String.class)); importedNames.put("stringBuilder", importedName(StringBuilder.class)); importedNames.put("set", importedName(Set.class)); importedNames.put("hashSet", importedName(HashSet.class)); importedNames.put("collections", importedName(Collections.class)); importedNames.put("immutableSet", importedName(ImmutableSet.class)); importedNames.put("inputStream", importedName(InputStream.class)); importedNames.put("iOException", importedName(IOException.class)); importedNames.put("yangModuleInfo", importedName(YangModuleInfo.class)); importedNames.put("optional", importedName(Optional.class)); importedNames.put("semVer", importedName(SemVer.class)); importedNames.put("schemaSourceRepresentation", importedName(SchemaSourceRepresentation.class)); return yangModuleInfoTemplate.render(module, ctx, importedNames, moduleFilePathResolver).body(); }
/** * Extracts the content as bytes. */ public static byte[] contentAsBytes(Content content) { return content.body().getBytes(); }
public Result ok(Html html, String documentBaseURL, List<String> fonts) { byte[] pdf = toBytes(html.body(), documentBaseURL, fonts); return Results.ok(pdf).as("application/pdf"); }
/** * Extracts the content as bytes. * * @param content the content to be turned into bytes. * @return the body of the content as a byte string. */ public static ByteString contentAsBytes(Content content) { return ByteString.fromString(content.body()); }
/** * Extracts the content as bytes. * * @param content the content to be turned into bytes. * @return the body of the content as a byte string. */ public static ByteString contentAsBytes(Content content) { return ByteString.fromString(content.body()); }