com.google.common.html.HtmlEscapers Java Examples

The following examples show how to use com.google.common.html.HtmlEscapers. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TextNodeRenderer.java    From buck with Apache License 2.0 6 votes vote down vote up
@Override
public Component render(Object value) {
  BuckTextNode node = (BuckTextNode) value;

  if (node.getText().isEmpty()) {
    return new JLabel("");
  }

  Icon icon = AllIcons.General.Information;
  if (node.getTextType() == BuckTextNode.TextType.ERROR) {
    icon = AllIcons.Ide.FatalError;
  } else if (node.getTextType() == BuckTextNode.TextType.WARNING) {
    icon = AllIcons.General.Warning;
  }

  String message =
      "<html><pre style='margin:0px'>"
          + HtmlEscapers.htmlEscaper().escape(node.getText())
          + "</pre></html>";

  JBLabel result = new JBLabel(message, icon, SwingConstants.LEFT);

  result.setToolTipText("<pre>" + node.getText() + "</pre>");

  return result;
}
 
Example #2
Source File: SsmlAddresses.java    From java-docs-samples with Apache License 2.0 6 votes vote down vote up
/**
 * Generates SSML text from plaintext.
 *
 * <p>Given an input filename, this function converts the contents of the input text file into a
 * String of tagged SSML text. This function formats the SSML String so that, when synthesized,
 * the synthetic audio will pause for two seconds between each line of the text file. This
 * function also handles special text characters which might interfere with SSML commands.
 *
 * @param inputFile String name of plaintext file
 * @return a String of SSML text based on plaintext input.
 * @throws IOException on files that don't exist
 */
public static String textToSsml(String inputFile) throws Exception {

  // Read lines of input file
  String rawLines = new String(Files.readAllBytes(Paths.get(inputFile)));

  // Replace special characters with HTML Ampersand Character Codes
  // These codes prevent the API from confusing text with SSML tags
  // For example, '<' --> '&lt;' and '&' --> '&amp;'
  String escapedLines = HtmlEscapers.htmlEscaper().escape(rawLines);

  // Convert plaintext to SSML
  // Tag SSML so that there is a 2 second pause between each address
  String expandedNewline = escapedLines.replaceAll("\\n", "\n<break time='2s'/>");
  String ssml = "<speak>" + expandedNewline + "</speak>";

  // Return the concatenated String of SSML
  return ssml;
}
 
Example #3
Source File: SecurityMailService.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
public void sendResetEmail ( final String email, final String resetToken )
{
    String link;
    try
    {
        link = String.format ( "%s/signup/newPassword?email=%s&token=%s", getSitePrefix (), URLEncoder.encode ( email, "UTF-8" ), resetToken );
    }
    catch ( final UnsupportedEncodingException e )
    {
        throw new RuntimeException ( e );
    }

    final Map<String, String> model = new HashMap<> ();
    model.put ( "token", resetToken );
    model.put ( "link", link );
    model.put ( "linkEncoded", HtmlEscapers.htmlEscaper ().escape ( link ) );
    sendEmail ( email, "Password reset request", "passwordReset", model );
}
 
Example #4
Source File: FooBarProcessorFactory.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Processor create ( final String configuration ) throws IllegalArgumentException
{
    final FooBarConfiguration cfg = FooBarConfiguration.fromJson ( configuration );

    return new Processor () {

        @Override
        public void process ( final Object context )
        {
            System.out.format ( "Foo bar: %s - %s%n", cfg.getString1 (), context );
        }

        @Override
        public void streamHtmlState ( final PrintWriter writer )
        {
            final Escaper esc = HtmlEscapers.htmlEscaper ();
            writer.format ( "<p>This action is doing foo bar: <code>%s</code></p>", esc.escape ( cfg.getString1 () ) );
        }
    };
}
 
