Package org.h2.server.web
Class WebSession
- java.lang.Object
-
- org.h2.server.web.WebSession
-
class WebSession extends java.lang.Object
The web session keeps all data of a user session. This class is used by the H2 Console.
-
-
Field Summary
Fields Modifier and Type Field Description private Bnf
bnf
private java.util.ArrayList<java.lang.String>
commandHistory
private java.sql.Connection
conn
private DbContents
contents
(package private) java.sql.Statement
executingStatement
The currently executing statement.(package private) long
lastAccess
The last time this client sent a request.(package private) java.util.Locale
locale
The current locale.(package private) java.util.HashMap<java.lang.String,java.lang.Object>
map
The session attribute map.private static int
MAX_HISTORY
private java.sql.DatabaseMetaData
meta
(package private) java.sql.ResultSet
result
The current updatable result set.private WebServer
server
private boolean
shutdownServerOnDisconnect
-
Constructor Summary
Constructors Constructor Description WebSession(WebServer server)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addCommand(java.lang.String sql)
Add a SQL statement to the history.(package private) void
close()
Close the connection and stop the statement if one is currently executing.(package private) java.lang.Object
get(java.lang.String key)
Get the value for the given key.(package private) Bnf
getBnf()
Get the BNF object.(package private) java.lang.String
getCommand(int id)
Get the SQL statement from history.(package private) java.util.ArrayList<java.lang.String>
getCommandHistory()
Get the list of SQL statements in the history.(package private) java.sql.Connection
getConnection()
(package private) DbContents
getContents()
(package private) java.util.HashMap<java.lang.String,java.lang.Object>
getInfo()
Update session meta data information and get the information in a map.(package private) java.sql.DatabaseMetaData
getMetaData()
(package private) boolean
getShutdownServerOnDisconnect()
(package private) void
loadBnf()
Load the SQL grammar BNF.(package private) void
put(java.lang.String key, java.lang.Object value)
Put an attribute value in the map.(package private) java.lang.Object
remove(java.lang.String key)
Remove a session attribute from the map.(package private) void
setConnection(java.sql.Connection conn)
(package private) void
setShutdownServerOnDisconnect()
Shutdown the server when disconnecting.
-
-
-
Field Detail
-
MAX_HISTORY
private static final int MAX_HISTORY
- See Also:
- Constant Field Values
-
lastAccess
long lastAccess
The last time this client sent a request.
-
map
final java.util.HashMap<java.lang.String,java.lang.Object> map
The session attribute map.
-
locale
java.util.Locale locale
The current locale.
-
executingStatement
java.sql.Statement executingStatement
The currently executing statement.
-
result
java.sql.ResultSet result
The current updatable result set.
-
server
private final WebServer server
-
commandHistory
private final java.util.ArrayList<java.lang.String> commandHistory
-
conn
private java.sql.Connection conn
-
meta
private java.sql.DatabaseMetaData meta
-
contents
private DbContents contents
-
bnf
private Bnf bnf
-
shutdownServerOnDisconnect
private boolean shutdownServerOnDisconnect
-
-
Constructor Detail
-
WebSession
WebSession(WebServer server)
-
-
Method Detail
-
put
void put(java.lang.String key, java.lang.Object value)
Put an attribute value in the map.- Parameters:
key
- the keyvalue
- the new value
-
get
java.lang.Object get(java.lang.String key)
Get the value for the given key.- Parameters:
key
- the key- Returns:
- the value
-
remove
java.lang.Object remove(java.lang.String key)
Remove a session attribute from the map.- Parameters:
key
- the key- Returns:
- value that was associated with the key, or null
-
getBnf
Bnf getBnf()
Get the BNF object.- Returns:
- the BNF object
-
loadBnf
void loadBnf()
Load the SQL grammar BNF.
-
getCommand
java.lang.String getCommand(int id)
Get the SQL statement from history.- Parameters:
id
- the history id- Returns:
- the SQL statement
-
addCommand
void addCommand(java.lang.String sql)
Add a SQL statement to the history.- Parameters:
sql
- the SQL statement
-
getCommandHistory
java.util.ArrayList<java.lang.String> getCommandHistory()
Get the list of SQL statements in the history.- Returns:
- the commands
-
getInfo
java.util.HashMap<java.lang.String,java.lang.Object> getInfo()
Update session meta data information and get the information in a map.- Returns:
- a map containing the session meta data
-
setConnection
void setConnection(java.sql.Connection conn) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getMetaData
java.sql.DatabaseMetaData getMetaData()
-
getConnection
java.sql.Connection getConnection()
-
getContents
DbContents getContents()
-
setShutdownServerOnDisconnect
void setShutdownServerOnDisconnect()
Shutdown the server when disconnecting.
-
getShutdownServerOnDisconnect
boolean getShutdownServerOnDisconnect()
-
close
void close()
Close the connection and stop the statement if one is currently executing.
-
-