优化代码生成模块
This commit is contained in:
parent
ff8f02759e
commit
44a378ff53
7
pom.xml
7
pom.xml
|
|
@ -122,6 +122,13 @@
|
|||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--mysql -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ public class SysCache implements ConstCache, ConstCacheKey{
|
|||
return Blade.create(Role.class).findById(roleId);
|
||||
}
|
||||
});
|
||||
sb.append(role.getName()).append(",");
|
||||
if (null != role)
|
||||
sb.append(role.getName()).append(",");
|
||||
}
|
||||
return StrKit.removeSuffix(sb.toString(), ",");
|
||||
}
|
||||
|
|
@ -113,7 +114,8 @@ public class SysCache implements ConstCache, ConstCacheKey{
|
|||
return Blade.create(Role.class).findById(roleId);
|
||||
}
|
||||
});
|
||||
sb.append(role.getTips()).append(",");
|
||||
if (null != role)
|
||||
sb.append(role.getTips()).append(",");
|
||||
}
|
||||
return StrKit.removeSuffix(sb.toString(), ",");
|
||||
}
|
||||
|
|
@ -155,7 +157,8 @@ public class SysCache implements ConstCache, ConstCacheKey{
|
|||
return Blade.create(Dept.class).findById(deptId);
|
||||
}
|
||||
});
|
||||
sb.append(dept.getSimplename()).append(",");
|
||||
if (null != dept)
|
||||
sb.append(dept.getSimplename()).append(",");
|
||||
}
|
||||
return StrKit.removeSuffix(sb.toString(), ",");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,24 @@
|
|||
/**
|
||||
* Copyright (c) 2015-2016, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.smallchill.core.toolbox.kit;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
|
@ -32,7 +27,121 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|||
import com.smallchill.core.toolbox.support.WafRequestWrapper;
|
||||
|
||||
public class HttpKit {
|
||||
private static PoolingHttpClientConnectionManager cm;
|
||||
private static String EMPTY_STR = "";
|
||||
private static String UTF_8 = "UTF-8";
|
||||
|
||||
private static void init() {
|
||||
if (cm == null) {
|
||||
cm = new PoolingHttpClientConnectionManager();
|
||||
cm.setMaxTotal(50);// 整个连接池最大连接数
|
||||
cm.setDefaultMaxPerRoute(5);// 每路由最大连接数,默认值是2
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过连接池获取HttpClient
|
||||
*/
|
||||
private static CloseableHttpClient getHttpClient() {
|
||||
init();
|
||||
return HttpClients.custom().setConnectionManager(cm).build();
|
||||
}
|
||||
|
||||
public static String get(String url) {
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
return getResult(httpGet);
|
||||
}
|
||||
|
||||
public static String get(String url, Map<String, Object> params) throws URISyntaxException {
|
||||
URIBuilder ub = new URIBuilder();
|
||||
ub.setPath(url);
|
||||
|
||||
ArrayList<NameValuePair> pairs = covertParams2NVPS(params);
|
||||
ub.setParameters(pairs);
|
||||
|
||||
HttpGet httpGet = new HttpGet(ub.build());
|
||||
return getResult(httpGet);
|
||||
}
|
||||
|
||||
public static String get(String url, Map<String, Object> headers, Map<String, Object> params) throws URISyntaxException {
|
||||
URIBuilder ub = new URIBuilder();
|
||||
ub.setPath(url);
|
||||
|
||||
ArrayList<NameValuePair> pairs = covertParams2NVPS(params);
|
||||
ub.setParameters(pairs);
|
||||
|
||||
HttpGet httpGet = new HttpGet(ub.build());
|
||||
for (Map.Entry<String, Object> param : headers.entrySet()) {
|
||||
httpGet.addHeader(param.getKey(), String.valueOf(param.getValue()));
|
||||
}
|
||||
return getResult(httpGet);
|
||||
}
|
||||
|
||||
public static String post(String url) {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
return getResult(httpPost);
|
||||
}
|
||||
|
||||
public static String post(String url, Map<String, Object> params) throws UnsupportedEncodingException {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
ArrayList<NameValuePair> pairs = covertParams2NVPS(params);
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(pairs, UTF_8));
|
||||
return getResult(httpPost);
|
||||
}
|
||||
|
||||
public static String post(String url, Map<String, Object> headers, Map<String, Object> params) throws UnsupportedEncodingException {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
for (Map.Entry<String, Object> param : headers.entrySet()) {
|
||||
httpPost.addHeader(param.getKey(), String.valueOf(param.getValue()));
|
||||
}
|
||||
|
||||
ArrayList<NameValuePair> pairs = covertParams2NVPS(params);
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(pairs, UTF_8));
|
||||
|
||||
return getResult(httpPost);
|
||||
}
|
||||
|
||||
private static ArrayList<NameValuePair> covertParams2NVPS(Map<String, Object> params) {
|
||||
ArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();
|
||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||
pairs.add(new BasicNameValuePair(param.getKey(), String
|
||||
.valueOf(param.getValue())));
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Http请求
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private static String getResult(HttpRequestBase request) {
|
||||
// CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpClient httpClient = getHttpClient();
|
||||
try {
|
||||
CloseableHttpResponse response = httpClient.execute(request);
|
||||
// response.getStatusLine().getStatusCode();
|
||||
HttpEntity entity = response.getEntity();
|
||||
if (entity != null) {
|
||||
// long len = entity.getContentLength();// -1 表示长度未知
|
||||
String result = EntityUtils.toString(entity);
|
||||
response.close();
|
||||
// httpClient.close();
|
||||
return result;
|
||||
}
|
||||
} catch (ClientProtocolException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
}
|
||||
return EMPTY_STR;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 包装防Xss Sql注入的 HttpServletRequest
|
||||
* @return request
|
||||
|
|
@ -41,124 +150,5 @@ public class HttpKit {
|
|||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
return new WafRequestWrapper(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定URL发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的URL
|
||||
* @param param 请求参数
|
||||
* @return URL 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, Map<String, String> param) {
|
||||
String result = "";
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
String para = "";
|
||||
for (String key : param.keySet()) {
|
||||
para += (key + "=" + param.get(key) + "&");
|
||||
}
|
||||
if (para.lastIndexOf("&") > 0) {
|
||||
para = para.substring(0, para.length() - 1);
|
||||
}
|
||||
String urlNameString = url + "?" + para;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.out.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送GET请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输入流
|
||||
finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPost(String url, Map<String, String> param) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
String para = "";
|
||||
for (String key : param.keySet()) {
|
||||
para += (key + "=" + param.get(key) + "&");
|
||||
}
|
||||
if (para.lastIndexOf("&") > 0) {
|
||||
para = para.substring(0, para.length() - 1);
|
||||
}
|
||||
String urlNameString = url + "?" + para;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,22 @@ ${"@"}layout("/common/_curd/_container.html"){
|
|||
${"@"} var _col=[
|
||||
@trim(){
|
||||
@ for (attr in attrs) {
|
||||
@ var _attrName = attr.comment;
|
||||
@ if (isEmpty(_attrName)) {
|
||||
@ _attrName = attr.name;
|
||||
@}
|
||||
${"@"} {name:"${_attrName}", index:"${attr.name}", type:"text",newline:true,length:8,required:"required"},
|
||||
@ var _attrName = attr.comment;
|
||||
@ if (isEmpty(_attrName)) {
|
||||
@ _attrName = attr.name;
|
||||
@ }
|
||||
@ if(pkName == attr.name) {
|
||||
@ continue;
|
||||
@ }
|
||||
@ var newline = true;
|
||||
@ if(attrLP.odd) {
|
||||
@ newline = false;
|
||||
@ }
|
||||
@ var length = 3;
|
||||
@ if(attrLP.last && newline == true) {
|
||||
@ length = 8;
|
||||
@ }
|
||||
${"@"} {name:"${_attrName}", index:"${attr.name}", type:"text",newline:${newline},length:${length},required:"required"},
|
||||
@}
|
||||
@}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,22 @@ ${"@"}layout("/common/_curd/_container.html"){
|
|||
${"@"} var _col=[
|
||||
@trim(){
|
||||
@ for (attr in attrs) {
|
||||
@ var _attrName = attr.comment;
|
||||
@ if (isEmpty(_attrName)) {
|
||||
@ _attrName = attr.name;
|
||||
@}
|
||||
${"@"} {name:"${_attrName}", index:"${attr.name}", type:"text",newline:true,length:8,required:"required"},
|
||||
@ var _attrName = attr.comment;
|
||||
@ if (isEmpty(_attrName)) {
|
||||
@ _attrName = attr.name;
|
||||
@ }
|
||||
@ if(pkName == attr.name) {
|
||||
@ continue;
|
||||
@ }
|
||||
@ var newline = true;
|
||||
@ if(attrLP.odd) {
|
||||
@ newline = false;
|
||||
@ }
|
||||
@ var length = 3;
|
||||
@ if(attrLP.last && newline == true) {
|
||||
@ length = 8;
|
||||
@ }
|
||||
${"@"} {name:"${_attrName}", index:"${attr.name}", type:"text",newline:${newline},length:${length},required:"required"},
|
||||
@}
|
||||
@}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,22 @@ ${"@"}layout("/common/_curd/_container.html"){
|
|||
${"@"} var _col=[
|
||||
@trim(){
|
||||
@ for (attr in attrs) {
|
||||
@ var _attrName = attr.comment;
|
||||
@ if (isEmpty(_attrName)) {
|
||||
@ _attrName = attr.name;
|
||||
@}
|
||||
${"@"} {name:"${_attrName}", index:"${attr.name}", type:"text",newline:true,length:8},
|
||||
@ var _attrName = attr.comment;
|
||||
@ if (isEmpty(_attrName)) {
|
||||
@ _attrName = attr.name;
|
||||
@ }
|
||||
@ if(pkName == attr.name) {
|
||||
@ continue;
|
||||
@ }
|
||||
@ var newline = true;
|
||||
@ if(attrLP.odd) {
|
||||
@ newline = false;
|
||||
@ }
|
||||
@ var length = 3;
|
||||
@ if(attrLP.last && newline == true) {
|
||||
@ length = 8;
|
||||
@ }
|
||||
${"@"} {name:"${_attrName}", index:"${attr.name}", type:"text",newline:${newline},length:${length}},
|
||||
@}
|
||||
@}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,89 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="springBlade" metadata-complete="true" version="3.0">
|
||||
<display-name>springBlade</display-name>
|
||||
<servlet>
|
||||
<servlet-name>springmvc</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:/spring/springmvc-servlet.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>springmvc</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>com.smallchill.core.listener.ConfigListener</listener-class>
|
||||
</listener>
|
||||
<filter>
|
||||
<filter-name>SpringEncodingFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>UTF-8</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forceEncoding</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>SpringEncodingFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<filter>
|
||||
<filter-name>DruidWebStatFilter</filter-name>
|
||||
<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>exclusions</param-name>
|
||||
<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>DruidWebStatFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<servlet>
|
||||
<servlet-name>DruidStatView</servlet-name>
|
||||
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>DruidStatView</servlet-name>
|
||||
<url-pattern>/druid/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<filter>
|
||||
<filter-name>shiroFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
||||
<init-param>
|
||||
<param-name>targetFilterLifecycle</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>shiroFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
<dispatcher>REQUEST</dispatcher>
|
||||
<dispatcher>FORWARD</dispatcher>
|
||||
</filter-mapping>
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/error/error404</location>
|
||||
</error-page>
|
||||
<mime-mapping>
|
||||
<extension>apk</extension>
|
||||
<mime-type>application/vnd.android.package-archive</mime-type>
|
||||
</mime-mapping>
|
||||
<mime-mapping>
|
||||
<extension>ipa</extension>
|
||||
<mime-type>application/vnd.iphone</mime-type>
|
||||
</mime-mapping>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
id="springBlade" metadata-complete="true" version="3.0">
|
||||
<display-name>springBlade</display-name>
|
||||
<servlet>
|
||||
<servlet-name>springmvc</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:/spring/springmvc-servlet.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
<async-supported>true</async-supported>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>springmvc</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>com.smallchill.core.listener.ConfigListener</listener-class>
|
||||
</listener>
|
||||
<filter>
|
||||
<filter-name>SpringEncodingFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>UTF-8</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forceEncoding</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>SpringEncodingFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<filter>
|
||||
<filter-name>DruidWebStatFilter</filter-name>
|
||||
<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>exclusions</param-name>
|
||||
<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>DruidWebStatFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<servlet>
|
||||
<servlet-name>DruidStatView</servlet-name>
|
||||
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>DruidStatView</servlet-name>
|
||||
<url-pattern>/druid/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<filter>
|
||||
<filter-name>shiroFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
||||
<init-param>
|
||||
<param-name>targetFilterLifecycle</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>shiroFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
<dispatcher>REQUEST</dispatcher>
|
||||
<dispatcher>FORWARD</dispatcher>
|
||||
</filter-mapping>
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/error/error404</location>
|
||||
</error-page>
|
||||
<mime-mapping>
|
||||
<extension>apk</extension>
|
||||
<mime-type>application/vnd.android.package-archive</mime-type>
|
||||
</mime-mapping>
|
||||
<mime-mapping>
|
||||
<extension>ipa</extension>
|
||||
<mime-type>application/vnd.iphone</mime-type>
|
||||
</mime-mapping>
|
||||
</web-app>
|
||||
Loading…
Reference in New Issue
Block a user