jetbrains.buildServer.web.util
Class HTMLFormatter

java.lang.Object
  extended by jetbrains.buildServer.web.util.HTMLFormatter

public class HTMLFormatter
extends java.lang.Object

Utility class which is used to substitute text containing various links (http://, mailto:, ftp: and so on) with actual HTML link and line feeds with <br/> tag.

Rewritten to fix TW-8635.


Constructor Summary
HTMLFormatter()
           
 
Method Summary
static java.lang.String format(java.lang.String text, javax.servlet.jsp.JspContext context)
          Searches for plain links in specified text and returns the same text with links transformed to HTML links (<a href=""></a>).
static java.lang.String formatMultiLine(java.lang.String text)
          Escapes the text for HTML and transforms line feeds with <br>s.
static java.lang.String formatMultiLine(java.lang.String text, boolean escape)
          Transforms line feeds with <br>s.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLFormatter

public HTMLFormatter()
Method Detail

format

public static java.lang.String format(java.lang.String text,
                                      @NotNull
                                      javax.servlet.jsp.JspContext context)
Searches for plain links in specified text and returns the same text with links transformed to HTML links (<a href=""></a>).

Parameters:
text - text containing links
request - HTTP request, for which formatting is performed
Returns:
text with transformed links

formatMultiLine

@NotNull
public static java.lang.String formatMultiLine(@Nullable
                                                       java.lang.String text)
Escapes the text for HTML and transforms line feeds with <br>s. Note: in contrast with #format(String, HttpServletRequest) this method does not depend on build server settings.

Parameters:
text - text to format
Returns:
a formatted text
Since:
7.0

formatMultiLine

@NotNull
public static java.lang.String formatMultiLine(@Nullable
                                                       java.lang.String text,
                                                       boolean escape)
Transforms line feeds with <br>s.

Parameters:
text - text to format
escape - true if text should be escaped first
Returns:
a formatted text
Since:
7.1.2, 8.0