修改代码

master
星期八 5 years ago
parent 0a3d972300
commit f8ee9013a4
  1. 9
      README.md
  2. 5
      panda-aop/src/main/java/org/panda/aop/util/InterfaceProxyFactoryUtil.java
  3. 68
      panda-aop/src/test/java/org/panda/code/uitl/DateUtilTest.java
  4. 1
      panda-beans/src/main/java/org/panda/beans/exception/BeansException.java
  5. 6
      panda-beans/src/main/java/org/panda/beans/util/ClassUtil.java
  6. 1
      panda-code/README.md
  7. 4
      panda-code/src/main/java/org/panda/code/uitl/CodecUtil.java
  8. 5
      panda-code/src/main/java/org/panda/code/uitl/DataValidatorUtil.java
  9. 16
      panda-code/src/main/java/org/panda/code/uitl/DateUtil.java
  10. 2
      panda-code/src/main/java/org/panda/code/uitl/JsonUtil.java
  11. 22
      panda-code/src/main/java/org/panda/code/uitl/JvmUtil.java
  12. 1
      panda-code/src/main/java/org/panda/code/uitl/StreamUtil.java
  13. 6
      panda-code/src/main/java/org/panda/code/uitl/TestUtil.java
  14. 3
      panda-code/src/main/java/org/panda/code/uitl/http/HttpKit.java
  15. 2
      panda-code/src/main/java/org/panda/code/uitl/http/HttpUtil.java
  16. 11
      panda-code/src/main/java/org/panda/code/uitl/http/HttpsClient.java
  17. 2
      panda-code/src/main/java/org/panda/code/uitl/os/NetUtil.java
  18. 67
      panda-code/src/tests/java/org/panda/code/uitl/DateUtilTest.java
  19. 7
      panda-jdbc/panda-jdbc.iml
  20. 3
      panda-jdbc/src/main/java/org/panda/jdbc/JdbcLoad.java
  21. 2
      panda-jdbc/src/main/java/org/panda/jdbc/JdbcUtils.java
  22. 7
      panda-jdbc/src/main/java/org/panda/jdbc/config/DbConfigConstant.java
  23. 1
      panda-jdbc/src/main/java/org/panda/jdbc/pool/JdbcPool.java
  24. 9
      panda-jdbc/src/main/java/org/panda/jdbc/sql/BeanSqlUtil.java
  25. 5
      panda-jdbc/src/main/java/org/panda/jdbc/sql/SqlConstant.java
  26. 2
      panda-jdbc/src/main/java/org/panda/jdbc/sql/builder/AbstractDbBuiler.java
  27. 13
      panda-web/src/main/java/org/panda/App.java
  28. 3
      panda-web/src/main/java/org/panda/web/helper/AopHelper.java
  29. 1
      panda-web/src/main/java/org/panda/web/helper/BeanHelper.java
  30. 1
      panda-web/src/main/java/org/panda/web/helper/ConfigHelper.java
  31. 1
      panda-web/src/main/java/org/panda/web/helper/ControllerHelper.java
  32. 3
      panda-web/src/main/java/org/panda/web/helper/HelperLoader.java
  33. 1
      panda-web/src/main/java/org/panda/web/helper/IocHelper.java
  34. 3
      panda-web/src/main/java/org/panda/web/helper/RequestHelper.java
  35. 1
      panda-web/src/main/java/org/panda/web/helper/ServletHelper.java
  36. 1
      panda-web/src/main/java/org/panda/web/helper/UploadHelper.java
  37. 1
      panda-web/src/main/java/org/panda/web/mode/Data.java
  38. 21
      panda-web/src/main/java/org/panda/web/mode/FileParam.java
  39. 3
      panda-web/src/main/java/org/panda/web/mode/FormParam.java
  40. 1
      panda-web/src/main/java/org/panda/web/mode/Handler.java
  41. 5
      panda-web/src/main/java/org/panda/web/mode/Param.java
  42. 1
      panda-web/src/main/java/org/panda/web/mode/Request.java
  43. 1
      panda-web/src/main/java/org/panda/web/mode/View.java
  44. 17
      panda-web/src/main/java/org/panda/web/servlet/DispatcherServlet.java

