Package org.h2.server.web
Class WebSession
- java.lang.Object
-
- org.h2.server.web.WebSession
-
class WebSession extends java.lang.ObjectThe 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 Bnfbnfprivate java.util.ArrayList<java.lang.String>commandHistoryprivate java.sql.Connectionconnprivate DbContentscontents(package private) java.sql.StatementexecutingStatementThe currently executing statement.(package private) longlastAccessThe last time this client sent a request.(package private) java.util.LocalelocaleThe current locale.(package private) java.util.HashMap<java.lang.String,java.lang.Object>mapThe session attribute map.private static intMAX_HISTORYprivate java.sql.DatabaseMetaDatameta(package private) java.sql.ResultSetresultThe current updatable result set.private WebServerserverprivate booleanshutdownServerOnDisconnect
-
Constructor Summary
Constructors Constructor Description WebSession(WebServer server)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddCommand(java.lang.String sql)Add a SQL statement to the history.(package private) voidclose()Close the connection and stop the statement if one is currently executing.(package private) java.lang.Objectget(java.lang.String key)Get the value for the given key.(package private) BnfgetBnf()Get the BNF object.(package private) java.lang.StringgetCommand(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.ConnectiongetConnection()(package private) DbContentsgetContents()(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.DatabaseMetaDatagetMetaData()(package private) booleangetShutdownServerOnDisconnect()(package private) voidloadBnf()Load the SQL grammar BNF.(package private) voidput(java.lang.String key, java.lang.Object value)Put an attribute value in the map.(package private) java.lang.Objectremove(java.lang.String key)Remove a session attribute from the map.(package private) voidsetConnection(java.sql.Connection conn)(package private) voidsetShutdownServerOnDisconnect()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.
-
-