Example #5
Source File: DumpTransitionsEx.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
private String captionEntryToString(final Object entry) {
	final String prefix = "games.stendhal.server.";
	String entryName = entry.toString();
	entryName = HtmlEscapers.htmlEscaper().escape(entryName);
	if (entryName.startsWith(prefix)) {
		entryName = entryName.substring(prefix.length());
	}
	entryName = entryName.replace("{", "\\{").replace("}", "\\}");
	return entryName;
}
 
Example #6
Source File: RdfHtmlResultsShaclWriter.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
private StringBuilder printResult(StringBuilder htmlString, String template, ShaclLiteTestCaseResult result) {
    return htmlString.append(
            String.format(template,
                    getStatusClass(result.getSeverity()),
                    "<a href=\"" + result.getSeverity().getUri() + "\">" + result.getSeverity().name() + "</a>",
                    HtmlEscapers.htmlEscaper().escape(result.getMessage()),
                    result.getFailingNode(), result.getFailingNode(), // <a href=%s>%s</a>
                    result.getTestCaseUri().toString().replace(PrefixNSService.getNSFromPrefix("rutt"), "rutt:"))
    );
}
 
Example #7
Source File: RdfHtmlResultsAggregateWriter.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
private StringBuilder printResult(StringBuilder htmlString, String template, AggregatedTestCaseResult result) {
    return htmlString.append(
        String.format(template,
                getStatusClass(result.getStatus()),
                "<a href=\"" + result.getStatus().getUri() + "\">" + result.getStatus().name() + "</a>",
                "<a href=\"" + result.getSeverity().getUri() + "\">" + result.getSeverity().name() + "</a>",
                result.getTestCaseUri().toString().replace(PrefixNSService.getNSFromPrefix("rutt"), "rutt:"),
                HtmlEscapers.htmlEscaper().escape(result.getMessage()),
                result.getErrorCount(),
                result.getPrevalenceCount().orElse(-1L)
        ));
}
 
Example #8
Source File: RdfHtmlResultsStatusWriter.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
private StringBuilder printResult(StringBuilder htmlString, String template, StatusTestCaseResult result) {
    return htmlString.append(
        String.format(template,
            getStatusClass(result.getStatus()),
            "<a href=\"" + result.getStatus().getUri() + "\">" + result.getStatus().name() + "</a>",
            "<a href=\"" + result.getSeverity().getUri() + "\">" + result.getSeverity().name() + "</a>",
            result.getTestCaseUri().toString().replace(PrefixNSService.getNSFromPrefix("rutt"), "rutt:"),
            HtmlEscapers.htmlEscaper().escape(result.getMessage())
    ));
}
 
Example #9
Source File: Show3D2ThreeJS.java    From symja_android_library with GNU General Public License v3.0 5 votes vote down vote up
/**
 * <p>
 * A 3D Graphics command like
 * 
 * <pre>
 *     Graphics3D(Polygon({{0,0,0}, {0,1,1}, {1,0,0}}))
 * </pre>
 * 
 * will be converted to:
 * 
 * <pre>
 * &lt;graphics3d data="{&quot;viewpoint&quot;: [1.3, -2.4, 2.0], &quot;elements&quot;: [{&quot;coords&quot;:......
 * </pre>
 * </p>
 * 
 * <p>
 * It's a bit messy because of all the HTML escaping. What we are interested in is the data field. It's a JSON dict
 * describing the 3D graphics in terms of graphics primitives. This JSON can be used in
 * <a href="http://threejs.org/">threejs.org</a> to construct a 3D div.
 * </p>
 * 
 * @param ast
 * @param buf
 * @throws IOException
 */
