Skip to content

Commit 0ecbd7a

Browse files
committed
Merge pull request #123 from qq254963746/develop
Develop
2 parents 86b7b35 + 107c911 commit 0ecbd7a

File tree

50 files changed

+105
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+105
-36
lines changed

build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ start mvn clean install -DskipTests
44
echo "LTS: mvn clean install -DskipTests"
55
echo "LTS: After sub window finished, close it , and press any key to continue" & pause>nul
66

7-
set VERSION=1.6.0-SNAPSHOT
7+
set VERSION=1.6.0-beta2
88
set BASE_HOME=%~dp0%
99
set DIST_BIN_DIR=lts-%VERSION%-bin
1010

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
VERSION="1.6.0-SNAPSHOT"
3+
VERSION="1.6.0-beta2"
44

55
LTS_BIN="${BASH_SOURCE-$0}"
66
LTS_BIN="$(dirname "${LTS_BIN}")"

lts-admin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>lts-parent</artifactId>
77
<groupId>com.lts</groupId>
8-
<version>1.6.0-SNAPSHOT</version>
8+
<version>1.6.0-beta2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<packaging>war</packaging>

lts-admin/src/main/java/com/lts/web/support/H2ConsoleWebServlet.java

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,85 @@
33
import com.lts.core.constant.Constants;
44
import org.h2.server.web.WebServlet;
55

6+
import javax.servlet.ServletConfig;
67
import javax.servlet.ServletContext;
8+
import javax.servlet.ServletException;
9+
import java.util.Collections;
10+
import java.util.Enumeration;
11+
import java.util.HashMap;
12+
import java.util.Map;
713

814
/**
915
* H2 Console 的 servlet
16+
*
1017
* @author Robert HG ([email protected]) on 9/26/15.
1118
*/
1219
public class H2ConsoleWebServlet extends WebServlet {
1320

1421
@Override
15-
public void init() {
22+
public void init(ServletConfig config) throws ServletException {
23+
ServletConfigFacade servletConfigFacade = new ServletConfigFacade(config);
1624

17-
ServletContext servletContext = this.getServletConfig().getServletContext();
1825
String monitorDBPath = AppConfigurer.getProperties("lts.admin.data.path",
1926
Constants.USER_HOME) + "/.lts/h2/lts-admin";
2027
// http://h2database.com/html/features.html#connection_modes
2128
// http://h2database.com/html/features.html#auto_mixed_mode
22-
String url = "jdbc:h2:" + monitorDBPath+";AUTO_SERVER=TRUE";
23-
servletContext.setInitParameter("url", url);
24-
servletContext.setInitParameter("user", "lts");
25-
servletContext.setInitParameter("password", "");
29+
String url = "jdbc:h2:" + monitorDBPath + ";AUTO_SERVER=TRUE";
30+
servletConfigFacade.setInitParameter("url", url);
31+
servletConfigFacade.setInitParameter("user", "lts");
32+
servletConfigFacade.setInitParameter("password", "");
33+
servletConfigFacade.setInitParameter("webAllowOthers", "true");
2634

27-
super.init();
35+
super.init(servletConfigFacade);
2836
}
2937
}
38+
39+
/**
40+
* 主要为解决 jetty embedded 的问题
41+
*/
42+
class ServletConfigFacade implements ServletConfig {
43+
44+
private ServletConfig servletConfig;
45+
46+
private Map<String, String> initParams;
47+
48+
public ServletConfigFacade(ServletConfig servletConfig) {
49+
this.servletConfig = servletConfig;
50+
this.initParams = new HashMap<String, String>();
51+
52+
initParams();
53+
}
54+
55+
private void initParams() {
56+
Enumeration<?> en = servletConfig.getInitParameterNames();
57+
while (en.hasMoreElements()) {
58+
String name = en.nextElement().toString();
59+
String value = servletConfig.getInitParameter(name);
60+
initParams.put(name, value);
61+
}
62+
}
63+
64+
@Override
65+
public String getServletName() {
66+
return servletConfig.getServletName();
67+
}
68+
69+
@Override
70+
public ServletContext getServletContext() {
71+
return servletConfig.getServletContext();
72+
}
73+
74+
@Override
75+
public String getInitParameter(String name) {
76+
return initParams.get(name);
77+
}
78+
79+
@Override
80+
public Enumeration<String> getInitParameterNames() {
81+
return Collections.enumeration(initParams.keySet());
82+
}
83+
84+
public void setInitParameter(String name, String value) {
85+
initParams.put(name, value);
86+
}
87+
}

lts-admin/src/main/java/com/lts/web/support/LtsAdminJobClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.lts.web.support;
22

33
import com.lts.core.commons.utils.StringUtils;
4+
import com.lts.core.constant.Constants;
45
import com.lts.core.domain.Job;
56
import com.lts.jobclient.JobClient;
67
import com.lts.jobclient.domain.Response;
@@ -27,6 +28,7 @@ public void afterPropertiesSet() throws Exception {
2728
if (StringUtils.isEmpty(clusterName)) {
2829
throw new IllegalArgumentException("clusterName in lts-admin.cfg can not be null.");
2930
}
31+
jobClient.setFailStorePath(AppConfigurer.getProperties("lts.admin.data.path", Constants.USER_HOME));
3032
jobClient.setClusterName(clusterName);
3133
jobClient.setRegistryAddress(AppConfigurer.getProperties("registryAddress"));
3234

lts-admin/src/main/resources/spring-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
4040
<property name="configLocation">
41-
<value>/views/velocity.properties</value>
41+
<value>/WEB-INF/views/velocity.properties</value>
4242
</property>
4343
</bean>
4444
<bean id="viewResolver"

0 commit comments

Comments
 (0)