diff --git a/webmagic-worker/src/main/java/us/codecraft/webmagic/avalon/web/DashBoardController.java b/webmagic-worker/src/main/java/us/codecraft/webmagic/avalon/web/DashBoardController.java new file mode 100644 index 0000000..3ef2a86 --- /dev/null +++ b/webmagic-worker/src/main/java/us/codecraft/webmagic/avalon/web/DashBoardController.java @@ -0,0 +1,20 @@ +package us.codecraft.webmagic.avalon.web; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * @author code4crafter@gmail.com + */ +@Controller("dashboard") +@RequestMapping("/") +public class DashBoardController { + + @RequestMapping + public ModelAndView index() { + ModelAndView map = new ModelAndView("dashboard"); + return map; + } + +} diff --git a/webmagic-worker/src/main/java/us/codecraft/webmagic/avalon/web/SpiderController.java b/webmagic-worker/src/main/java/us/codecraft/webmagic/avalon/web/SpiderController.java new file mode 100644 index 0000000..2f18569 --- /dev/null +++ b/webmagic-worker/src/main/java/us/codecraft/webmagic/avalon/web/SpiderController.java @@ -0,0 +1,24 @@ +package us.codecraft.webmagic.avalon.web; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author code4crafter@gmail.com + */ +@Controller("spider") +@RequestMapping("spider") +public class SpiderController { + + @RequestMapping("create") + @ResponseBody + public Map create() { + HashMap map = new HashMap(); + map.put("code", 200); + return map; + } +} diff --git a/webmagic-worker/src/main/resources/freemarker.properties b/webmagic-worker/src/main/resources/freemarker.properties new file mode 100644 index 0000000..dbed67f --- /dev/null +++ b/webmagic-worker/src/main/resources/freemarker.properties @@ -0,0 +1,7 @@ +number_format=# +classic_compatible=true + +default_encoding=UTF-8 +template_update_delay=0 +######################### +template_exception_handler=rethrow diff --git a/webmagic-worker/src/main/resources/log4j.xml b/webmagic-worker/src/main/resources/log/log4j.xml similarity index 76% rename from webmagic-worker/src/main/resources/log4j.xml rename to webmagic-worker/src/main/resources/log/log4j.xml index a6630f8..c2b5a2f 100644 --- a/webmagic-worker/src/main/resources/log4j.xml +++ b/webmagic-worker/src/main/resources/log/log4j.xml @@ -8,12 +8,7 @@ - - - - - - + diff --git a/webmagic-worker/src/main/resources/spring/applicationContext-freemarker.xml b/webmagic-worker/src/main/resources/spring/applicationContext-freemarker.xml new file mode 100644 index 0000000..e7b98aa --- /dev/null +++ b/webmagic-worker/src/main/resources/spring/applicationContext-freemarker.xml @@ -0,0 +1,34 @@ + + + + + + + + + 0 + zh_CN + yyyy-MM-dd HH:mm:ss + yyyy-MM-dd + #.## + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webmagic-worker/src/main/resources/spring/applicationContext-myBatis.xml b/webmagic-worker/src/main/resources/spring/applicationContext-myBatis.xml new file mode 100644 index 0000000..222df02 --- /dev/null +++ b/webmagic-worker/src/main/resources/spring/applicationContext-myBatis.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webmagic-worker/src/main/resources/spring/applicationContext.xml b/webmagic-worker/src/main/resources/spring/applicationContext.xml new file mode 100644 index 0000000..1a2ac66 --- /dev/null +++ b/webmagic-worker/src/main/resources/spring/applicationContext.xml @@ -0,0 +1,45 @@ + + + + + + + + web_messages + + + + + + + + + + + + + text/html;charset=UTF-8 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webmagic-worker/src/main/webapp/WEB-INF/jsp/404.jsp b/webmagic-worker/src/main/webapp/WEB-INF/jsp/404.jsp new file mode 100644 index 0000000..9a3348f --- /dev/null +++ b/webmagic-worker/src/main/webapp/WEB-INF/jsp/404.jsp @@ -0,0 +1,74 @@ +<%@ page language="java" contentType="text/html; charset=utf8" + pageEncoding="utf8"%> + + + + + + + Page not found · GitLab Pages + + + + +
+ +

404

+

There isn't a Gitlab Page here.

+ +

Forgive my poor design.

+

You can edit 404.jsp to customize your 404 page.

+ + +
+ + diff --git a/webmagic-worker/src/main/webapp/WEB-INF/jsp/500.jsp b/webmagic-worker/src/main/webapp/WEB-INF/jsp/500.jsp new file mode 100644 index 0000000..150df3a --- /dev/null +++ b/webmagic-worker/src/main/webapp/WEB-INF/jsp/500.jsp @@ -0,0 +1,18 @@ +<%@ page language="java" contentType="text/html; charset=utf8" + pageEncoding="utf8" isErrorPage="true" import="java.io.*"%> + + + + + 500 + + +页面出错啦! +<% + + StringWriter stringWriter = new StringWriter(); + exception.printStackTrace(new PrintWriter(stringWriter)); + out.println(stringWriter.toString()); +%> + + \ No newline at end of file diff --git a/webmagic-worker/src/main/webapp/WEB-INF/web.xml b/webmagic-worker/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..eb253f3 --- /dev/null +++ b/webmagic-worker/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,53 @@ + + + Archetype Created Web Application + + + contextConfigLocation + + classpath*:spring/applicationContext*.xml, + + + + + contextClass + org.springframework.web.context.support.XmlWebApplicationContext + + + + + log4jConfigLocation + classpath:log/log4j.xml + + + + log4jRefreshInterval + 60000 + + + + + spring + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + classpath:/spring/applicationContext*.xml + + 1 + + + spring + / + + + 404 + /WEB-INF/jsp/404.jsp + + + 500 + /WEB-INF/jsp/500.jsp + + +