Package org.h2.server.web
Class WebApp
java.lang.Object
org.h2.server.web.WebApp
- Direct Known Subclasses:
WebThread
For each connection to a session, an object of this class is created.
This class is used by the H2 Console.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classThis class represents index information for the GUI. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PropertiesThe session attributesprotected booleanWhether the response can be cached.protected StringThe language in the HTTP header.protected StringThe mime type of the current response.private Profilerprotected final WebServerThe web server.protected WebSessionThe session.protected booleanWhether to close the connection.private static final Comparator<DbTableOrView> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intaddColumns(boolean mainSchema, DbTableOrView table, StringBuilder builder, int treeIndex, boolean showColumnTypes, StringBuilder columnsBuilder) private static intaddIndexes(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex) private static intaddTableOrView(DbSchema schema, boolean mainSchema, StringBuilder builder, int treeIndex, DatabaseMetaData meta, boolean showColumns, String indentation, boolean isOracle, boolean notManyTables, DbTableOrView table, boolean isView, PreparedStatement prep, String indentNode) private intaddTablesAndViews(DbSchema schema, boolean mainSchema, StringBuilder builder, int treeIndex) private Stringadmin()private Stringprivate Stringprotected StringStop the application and the server.private Stringprivate Stringprivate booleancheckAdmin(String file) private Stringprivate static StringescapeData(ResultSet rs, int columnIndex) private static StringescapeIdentifier(String name) private StringexecuteLoop(Connection conn, int count, String sql) private static String(package private) booleangetCache()private static StringgetComboBox(String[][] elements, String selected) private static StringgetComboBox(String[] elements, String selected) private Stringprivate Stringprivate StringgetLoginError(Exception e, boolean isH2) Get the formatted login error message.private int(package private) StringGet the current mime type.private static Stringprivate StringgetResult(Connection conn, int id, String sql, boolean allowEdit, boolean forceEdit) private StringgetResultSet(String sql, ResultSet rs, boolean metadata, boolean list, boolean edit, long time, boolean allowEdit) (package private) WebSessionprivate StringgetStackTrace(int id, Throwable e, boolean isH2) private Stringindex()private static Stringprivate Stringlogin(NetworkConnectionInfo networkConnectionInfo) private Stringlogout()private static PreparedStatementprepareViewDefinitionQuery(Connection conn, DbContents contents) private Stringprocess(String file, NetworkConnectionInfo networkConnectionInfo) (package private) StringprocessRequest(String file, NetworkConnectionInfo networkConnectionInfo) Process an HTTP request.private Stringquery()(package private) voidquery(Connection conn, String s, int i, int size, StringBuilder buff) Execute a query and append the result to the buffer.(package private) voidsetSession(WebSession session, Properties attributes) Set the web session and attributes.private Stringprivate StringSave the current connection settings to the properties file.private Stringtables()private Stringtest(NetworkConnectionInfo networkConnectionInfo) private Stringtools()private voidprivate voidunescapeData(String x, ResultSet rs, int columnIndex)
-
Field Details
-
SYSTEM_SCHEMA_COMPARATOR
-
server
The web server. -
session
The session. -
attributes
The session attributes -
mimeType
The mime type of the current response. -
cache
protected boolean cacheWhether the response can be cached. -
stop
protected boolean stopWhether to close the connection. -
headerLanguage
The language in the HTTP header. -
profiler
-
-
Constructor Details
-
WebApp
WebApp(WebServer server)
-
-
Method Details
-
setSession
Set the web session and attributes.- Parameters:
session- the sessionattributes- the attributes
-
processRequest
Process an HTTP request.- Parameters:
file- the file that was requestednetworkConnectionInfo- the network connection information- Returns:
- the name of the file to return to the client
-
getComboBox
-
getComboBox
-
process
-
checkAdmin
-
adminLogin
-
autoCompleteList
-
admin
-
adminSave
-
tools
-
adminStartTranslate
-
adminShutdown
Stop the application and the server.- Returns:
- the page to display
-
index
-
getHistory
-
addColumns
private static int addColumns(boolean mainSchema, DbTableOrView table, StringBuilder builder, int treeIndex, boolean showColumnTypes, StringBuilder columnsBuilder) -
escapeIdentifier
-
addIndexes
private static int addIndexes(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex) throws SQLException - Throws:
SQLException
-
addTablesAndViews
private int addTablesAndViews(DbSchema schema, boolean mainSchema, StringBuilder builder, int treeIndex) throws SQLException - Throws:
SQLException
-
prepareViewDefinitionQuery
-
addTableOrView
private static int addTableOrView(DbSchema schema, boolean mainSchema, StringBuilder builder, int treeIndex, DatabaseMetaData meta, boolean showColumns, String indentation, boolean isOracle, boolean notManyTables, DbTableOrView table, boolean isView, PreparedStatement prep, String indentNode) throws SQLException - Throws:
SQLException
-
tables
-
getStackTrace
-
linkToSource
-
formatAsError
-
test
-
getLoginError
Get the formatted login error message.- Parameters:
e- the exceptionisH2- if the current database is a H2 database- Returns:
- the formatted error message
-
login
-
logout
-
query
-
query
Execute a query and append the result to the buffer.- Parameters:
conn- the connections- the statementi- the indexsize- the number of statementsbuff- the target buffer
-
editResult
-
getMaxrows
private int getMaxrows() -
getResult
-
executeLoop
- Throws:
SQLException
-
getCommandHistoryString
-
getParameterResultSet
- Throws:
SQLException
-
getResultSet
private String getResultSet(String sql, ResultSet rs, boolean metadata, boolean list, boolean edit, long time, boolean allowEdit) throws SQLException - Throws:
SQLException
-
settingSave
Save the current connection settings to the properties file.- Returns:
- the file to open afterwards
-
escapeData
- Throws:
SQLException
-
unescapeData
- Throws:
SQLException
-
settingRemove
-
getMimeType
String getMimeType()Get the current mime type.- Returns:
- the mime type
-
getCache
boolean getCache() -
getSession
WebSession getSession() -
trace
-