protected static void graphics3dToSVG(IAST ast, StringBuilder buf) {
	EvalEngine engine = EvalEngine.get();
	IAST numericAST = (IAST) engine.evalN(ast);
	double[] viewpoints = new double[] { 1.3, -2.4, 2.0 };
	if (numericAST.size() > 2) {
		final OptionArgs options = new OptionArgs(numericAST.topHead(), numericAST, 2, engine);
		optionViewPoint(options, viewpoints);
	}
	int width = 400;
	int height = 200;
	Dimensions2D dim = new Dimensions2D(width, height);
	buf.append("<graphics3d data=\"{");

	StringBuilder builder = new StringBuilder(1024);
	appendDoubleArray(builder, "viewpoint", viewpoints);
	try {
		for (int i = 1; i < numericAST.size(); i++) {
			// if (numericAST.get(i).isASTSizeGE(F.Line, 2)) {
			// lineToSVG(numericAST.getAST(i), buf, dim);
			// } else
			if (numericAST.get(i).isSameHeadSizeGE(F.Polygon, 2)) {
				elements("polygon", numericAST.getAST(i), builder, dim);
			} else if (numericAST.get(i).isSameHeadSizeGE(F.Point, 2)) {
				elements("point", numericAST.getAST(i), builder, dim);
			}
		}
	} finally {
		builder.append("\"lighting\": [{\"color\": [0.3, 0.2, 0.4], \"type\": \"Ambient\"}, "
				+ "{\"color\": [0.8, 0.0, 0.0], \"position\": [2.0, 0.0, 2.0], \"type\": \"Directional\"}, "
				+ "{\"color\": [0.0, 0.8, 0.0], \"position\": [2.0, 2.0, 2.0], \"type\": \"Directional\"}, "
				+ "{\"color\": [0.0, 0.0, 0.8], \"position\": [0.0, 2.0, 2.0], \"type\": \"Directional\"}], "
				+ "\"axes\": {\"hasaxes\": [false, false, false], "
				+ "\"ticks\": [[[0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0], [0.05, 0.1, 0.15000000000000002, 0.25, 0.30000000000000004, 0.35000000000000003, 0.45, 0.5, 0.55, 0.65, 0.7000000000000001, 0.75, 0.8500000000000001, 0.9, 0.9500000000000001], [\"0.0\", \"0.2\", \"0.4\", \"0.6\", \"0.8\", \"1.0\"]], [[0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0], [0.05, 0.1, 0.15000000000000002, 0.25, 0.30000000000000004, 0.35000000000000003, 0.45, 0.5, 0.55, 0.65, 0.7000000000000001, 0.75, 0.8500000000000001, 0.9, 0.9500000000000001], [\"0.0\", \"0.2\", \"0.4\", \"0.6\", \"0.8\", \"1.0\"]], [[0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0], [0.05, 0.1, 0.15000000000000002, 0.25, 0.30000000000000004, 0.35000000000000003, 0.45, 0.5, 0.55, 0.65, 0.7000000000000001, 0.75, 0.8500000000000001, 0.9, 0.9500000000000001], [\"0.0\", \"0.2\", \"0.4\", \"0.6\", \"0.8\", \"1.0\"]]]}, "
				+ "\"extent\": {\"zmax\": 1.0, \"ymax\": 1.0, \"zmin\": 0.0, \"xmax\": 1.0, \"xmin\": 0.0, \"ymin\": 0.0}");
		Escaper escaper = HtmlEscapers.htmlEscaper();
		buf.append(escaper.escape(builder.toString()));
		buf.append("}\" />");
	}
}
 
Example #10
Source File: DotLabelBuilder.java    From depgraph-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void addText(String text) {
  if (StringUtils.isEmpty(text)) {
    return;
  }

  if (this.smartNewLine && !this.empty) {
    newLine();
    this.smartNewLine = false;
  }
  this.labelBuilder.append(HtmlEscapers.htmlEscaper().escape(text));

  this.empty = false;
}
 
