Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d69f1d98
提交
d69f1d98
authored
11月 04, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improved support for GAE for Java thanks to Vince Bonfanti.
上级
195c8b6e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
1816 行增加
和
1807 行删除
+1816
-1807
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+1797
-1777
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+19
-30
没有找到文件。
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
d69f1d98
...
...
@@ -385,6 +385,11 @@ public class WebApp implements DatabaseEventListener {
return
"helpTranslate.jsp"
;
}
/**
* Stop the application and the server.
*
* @return the page to display
*/
protected
String
adminShutdown
()
{
server
.
shutdown
();
return
"admin.jsp"
;
...
...
@@ -813,15 +818,17 @@ public class WebApp implements DatabaseEventListener {
return
getStackTrace
(
0
,
e
,
isH2
);
}
pr
otected
String
login
()
{
final
String
driver
=
attributes
.
getProperty
(
"driver"
,
""
);
final
String
url
=
attributes
.
getProperty
(
"url"
,
""
);
final
String
user
=
attributes
.
getProperty
(
"user"
,
""
);
final
String
password
=
attributes
.
getProperty
(
"password"
,
""
);
pr
ivate
String
login
()
{
String
driver
=
attributes
.
getProperty
(
"driver"
,
""
);
String
url
=
attributes
.
getProperty
(
"url"
,
""
);
String
user
=
attributes
.
getProperty
(
"user"
,
""
);
String
password
=
attributes
.
getProperty
(
"password"
,
""
);
session
.
put
(
"autoCommit"
,
"checked"
);
session
.
put
(
"autoComplete"
,
"1"
);
session
.
put
(
"maxrows"
,
"1000"
);
if
(
loginAsync
(
driver
,
url
,
user
,
password
))
{
return
""
;
}
boolean
isH2
=
url
.
startsWith
(
"jdbc:h2:"
);
try
{
Connection
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
,
this
);
...
...
@@ -837,6 +844,19 @@ public class WebApp implements DatabaseEventListener {
}
}
/**
* Login in a separate thread if possible.
*
* @param driver the driver class
* @param url the database URL
* @param user the user name
* @param password the password
* @return false if asynchronous login is not possible
*/
protected
boolean
loginAsync
(
String
driver
,
String
url
,
String
user
,
String
password
)
{
return
false
;
}
private
String
logout
()
{
try
{
Connection
conn
=
session
.
getConnection
();
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
d69f1d98
...
...
@@ -48,11 +48,19 @@ class WebThread extends WebApp implements Runnable {
thread
=
new
Thread
(
this
,
"H2 Console thread"
);
}
public
void
start
()
{
/**
* Start the thread.
*/
void
start
()
{
thread
.
start
();
}
public
void
join
(
int
millis
)
throws
InterruptedException
{
/**
* Wait until the thread is stopped.
*
* @param millis the maximum number of milliseconds to wait
*/
void
join
(
int
millis
)
throws
InterruptedException
{
thread
.
join
(
millis
);
}
...
...
@@ -277,33 +285,14 @@ class WebThread extends WebApp implements Runnable {
return
super
.
adminShutdown
();
}
protected
String
login
()
{
final
String
driver
=
attributes
.
getProperty
(
"driver"
,
""
);
final
String
url
=
attributes
.
getProperty
(
"url"
,
""
);
final
String
user
=
attributes
.
getProperty
(
"user"
,
""
);
final
String
password
=
attributes
.
getProperty
(
"password"
,
""
);
session
.
put
(
"autoCommit"
,
"checked"
);
session
.
put
(
"autoComplete"
,
"1"
);
session
.
put
(
"maxrows"
,
"1000"
);
boolean
thread
=
false
;
if
(
socket
!=
null
&&
url
.
startsWith
(
"jdbc:h2:"
)
&&
!
url
.
startsWith
(
"jdbc:h2:tcp:"
)
&&
!
url
.
startsWith
(
"jdbc:h2:ssl:"
)
&&
!
url
.
startsWith
(
"jdbc:h2:mem:"
))
{
thread
=
true
;
}
if
(!
thread
)
{
boolean
isH2
=
url
.
startsWith
(
"jdbc:h2:"
);
try
{
Connection
conn
=
server
.
getConnection
(
driver
,
url
,
user
,
password
,
this
);
session
.
setConnection
(
conn
);
session
.
put
(
"url"
,
url
);
session
.
put
(
"user"
,
user
);
session
.
remove
(
"error"
);
settingSave
();
return
"frame.jsp"
;
}
catch
(
Exception
e
)
{
session
.
put
(
"error"
,
getLoginError
(
e
,
isH2
));
return
"login.jsp"
;
}
protected
boolean
loginAsync
(
final
String
driver
,
final
String
url
,
final
String
user
,
final
String
password
)
{
if
(
socket
==
null
||
!
url
.
startsWith
(
"jdbc:h2:"
)
||
url
.
startsWith
(
"jdbc:h2:tcp:"
)
||
url
.
startsWith
(
"jdbc:h2:ssl:"
)
||
url
.
startsWith
(
"jdbc:h2:mem:"
))
{
// async login only possible for H2 embedded
return
false
;
}
/**
...
...
@@ -422,7 +411,7 @@ class WebThread extends WebApp implements Runnable {
}
catch
(
IOException
e
)
{
// ignore
}
return
""
;
return
true
;
}
private
boolean
allow
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论