@ -1,4 +1,9 @@
#熊猫框架
熊猫框架
====================
##开发环境
###开发环境
1. mavne3
2. jdk1.8

@ -11,6 +11,7 @@ import java.lang.reflect.Proxy;
/**
* 为接口提供动态代理方式可以尝试模拟 JPA
* Created by qi_liang on 2018/4/23.
* @author qi
*/
public class InterfaceProxyFactoryUtil implements InvocationHandler {
@ -51,7 +52,9 @@ public class InterfaceProxyFactoryUtil implements InvocationHandler {
return result;
}
//后置增强
/**
* 后置增强
*/
private void after(){
System.out.println("后置增强");
}

@ -0,0 +1,68 @@
package org.panda.code.uitl;
import org.junit.Test;
import java.text.ParseException;
import java.util.Date;
/**
* 核心包-日期工具类测试
* @author qi
*
*/
public class DateUtilTest {
/**
* 日期格式化采用默认格式yyyy-MM-dd HH:mm:ss
*/
@Test
public void getDateToStr() {
String dateToStr = DateUtil.getDateToStr(new Date());
System.out.println(dateToStr);
String dateToStr2 = DateUtil.getDateToStr(null);
System.out.println(dateToStr2);
}
/**
*日期格式化
*/
@Test
public void getDateToStr1() {
String dateToStr = DateUtil.getDateToStr(new Date(),"yyyy-MM-dd HH:mm");
System.out.println(dateToStr);
}
/**
* 字符串转日期
*/
@Test
public void strToDate() {
try {
Date date = DateUtil.strToDate("2020-01-20 22:51","yyyy-MM-dd HH:mm");
System.out.println(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void disparityDay() {
try {
Date starDate = DateUtil.strToDate("2019-01-22","yyyy-MM-dd");
Date endDate = DateUtil.strToDate("2019-02-24","yyyy-MM-dd");
System.out.println(endDate);
int day = DateUtil.disparityDay(starDate,endDate);
System.out.println(day);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void dataFormat() {
}
}

@ -2,6 +2,7 @@ package org.panda.beans.exception;
/**
* bean 自定义异常
* @author qi
*/
public class BeansException extends Exception{

@ -76,9 +76,9 @@ public class ClassUtil {
String packagePath = url.getPath().replace("%20","");
addClass(classSet,packagePath,packageName);
}else if ("".equals(protocol)){
JarURLConnection jarURLConnection =(JarURLConnection) url.openConnection();
if (jarURLConnection!=null){
JarFile jarFile = jarURLConnection.getJarFile();
JarURLConnection jarUrlConnection =(JarURLConnection) url.openConnection();
if (jarUrlConnection!=null){
JarFile jarFile = jarUrlConnection.getJarFile();
if (jarFile!=null){
Enumeration<JarEntry> jarEntries = jarFile.entries();
while (jarEntries.hasMoreElements()){

@ -0,0 +1 @@
##熊猫框架-核心包

@ -21,7 +21,7 @@ public final class CodecUtil {
* @param source
* @return
*/
public static String encodeURL(String source){
public static String encodeUrl(String source){
String target;
try {
@ -38,7 +38,7 @@ public final class CodecUtil {
* @param source
* @return
*/
public static String decodeURL(String source){
public static String decodeUrl(String source){
String target;
try {

@ -4,6 +4,7 @@ import java.util.regex.Pattern;
/**
* Created by qi_liang on 2018/1/25.
* @author qi
*/
public class DataValidatorUtil {
@ -103,7 +104,7 @@ public class DataValidatorUtil {
* @param idCard
* @return 校验通过返回true否则返回false
*/
public static boolean isIDCard(String idCard) {
public static boolean isIdCard(String idCard) {
return Pattern.matches(REGEX_ID_CARD, idCard);
}
@ -123,7 +124,7 @@ public class DataValidatorUtil {
* @param ipAddr
* @return
*/
public static boolean isIPAddr(String ipAddr) {
public static boolean isIpAddr(String ipAddr) {
return Pattern.matches(REGEX_IP_ADDR, ipAddr);
}

@ -7,10 +7,12 @@ import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
/**
* Created by qi_liang on 2018/1/26.
* @author qi
*/
public class DateUtil {
@ -67,14 +69,19 @@ public class DateUtil {
}
/**
*
* 两个日期相差多少日
* @param startDate
* @param endDate
* @return
*/
public static int disparityDay(Date startDate,Date endDate){
int day = (int)(endDate.getTime()-startDate.getTime())/(24*60*60*1000);
return day;
public static int disparityDay(Date startDate,Date endDate){
long endTime = endDate.getTime();
long starTime = startDate.getTime();
if (endTime>starTime) {
int day = new Long((endDate.getTime() - startDate.getTime()) / (24 * 60 * 60 * 1000)).intValue();
return day;
}
return 0;
}
/**
@ -92,6 +99,7 @@ public class DateUtil {
DecimalFormat df = new DecimalFormat("00");
return df.format(hour)+":"+df.format(minute)+":"+df.format(second);
}

@ -12,6 +12,8 @@ import java.io.IOException;
*/
public class JsonUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

@ -11,6 +11,16 @@ import java.util.Locale;
* Created by qi_liang on 2018/5/25.
*/
public class JvmUtil {
/**
* -分钟单位
*/
private static final int SECONDS_MINUTE_UNIT = 60;
/**
* -时单位
*/
private static final int MINUTES_HOURS_UNIT = 24;
private final int Kb = 1024;
private NumberFormat fmtI = new DecimalFormat("###,###", new DecimalFormatSymbols(Locale.ENGLISH));
private NumberFormat fmtD = new DecimalFormat("###,##0.000", new DecimalFormatSymbols(Locale.ENGLISH));
@ -51,28 +61,28 @@ public class JvmUtil {
protected String toDuration(double uptime) {
uptime /= 1000;
if (uptime < 60) {
if (uptime < SECONDS_MINUTE_UNIT) {
return fmtD.format(uptime) + " seconds";
}
uptime /= 60;
if (uptime < 60) {
if (uptime < SECONDS_MINUTE_UNIT) {
long minutes = (long) uptime;
String s = fmtI.format(minutes) + (minutes > 1 ? " minutes" : " minute");
return s;
}
uptime /= 60;
if (uptime < 24) {
if (uptime < MINUTES_HOURS_UNIT) {
long hours = (long) uptime;
long minutes = (long) ((uptime - hours) * 60);
long minutes = (long) ((uptime - hours) * SECONDS_MINUTE_UNIT);
String s = fmtI.format(hours) + (hours > 1 ? " hours" : " hour");
if (minutes != 0) {
s += " " + fmtI.format(minutes) + (minutes > 1 ? " minutes" : " minute");
}
return s;
}
uptime /= 24;
uptime /= MINUTES_HOURS_UNIT;
long days = (long) uptime;
long hours = (long) ((uptime - days) * 24);
long hours = (long) ((uptime - days) * MINUTES_HOURS_UNIT);
String s = fmtI.format(days) + (days > 1 ? " days" : " day");
if (hours != 0) {
s += " " + fmtI.format(hours) + (hours > 1 ? " hours" : " hour");

@ -8,6 +8,7 @@ import java.io.*;
/**
* 流操作工具类
* @author qi
*/
public class StreamUtil {

@ -10,6 +10,7 @@ import java.util.*;
/**
* Created by qi_liang on 2018/5/27.
* @author qi
*/
public class TestUtil {
@ -25,7 +26,7 @@ public class TestUtil {
}
public void showURL() throws IOException, IOException {
public void showUrl() throws IOException, IOException {
// 第一种:获取类加载的根路径 D:\git\daotie\daotie\target\classes
File f = new File(this.getClass().getResource("/").getPath());
@ -36,7 +37,8 @@ public class TestUtil {
System.out.println(f2);
// 第二种:获取项目路径 D:\git\daotie\daotie
File directory = new File("");// 参数为空
// 参数为空
File directory = new File("");
String courseFile = directory.getCanonicalPath();
System.out.println(courseFile);

@ -2,10 +2,11 @@
* 微信公众平台开发模式
*
*/
package org.panda.code.uitl;
package org.panda.code.uitl.http;
import org.apache.log4j.Logger;
import org.panda.code.uitl.StringUtil;
import java.io.BufferedReader;
import java.io.InputStream;

@ -1,4 +1,4 @@
package org.panda.code.uitl;
package org.panda.code.uitl.http;
import java.io.BufferedReader;
import java.io.InputStreamReader;

@ -1,7 +1,6 @@
package org.panda.code.uitl.http;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
@ -19,10 +18,12 @@ import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import java.io.*;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @author qi
*/
public class HttpsClient {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpsClient.class);
@ -64,7 +65,7 @@ public class HttpsClient {
// 建造我们的http多媒体对象
HttpEntity he = mBuilder.build();
// 建立一个sslcontext,这里我们信任任何的证书。
SSLContext context = getTrustAllSSLContext();
SSLContext context = getTrustAllSslContext();
// 建立socket工厂
SSLConnectionSocketFactory factory = new SSLConnectionSocketFactory(
context);
@ -91,10 +92,8 @@ public class HttpsClient {
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
// 关闭返回的reponse
@ -142,7 +141,7 @@ public class HttpsClient {
return get;
}
private static SSLContext getTrustAllSSLContext() throws Exception {
private static SSLContext getTrustAllSslContext() throws Exception {
// SSLContext context = SSLContexts.custom().loadTrustMaterial(null, new TrustStrategy() {
//
// @Override

@ -10,7 +10,7 @@ import java.net.UnknownHostException;
*/
public class NetUtil {
public static String getIP(){
public static String getIp(){
String ip = null;
try {
InetAddress address = InetAddress.getLocalHost();

@ -0,0 +1,67 @@
package org.panda.code.uitl;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.Test;
import java.text.ParseException;
import java.util.Date;
public class DateUtilTest {
/**
* 日期格式化采用默认格式yyyy-MM-dd HH:mm:ss
*/
@Test
public void getDateToStr() {
String dateToStr = DateUtil.getDateToStr(new Date());
System.out.println(dateToStr);
String dateToStr2 = DateUtil.getDateToStr(null);
System.out.println(dateToStr2);
}
/**
*日期格式化
*/
@Test
public void getDateToStr1() {
String dateToStr = DateUtil.getDateToStr(new Date(),"yyyy-MM-dd HH:mm");
System.out.println(dateToStr);
}
/**
* 字符串转日期
*/
@Test
public void strToDate() {
try {
Date date = DateUtil.strToDate("2020-01-20 22:51","yyyy-MM-dd HH:mm");
System.out.println(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void disparityDay() {
try {
Date starDate = DateUtil.strToDate("2019-01-22","yyyy-MM-dd");
Date endDate = DateUtil.strToDate("2020-02-24","yyyy-MM-dd");
System.out.println((endDate.getTime()-starDate.getTime())/(24*60*60*1000)) ;
System.out.println((24*60*60*1000));
int day = DateUtil.disparityDay(starDate,endDate);
System.out.println(day);
} catch (ParseException e) {
e.printStackTrace();
}
}
@Test
public void dataFormat() {
}
}

@ -6,17 +6,10 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.40" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="panda-code" />

@ -2,6 +2,9 @@ package org.panda.jdbc;
import org.panda.jdbc.helper.DbConfigInterface;
/**
* @author qi
*/
public class JdbcLoad {
private String driver = null;

@ -51,7 +51,7 @@ public class JdbcUtils {
*
* @return
*/
public DbInfo getDBInfo() {
public DbInfo getDbInfo() {
Connection conn = null;
DatabaseMetaData metaData;
DbInfo dbInfo = new DbInfo();

@ -1,8 +1,13 @@
package org.panda.jdbc.config;
/**
* @author qi
*/
public class DbConfigConstant {
//读取配置文件位置
/**
* 读取配置文件位置
*/
public static final String CONFIG_FILE="smart.properties";
public static final String JDBC_DRIVER = "jdbc.driver";

@ -14,6 +14,7 @@ import java.util.logging.Logger;
*/
public class JdbcPool implements DataSource {
/**
* 获取连接
* @return

@ -15,11 +15,6 @@ import java.util.Map;
*/
public class BeanSqlUtil {
/**
* 驼峰下滑线
*/
public static final String SQL_CHARACTER = "_";
/**
* 大小写转化驼峰
* @param str
@ -34,7 +29,7 @@ public class BeanSqlUtil {
continue;
}
if (Character.isUpperCase(charArray[i])){
strBuffer.append(SQL_CHARACTER+charArray[i]);
strBuffer.append(SqlConstant.SQL_SYMBOL+charArray[i]);
}else {
strBuffer.append(charArray[i]);
}
@ -51,7 +46,7 @@ public class BeanSqlUtil {
StringBuffer strBuffer=new StringBuffer();
char[] charArray=str.toCharArray();
for (int i=0;i<charArray.length;i++){
if (SQL_CHARACTER.equals(charArray[i])){
if (SqlConstant.SQL_SYMBOL.equals(charArray[i])){
i++;
strBuffer.append(Character.toUpperCase(charArray[i]));
}else {

@ -28,5 +28,10 @@ public class SqlConstant {
* 常用SQL 关键字:order
*/
public static final String ORDER_SQL="ORDER";
/**
* sql 括号
*/
public final static String SQL_BRACKETS = ")";
}

@ -95,7 +95,7 @@ public abstract class AbstractDbBuiler {
//SQL 转成大写适
String upperCaseSql = sql.toUpperCase();
//统计SQL排除排序SQL代码
if (sql.lastIndexOf(SqlConstant.ORDER_SQL)>sql.lastIndexOf(")")){
if (sql.lastIndexOf(SqlConstant.ORDER_SQL)>sql.lastIndexOf(SqlConstant.SQL_BRACKETS)){
sb.append(sql.substring(upperCaseSql.indexOf(SqlConstant.FROM_SQL)+SqlConstant.FROM_SQL.length(),upperCaseSql.lastIndexOf(SqlConstant.ORDER_SQL)));
}else{
sb.append(sql.substring(upperCaseSql.indexOf(SqlConstant.FROM_SQL)+SqlConstant.FROM_SQL.length()));

@ -1,13 +0,0 @@
package org.panda;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

@ -14,6 +14,7 @@ import java.util.*;
/**
* 方法拦截助手类
* @author qi
*/
public final class AopHelper {
@ -40,7 +41,7 @@ public final class AopHelper {
*/
private static Map<Class, Set<Class>> createProxyMap() {
//初始化结果集合
Map<Class, Set<Class>> proxyMap = new HashMap<>();
Map<Class, Set<Class>> proxyMap = new HashMap<>(16);
// //代理class 集合
// Set<Class> proxyClassSet = ClassHelper.getClasswetBySuper(AspectProxy.class);
// //代理集合遍历

@ -7,6 +7,7 @@ import java.util.Set;
/**
* Bean助手类
* @author qi
*/
public class BeanHelper {

@ -7,6 +7,7 @@ import java.util.Properties;
/**
* 属性文件助手类
* @author qi
*/
public class ConfigHelper {

@ -14,6 +14,7 @@ import java.util.Set;
/**
* 控制器助手
* @author qi
*/
public final class ControllerHelper {

@ -3,6 +3,9 @@ package org.panda.web.helper;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.panda.beans.util.ClassUtil;
/**
* @author qi
*/
public class HelperLoader {
public static void init() {

@ -11,6 +11,7 @@ import java.util.Map;
/**
* 依赖注入助手类
* @author qi
*/
public class IocHelper {

@ -15,6 +15,7 @@ import java.util.List;
/**
* 请求助手类
* @author qi
*/
public class RequestHelper {
@ -61,7 +62,7 @@ public class RequestHelper {
private static List<FormParam> parseInputStream(HttpServletRequest request) throws IOException {
List<FormParam> formParamList = new ArrayList<>();
String body = CodecUtil.decodeURL(StreamUtil.getString(request.getInputStream()));
String body = CodecUtil.decodeUrl(StreamUtil.getString(request.getInputStream()));
if (StringUtil.isNotNull(body)) {
String[] kvs = StringUtil.splistString(body, "&");
if (ArrayUtil.isNotEmpty(kvs)) {

@ -12,6 +12,7 @@ import java.io.IOException;
/**
* Servlet 助手类
* @author qi
*/
public class ServletHelper {

@ -22,6 +22,7 @@ import java.util.Map;
/**
* 文件上传助手类
* @author qi
*/
public class UploadHelper {

@ -2,6 +2,7 @@ package org.panda.web.mode;
/**
* 放回数据对象
* @author qi
*/
public class Data {

@ -4,18 +4,29 @@ import java.io.InputStream;
/**
* 封装上传文件参数
* @author qi
*/
public class FileParam {
//文件表单字段
/**
* 文件表单字段
*/
private String fieldName;
//文件名称
/**
* 文件名称
*/
private String fileName;
//文件大小
/**
* 文件大小
*/
private Long fileSize;
//上传文件的contentType,可判断文件类型
/**
* 上传文件的contentType可判断文件类型
*/
private String contentType;
//文件字节流
/**
* 文件字节流
*/
private InputStream inputStream;
public FileParam(String fieldName, String fileName, Long fileSize, String contentType, InputStream inputStream) {

@ -1,5 +1,8 @@
package org.panda.web.mode;
/**
* @author qi
*/
public class FormParam {
private String fieldName;

@ -4,6 +4,7 @@ import java.lang.reflect.Method;
/**
* 封装Action 信息
* @author qi
*/
public class Handler {

@ -11,6 +11,7 @@ import java.util.Map;
/**
* 请求参数对象
* @author qi
*/
public class Param {
@ -28,7 +29,7 @@ public class Param {
}
public Map<String,Object> getFieldMap(){
Map<String,Object> fieldMap = new HashMap<>();
Map<String,Object> fieldMap = new HashMap<>(formParamsList.size());
if (CollectionUtil.isNotEmpty(formParamsList)){
formParamsList.forEach((formParam)->{
String fieldName = formParam.getFieldName();
@ -47,7 +48,7 @@ public class Param {
* @return
*/
public Map<String,List<FileParam>> getFileMap(){
Map<String,List<FileParam>> fileMap = new HashMap<>();
Map<String,List<FileParam>> fileMap = new HashMap<>(fileParamList.size());
if (CollectionUtil.isNotEmpty(fileParamList)){
fileParamList.forEach((fileParam)->{
String fieldName = fileParam.getFieldName();

@ -5,6 +5,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
* 封装请求信息
* @author qi
*/
public class Request {

@ -5,6 +5,7 @@ import java.util.Map;
/**
* 放回视图对象
* @author qi
*/
public class View {

@ -29,7 +29,7 @@ import java.util.Map;
/**
* @author qi
*/
//@WebServlet(urlPatterns = "/*",loadOnStartup = 0)
@WebServlet(urlPatterns = "/*",loadOnStartup = 0)
public class DispatcherServlet extends HttpServlet{
private final static Logger LOGGER = LoggerFactory.getLogger(DispatcherServlet.class);
@ -42,6 +42,11 @@ public class DispatcherServlet extends HttpServlet{
private final static String FAVICON_ICO = "/favicon.ico";
/**
* 路径切割符号
*/
public final static String PATH_CUT_SYMBOL = "/";
@Override
public void init(ServletConfig config) throws ServletException {
@ -110,11 +115,13 @@ public class DispatcherServlet extends HttpServlet{
}
//处理视图类视图返回值
/**
* 处理视图类视图返回值
*/
private void handleViewResult(View view,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
String path = view.getPaht();
if (StringUtil.isNotNull(path)){
if (path.startsWith("/")) {
if (path.startsWith(PATH_CUT_SYMBOL)) {
response.sendRedirect(request.getContextPath() + path);
} else {
Map<String,Object> model = view.getModel();
@ -127,7 +134,9 @@ public class DispatcherServlet extends HttpServlet{
}
}
//处理实体视图返回值
/**
* 处理实体视图返回值
*/
private void handleDateResult(Data data,HttpServletRequest request,HttpServletResponse response) throws IOException {
//返回json数据

Loading…
Cancel
Save