Example #11
Source File: SourceViewerActivity.java    From android-classyshark with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_source_viewer);
    getWindow().getDecorView().setBackgroundColor(Color.BLACK);

    ActionBar bar = getSupportActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(0xff606060));

    String result = "";

    try {

        String name = getIntent().getStringExtra(ClassesListActivity.SELECTED_CLASS_NAME);
        String barName = name.substring(name.lastIndexOf(".") + 1);

        bar.setTitle((Html.fromHtml("<font color=\"#FFFF80\">" +
                barName + "</font>")));

        result = getIntent().getStringExtra(ClassesListActivity.SELECTED_CLASS_DUMP);

    } catch (Exception e) {
        e.printStackTrace();
    }

    sourceCodeText = result;
    sourceCodeText = HtmlEscapers.htmlEscaper().escape(sourceCodeText);

    WebView webView = (WebView) findViewById(R.id.source_view);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDefaultTextEncodingName("utf-8");
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
        }
    });

    webView.loadDataWithBaseURL("file:///android_asset/", "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script src=\"run_prettify.js?skin=sons-of-obsidian\"></script></head><body bgcolor=\"#000000\"><pre class=\"prettyprint \">" + sourceCodeText + "</pre></body></html>", "text/html", "UTF-8", null);
}
 
Example #12
Source File: AutoIndex.java    From armeria with Apache License 2.0 5 votes vote down vote up
static HttpData listingToHtml(String dirPath, String mappedDirPath, List<String> listing) {
    final Escaper htmlEscaper = HtmlEscapers.htmlEscaper();
    final Escaper urlEscaper = UrlEscapers.urlFragmentEscaper();
    final String escapedDirPath = htmlEscaper.escape(dirPath);
    final StringBuilder buf = new StringBuilder(listing.size() * 64);
    buf.append(PART1);
    buf.append(escapedDirPath);
    buf.append(PART2);
    buf.append(escapedDirPath);
    buf.append(PART3);
    buf.append(listing.size());
    buf.append(PART4);
    if (!"/".equals(mappedDirPath)) {
        buf.append("<li class=\"directory parent\"><a href=\"../\">../</a></li>\n");
    }
    for (String name : listing) {
        buf.append("<li class=\"");
        if (name.charAt(name.length() - 1) == '/') {
            buf.append("directory");
        } else {
            buf.append("file");
        }
        buf.append("\"><a href=\"");
        buf.append(urlEscaper.escape(name));
        buf.append("\">");
        buf.append(name);
        buf.append("</a></li>\n");
    }
    buf.append(PART5);
    return HttpData.ofUtf8(buf.toString());
}
 
Example #13
Source File: SecurityMailService.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public void sendVerifyEmail ( final String email, final String userId, final String token )
{
    final String link = String.format ( "%s/signup/verifyEmail?userId=%s&token=%s", getSitePrefix (), userId, token );

    final Map<String, String> model = new HashMap<> ();
    model.put ( "token", token );
    model.put ( "link", link );
    model.put ( "linkEncoded", HtmlEscapers.htmlEscaper ().escape ( link ) );
    sendEmail ( email, "Verify your account", "verify", model );
}
 
Example #14
Source File: MavenHandler.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
private void render ( final PrintWriter pw )
{
    pw.write ( "<ul>\n" );

    pw.write ( "<li><a href=\"..\">..</a></li>" );

    final List<String> dirs = new ArrayList<> ( this.dir.getNodes ().keySet () );
    Collections.sort ( dirs );

    for ( final String entry : dirs )
    {
        final Node node = this.dir.getNodes ().get ( entry );

        String esc = HtmlEscapers.htmlEscaper ().escape ( entry );
        pw.write ( "<li><a href=\"" );

        if ( node.isDirectory () && !esc.endsWith ( "/" ) )
        {
            // ensure it ends with /
            esc = esc + "/";
        }

        pw.write ( esc );
        pw.write ( "\">" );
        pw.write ( esc );
        pw.write ( "</a></li>\n" );
    }
    pw.write ( "</ul>\n" );
}
 
