11 changed files with 143 additions and 25 deletions
@ -0,0 +1,6 @@ |
|||
# 数据库服务器配置 |
|||
type=com.alibaba.druid.pool.DruidDataSource |
|||
druid.driver-class=com.mysql.cj.jdbc.Driver |
|||
druid.url=jdbc:mysql://127.0.0.1:3306/wbfs?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 |
|||
druid.username=root |
|||
druid.password=root |
|||
@ -0,0 +1,46 @@ |
|||
package io.xtfs.jwebfs.web; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.web.error.ErrorAttributeOptions; |
|||
import org.springframework.boot.web.servlet.error.ErrorAttributes; |
|||
import org.springframework.boot.web.servlet.error.ErrorController; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.web.context.request.ServletWebRequest; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
|
|||
/** |
|||
* 系统默认错误页面 |
|||
*/ |
|||
|
|||
@RestController |
|||
public class ChErrorController implements ErrorController { |
|||
|
|||
@Autowired |
|||
private ErrorAttributes errorAttributes; |
|||
|
|||
/** |
|||
* 默认错误 |
|||
*/ |
|||
private static final String path_default = "/error"; |
|||
|
|||
public String getErrorPath() { |
|||
return path_default; |
|||
} |
|||
|
|||
/** |
|||
* JSON格式错误信息 |
|||
*/ |
|||
@RequestMapping(value = path_default, produces = {MediaType.APPLICATION_JSON_VALUE}) |
|||
public JSONObject error(HttpServletRequest request) { |
|||
JSONObject jsonObject =new JSONObject(); |
|||
ServletWebRequest servletWebRequest = new ServletWebRequest(request); |
|||
jsonObject.put("errmsg",errorAttributes.getErrorAttributes(servletWebRequest, ErrorAttributeOptions.defaults())); |
|||
return jsonObject; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package io.xtfs.jwebfs.web; |
|||
|
|||
|
|||
import org.apache.commons.logging.Log; |
|||
import org.apache.commons.logging.LogFactory; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.ui.Model; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.servlet.ModelAndView; |
|||
|
|||
|
|||
/** |
|||
* webfile 文件管理 |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/wbfs") |
|||
public class WbFileController { |
|||
private static final Log log = LogFactory.getLog(WbFileController.class); |
|||
|
|||
/** |
|||
* webfs home |
|||
* @param page |
|||
* @return |
|||
*/ |
|||
@RequestMapping("") |
|||
public ModelAndView wblist(@RequestParam(value = "page",defaultValue = "1") int page){ |
|||
long curts = System.currentTimeMillis(); |
|||
ModelAndView mv = new ModelAndView(); |
|||
mv.addObject("tstr",curts); |
|||
mv.setViewName("/wbfs/list"); |
|||
return mv; |
|||
} |
|||
/** |
|||
* 监视文件夹信息,如果有变动 发送变动的信息给 |
|||
* @param reqstr |
|||
* @return |
|||
*/ |
|||
@PostMapping("/notify") |
|||
public int add(@RequestBody String reqstr){ |
|||
log.info("notify:"+reqstr); |
|||
return 1; |
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
*{ |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
<#assign rootPath=springMacroRequestContext.contextPath /> |
|||
|
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>Title</title> |
|||
<link rel="stylesheet" href="${rootPath}/static/css/aa.css"> |
|||
</head> |
|||
<body> |
|||
${tstr} |
|||
</body> |
|||
</html> |
|||
Loading…
Reference in new issue