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 class
This class represents index information for the GUI. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Properties
The session attributesprotected boolean
Whether the response can be cached.protected String
The language in the HTTP header.protected String
The mime type of the current response.private Profiler
protected final WebServer
The web server.protected WebSession
The session.protected boolean
Whether to close the connection.private static final Comparator
<DbTableOrView> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
addColumns
(boolean mainSchema, DbTableOrView table, StringBuilder builder, int treeIndex, boolean showColumnTypes, StringBuilder columnsBuilder) private static int
addIndexes
(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex) 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) private int
addTablesAndViews
(DbSchema schema, boolean mainSchema, StringBuilder builder, int treeIndex) private String
admin()
private String
private String
protected String
Stop the application and the server.private String
private String
private boolean
checkAdmin
(String file) private String
private static String
escapeData
(ResultSet rs, int columnIndex) private static String
escapeIdentifier
(String name) private String
executeLoop
(Connection conn, int count, String sql) private static String
(package private) boolean
getCache()
private static String
getComboBox
(String[][] elements, String selected) private static String
getComboBox
(String[] elements, String selected) private String
private String
private String
getLoginError
(Exception e, boolean isH2) Get the formatted login error message.private int
(package private) String
Get the current mime type.private static String
private String
getResult
(Connection conn, int id, String sql, boolean allowEdit, boolean forceEdit) private String
getResultSet
(String sql, ResultSet rs, boolean metadata, boolean list, boolean edit, long time, boolean allowEdit) (package private) WebSession
private String
getStackTrace
(int id, Throwable e, boolean isH2) private String
index()
private static String
private String
login
(NetworkConnectionInfo networkConnectionInfo) private String
logout()
private static PreparedStatement
prepareViewDefinitionQuery
(Connection conn, DbContents contents) private String
process
(String file, NetworkConnectionInfo networkConnectionInfo) (package private) String
processRequest
(String file, NetworkConnectionInfo networkConnectionInfo) Process an HTTP request.private String
query()
(package private) void
query
(Connection conn, String s, int i, int size, StringBuilder buff) Execute a query and append the result to the buffer.(package private) void
setSession
(WebSession session, Properties attributes) Set the web session and attributes.private String
private String
Save the current connection settings to the properties file.private String
tables()
private String
test
(NetworkConnectionInfo networkConnectionInfo) private String
tools()
private void
private void
unescapeData
(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
-