Example #15
Source File: ConfigController.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
private static void customize ( final JspWriter out, final CleanupConfiguration cfg ) throws IOException
{
    final String json = HtmlEscapers.htmlEscaper ().escape ( new GsonBuilder ().create ().toJson ( cfg ) );

    out.print ( "<div class=\"container-fluid\">" );
    out.print ( "<div class=\"row\"><div class=\"col-md-12\">" );
    out.print ( "<form action=\"edit\" method=\"get\">" );
    out.print ( "<input type=\"hidden\" name=\"configuration\" value=\"" + json + "\"/>" );
    out.print ( "<button class=\"btn btn-primary\" type=\"submit\">Edit</button>" );
    out.println ( "</form></div></div></div>" );
}
 
Example #16
Source File: Jdk8Generator.java    From grpc-java-contrib with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private String getJavaDoc(String comments, String prefix) {
    if (!comments.isEmpty()) {
        StringBuilder builder = new StringBuilder("/**\n")
                .append(prefix).append(" * <pre>\n");
        Arrays.stream(HtmlEscapers.htmlEscaper().escape(comments).split("\n"))
                .forEach(line -> builder.append(prefix).append(" * ").append(line).append("\n"));
        builder
                .append(prefix).append(" * <pre>\n")
                .append(prefix).append(" */");
        return builder.toString();
    }
    return null;
}
 
Example #17
Source File: WebMvcConfig.java    From BlogManagePlatform with Apache License 2.0 5 votes vote down vote up
/**
 * 配置格式化器
 * @author Frodez
 * @date 2019-05-10
 */
@Override
public void addFormatters(FormatterRegistry registry) {
	//对字符串进行转义
	registry.addConverter(new Converter<String, String>() {

		private final Escaper escaper = HtmlEscapers.htmlEscaper();

		@Override
		public String convert(String source) {
			return escaper.escape(source);
		}
	});

}
 
Example #18
Source File: MutinyGrpcGenerator.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private String getJavaDoc(String comments, String prefix) {
    if (!comments.isEmpty()) {
        StringBuilder builder = new StringBuilder("/**\n")
                .append(prefix).append(" * <pre>\n");
        Arrays.stream(HtmlEscapers.htmlEscaper().escape(comments).split("\n"))
                .map(line -> line.replace("*/", "&#42;&#47;").replace("*", "&#42;"))
                .forEach(line -> builder.append(prefix).append(" * ").append(line).append("\n"));
        builder
                .append(prefix).append(" * </pre>\n")
                .append(prefix).append(" */");
        return builder.toString();
    }
    return null;
}
 
Example #19
Source File: AbstractGenerator.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
/**
 * Java doc
 *
 * @param comments
 * @param prefix
 * @return
 */
private String getJavaDoc(String comments, String prefix) {
    if (!comments.isEmpty()) {
        StringBuilder builder = new StringBuilder("/**\n").append(prefix).append(" * <pre>\n");
        for (String line : HtmlEscapers.htmlEscaper().escape(comments).split("\n")) {
            String replace = line.replace("*/", "&#42;&#47;").replace("*", "&#42;");
            builder.append(prefix).append(" * ").append(replace).append("\n");
        }
        builder.append(prefix).append(" * </pre>\n").append(prefix).append(" */");
        return builder.toString();
    }
    return null;
}
 
Example #20
Source File: InnerTextComponent.java    From jweb-cms with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void output(Map<String, Object> bindings, Attributes attributes, Children children, OutputStream out) throws IOException {
    Object content = attributes.get("content");
    if (content == null) {
        children.output(bindings, out);
    } else {
        out.write(HtmlEscapers.htmlEscaper().escape(content.toString()).getBytes(Charsets.UTF_8));
    }
}
 
Example #21
Source File: ReactiveGrpcGenerator.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private String getJavaDoc(String comments, String prefix) {
    if (!comments.isEmpty()) {
        StringBuilder builder = new StringBuilder("/**\n")
                .append(prefix).append(" * <pre>\n");
        Arrays.stream(HtmlEscapers.htmlEscaper().escape(comments).split("\n"))
                .map(line -> line.replace("*/", "&#42;&#47;").replace("*", "&#42;"))
                .forEach(line -> builder.append(prefix).append(" * ").append(line).append("\n"));
        builder
                .append(prefix).append(" * </pre>\n")
                .append(prefix).append(" */");
        return builder.toString();
    }
    return null;
}
 
