Top Description Fields Constructors Methods
org.h2.server.web

public Class PageParser

extends Object
Class Inheritance
Imports
java.text.ParseException, java.util.ArrayList, .HashMap, .List, .Map, org.h2.util.StringUtils

A page parser can parse an HTML page and replace the tags there. This class is used by the H2 Console.

Field Summary

Modifier and TypeField and Description
private final int
private final String
private int
private StringBuilder
private final Map<String, Object>
private static final int

Constructor Summary

AccessConstructor and Description
private
PageParser(String page, Map<String, Object> settings, int pos)

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the escaped html text
escapeHtml
(String
the data
s
)

Convert data to HTML, including newlines and multiple spaces.

private static String
escapeHtml(String s, boolean convertBreakAndSpace)

pack-priv static String

Returns:

the escaped html text
escapeHtmlData
(String
the data
s
)

Convert data to HTML, but don't convert newlines and multiple spaces.

pack-priv static String

Returns:

the javascript string
escapeJavaScript
(String
the text
s
)

Escape text as a the javascript string.

private Object
get(String item)

public static String

Returns:

the converted page
parse
(String
the HTML page
page
,
Map<String, Object>
the settings
settings
)

Replace the tags in the HTML page with the given settings.

private void
private String
private void
private boolean
private String
private String
private void
private void
setError(int i)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lenback to summary
private final int len
pageback to summary
private final String page
posback to summary
private int pos
resultback to summary
private StringBuilder result
settingsback to summary
private final Map<String, Object> settings
TAB_WIDTHback to summary
private static final int TAB_WIDTH

Constructor Detail

PageParserback to summary
private PageParser(String page, Map<String, Object> settings, int pos)

Method Detail

escapeHtmlback to summary
public static String escapeHtml(String s)

Convert data to HTML, including newlines and multiple spaces.

Parameters
s:String

the data

Returns:String

the escaped html text

escapeHtmlback to summary
private static String escapeHtml(String s, boolean convertBreakAndSpace)
escapeHtmlDataback to summary
pack-priv static String escapeHtmlData(String s)

Convert data to HTML, but don't convert newlines and multiple spaces.

Parameters
s:String

the data

Returns:String

the escaped html text

escapeJavaScriptback to summary
pack-priv static String escapeJavaScript(String s)

Escape text as a the javascript string.

Parameters
s:String

the text

Returns:String

the javascript string

getback to summary
private Object get(String item)
Annotations
@SuppressWarnings:unchecked
parseback to summary
public static String parse(String page, Map<String, Object> settings)

Replace the tags in the HTML page with the given settings.

Parameters
page:String

the HTML page

settings:Map<String, Object>

the settings

Returns:String

the converted page

parseAllback to summary
private void parseAll() throws ParseException
Annotations
@SuppressWarnings:unchecked
parseBlockUntilback to summary
private String parseBlockUntil(String end) throws ParseException
readback to summary
private void read(String s) throws ParseException
readIfback to summary
private boolean readIf(String s)
readParamback to summary
private String readParam(String name) throws ParseException
replaceTagsback to summary
private String replaceTags()
replaceTagsback to summary
private void replaceTags(String s)
setErrorback to summary
private void setError(int i)
skipSpacesback to summary
private void skipSpaces()