Example #22
Source File: StatusPageResponse.java    From vespa with Apache License 2.0 5 votes vote down vote up
public void writeHtmlFooter(StringBuilder content, String hiddenMessage) {
    if (hiddenMessage != null && !hiddenMessage.isEmpty()) {
        content.append("\n<!-- " + HtmlEscapers.htmlEscaper().escape(hiddenMessage) + " -->\n");
    }
    content.append("</body>\n")
           .append("</html>\n");
}
 
Example #23
Source File: MarkdownGenerator.java    From copybara with Apache License 2.0 5 votes vote down vote up
private String simplerJavaTypes(TypeMirror typeMirror) {
  String s = typeMirror.toString();
  Matcher m = Pattern.compile("(?:[A-z.]*\\.)*([A-z]+)").matcher(s);
  StringBuilder sb = new StringBuilder();
  while(m.find()) {
    String replacement = deCapitalize(m.group(1));
    m.appendReplacement(sb, replacement);
  }
  m.appendTail(sb);

  return HtmlEscapers.htmlEscaper().escape(sb.toString());
}
 
Example #24
Source File: HtmlBuilder.java    From purplejs with Apache License 2.0 5 votes vote down vote up
HtmlBuilder()
{
    this.escaper = HtmlEscapers.htmlEscaper();
    this.str = new StringBuilder();
    this.openTags = new Stack<>();
    this.addedInner = false;
}
 
Example #25
Source File: VespaFeedWriter.java    From vespa with Apache License 2.0 5 votes vote down vote up
public void writePredicateDocument(int id, String fieldName, Predicate predicate) {
    try {
        this.append(String.format("<document documenttype=\"%2$s\" documentid=\"id:%1$s:%2$s::%3$d\">\n",
                namespace, documentType, id));
        this.append("<" + fieldName + ">" + HtmlEscapers.htmlEscaper().escape(predicate.toString()) + "</" + fieldName + ">\n");
        this.append("</document>\n");
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
Example #26
Source File: StatusPageResponse.java    From vespa with Apache License 2.0 5 votes vote down vote up
public void writeHtmlHeader(StringBuilder content, String title) {
    String escaped_title = HtmlEscapers.htmlEscaper().escape(title);
    content.append("<html>\n")
           .append("<head><title>").append(escaped_title).append("</title></head>")
           .append("<body>\n")
           .append("<h1>").append(escaped_title).append("</h1>\n");
}
 
Example #27
Source File: InputDeviceSpec.java    From science-journal with Apache License 2.0 4 votes vote down vote up
public static String escape(String string) {
  return HtmlEscapers.htmlEscaper().escape(string);
}
 
Example #28
Source File: MenuEntry.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
public MenuEntry makeModalMessage ( final String title, final String message )
{
    this.modal = new Modal ( title, new FunctionalButton ( ButtonFunction.CLOSE, "Close" ), new FunctionalButton ( ButtonFunction.SUBMIT, this.label, this.icon, this.modifier ) );
    this.modal.setBody ( "<p>" + HtmlEscapers.htmlEscaper ().escape ( message ) + "</p>" );
    return this;
}
 
Example #29
Source File: EscapeExpressionSegment.java    From jweb-cms with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void output(Map<String, Object> bindings, OutputStream outputStream) throws IOException {
    Object value = expression.eval(bindings);
    String content = value == null ? "" : HtmlEscapers.htmlEscaper().escape(value.toString());
    outputStream.write(content.getBytes(StandardCharsets.UTF_8));
}
 
Example #30
Source File: JsonPrettyPrinter.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
public void printString(String value) {
   out.append("\"").append(HtmlEscapers.htmlEscaper().escape(value)).append("\"");
}