+
+
Input
+
+
+ );
+ }
+}
+
+
diff --git a/web/src/main/resources/static/js/admin/submitArticles.js b/web/src/main/resources/static/js/admin/submitArticles.js
new file mode 100644
index 0000000..fc2f004
--- /dev/null
+++ b/web/src/main/resources/static/js/admin/submitArticles.js
@@ -0,0 +1,77 @@
+'use strict';
+class SubmitArticles extends React.Component {
+
+
+ handleSubmit(e) {
+ e.preventDefault();
+ console.log(this.refs);
+ var submitData = {
+ "title": this.refs.title.value,
+ "type": this.refs.type.value,
+ "imgsrc": this.refs.imgsrc.value,
+ "link": this.refs.link.value,
+ "digest": this.refs.digest.value,
+ }
+ // $.post("/insert",
+ // JSON.stringify(submitData),
+ // function (data, status) {
+ // console.log("数据:" + data + "\n状态:" + status);
+ // }.bind(this));
+
+
+ $.ajax({
+ url: "/https/github.com/insert",
+ type: "POST",
+ headers: {
+ // "Accept": "text/plain; charset=utf-8",
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ /*
+ beforeSend: function(jqXHR, settings) {
+ jqXHR.setRequestHeader('Accept', 'text/plain; charset=utf-8');
+ jqXHR.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');
+ },
+ */
+ data: JSON.stringify(submitData),
+ success: function (data, textStatus, jqXHR) {
+ alert("数据:" + data + "\n状态:" + textStatus);
+ console.log("数据:" + data + "\n状态:" + textStatus);
+ }
+ });
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+ReactDOM.render(
, document.getElementById("submitArticles"));
diff --git a/web/src/main/resources/static/js/admin/writeBlog.js b/web/src/main/resources/static/js/admin/writeBlog.js
new file mode 100644
index 0000000..108bf8d
--- /dev/null
+++ b/web/src/main/resources/static/js/admin/writeBlog.js
@@ -0,0 +1,75 @@
+'use strict';
+import MarkdownEditor, {getContent} from "./markdown";
+// import React from 'react';
+// import ReactDOM from 'react-dom';
+class WriteBlog extends React.Component {
+
+ handleSubmit(e) {
+ e.preventDefault();
+ var submitData = {
+ "title": this.refs.title.value,
+ "type": this.refs.type.value,
+ "imgsrc": this.refs.imgsrc.value,
+ "digest": this.refs.digest.value,
+ "content": getContent(),
+ };
+
+ console.log(submitData);
+ $.ajax({
+ url: "/https/github.com/insert",
+ type: "POST",
+ headers: {
+ // "Accept": "text/plain; charset=utf-8",
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ /*
+ beforeSend: function(jqXHR, settings) {
+ jqXHR.setRequestHeader('Accept', 'text/plain; charset=utf-8');
+ jqXHR.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');
+ },
+ */
+ data: JSON.stringify(submitData),
+ success: function (data, textStatus, jqXHR) {
+ alert("数据:" + data + "\n状态:" + textStatus);
+ console.log("数据:" + data + "\n状态:" + textStatus);
+ }
+ });
+ }
+
+ render() {
+ return (
+
+
+
+
+
+ 原创
+ 分享
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+
+ }
+}
+
+
+ReactDOM.render(
, document.getElementById("writeBlog"));
diff --git a/web/src/main/resources/static/js/app.js b/web/src/main/resources/static/js/app.js
new file mode 100644
index 0000000..668db13
--- /dev/null
+++ b/web/src/main/resources/static/js/app.js
@@ -0,0 +1,22 @@
+'use strict';
+import ShareBlog from './article';
+import OriginalBlog from './original';
+class SunApp extends React.Component {
+
+ render() {
+ return (
+
+ );
+ }
+
+}
+
+
+ReactDOM.render(
, document.getElementById("sunapp"));
diff --git a/web/src/main/resources/static/js/article.js b/web/src/main/resources/static/js/article.js
new file mode 100644
index 0000000..4a4f1f4
--- /dev/null
+++ b/web/src/main/resources/static/js/article.js
@@ -0,0 +1,252 @@
+'use strict';
+export function copyarr(arr, start, end) {
+ var four_article = [];
+ for (var i = start; i <= end; i++) {
+ four_article.push(arr[i]);
+ }
+
+ return four_article;
+}
+export const hstyle = {
+ margin: 0,
+ padding: 0,
+ border: 0,
+ fontSize: '100%',
+ font: 'inherit',
+ verticalAlign: 'baseline',
+}
+
+const refreshButton = {
+ position: 'fixed',
+ width: '7%',
+ height: '6%',
+ zIndex: 100,
+ left: '1%',
+ mixBlendMode: 'difference',
+ background: '#606c76',
+ top: '2%',
+ cursor: 'pointer',
+}
+const row_wrap = {
+ width: '100%',
+ height: 'auto',
+}
+const bt_left = {
+ float: 'left',
+ // width: '40%',
+}
+
+class Image extends React.Component {
+
+
+ render() {
+ return (
+
+
+
+ );
+ }
+}
+
+class Text extends React.Component {
+
+ render() {
+ var article = this.props.article;
+
+ var link = article.type == '0' ? article.link : "/originalBlog?id=" + article.id;
+ return (
+
+
{article.date}
+
+
+
{article.digest}
+
MORE
+
+ );
+ }
+}
+
+
+class LinkArticle extends React.Component {
+
+ render() {
+ var article = this.props.article;
+ return (
+ article != undefined && article != null &&
+
+
+ );
+ }
+
+ constructor(props) {
+ super(props);
+ }
+}
+
+
+class BlogGrid extends React.Component {
+ render() {
+ return (
+
+ );
+ }
+}
+
+export class Blog extends React.Component {
+
+
+ render() {
+
+ var temp = this.props.temp;
+ return (
+ temp.articles != null &&
+
+
+
+
+
+
+ );
+ }
+}
+
+export class TempBlog extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ articles: null,
+ four_article: [],
+ next_index: 0,
+ };
+ }
+
+ getArticles() {
+ $.get(this.props.temp.ajaxurl, function (result) {
+ var four_article = [];
+ var next_index = 0;
+ if (result.length <= 4) {
+ four_article = result;
+ next_index = result.length - 1;
+ } else {
+ four_article = copyarr(result, 0, 3);
+ next_index = 3;
+ }
+
+ this.setState({
+ articles: result,
+ four_article: four_article,
+ next_index: next_index,
+ });
+ console.log("next_index:" + this.state.next_index);
+ console.log(result);
+
+ }.bind(this));
+ }
+
+ componentWillMount(prevProps, prevState) {
+ this.getArticles();
+ }
+
+
+ handleNextClick() {
+ var next_index = this.state.next_index;
+ var len = this.state.articles.length;
+ if (next_index >= len - 1) {
+ return;
+ }
+ var four_article = this.state.four_article;
+
+ if (len - 1 - next_index <= 4) {
+ four_article = copyarr(this.state.articles, next_index + 1, len - 1);
+ next_index = len - 1;
+ } else {
+ four_article = copyarr(this.state.articles, next_index + 1, next_index + 4);
+ next_index = next_index + 4;
+ }
+ console.log(four_article);
+ console.log(next_index)
+ this.setState({
+ four_article: four_article,
+ next_index: next_index,
+ });
+
+ }
+
+ handlePreClick() {
+ var pre_index = this.state.next_index - this.state.four_article.length;
+ if (pre_index < 0) {
+ return;
+ }
+ var four_article = this.state.four_article;
+
+ if (pre_index - 4 <= 0) {
+ four_article = copyarr(this.state.articles, 0, pre_index);
+ } else {
+ four_article = copyarr(this.state.articles, pre_index - 3, pre_index);
+ }
+ console.log(four_article);
+ console.log("pre_index:" + pre_index);
+ this.setState({
+ four_article: four_article,
+ next_index: pre_index,
+ })
+
+ }
+
+ render() {
+ return (
+
+
+
+
+ 上一页
+
+
+
+
+ 下一页
+
+
+
+
+
{this.props.temp.head}
+
{this.props.temp.info}
+
+
+
+
+ );
+ }
+}
+
+
+export default class ShareBlog extends React.Component {
+
+
+ render() {
+
+ return (
+
+
+
+ );
+ }
+}
+
+
diff --git a/web/src/main/resources/static/js/head.js b/web/src/main/resources/static/js/head.js
new file mode 100644
index 0000000..63e7034
--- /dev/null
+++ b/web/src/main/resources/static/js/head.js
@@ -0,0 +1,50 @@
+'use strict';
+
+class Button extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {name: this.props.value};
+ }
+
+
+ handleClick(arg) {
+ if(arg=='3'){
+ alert("功能暂未对外开放");
+ }
+ }
+
+
+ render() {
+ return (
+
+
+ {this.state.name}
+
+
+ );
+ }
+}
+
+class Head extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+
+ReactDOM.render(
, document.getElementById("head1"));
+
+
diff --git a/dal/src/main/resources/static/js/lib/browser.min.js b/web/src/main/resources/static/js/lib/browser.min.js
similarity index 100%
rename from dal/src/main/resources/static/js/lib/browser.min.js
rename to web/src/main/resources/static/js/lib/browser.min.js
diff --git a/dal/src/main/resources/static/js/lib/bundle.min.js b/web/src/main/resources/static/js/lib/bundle.min.js
similarity index 100%
rename from dal/src/main/resources/static/js/lib/bundle.min.js
rename to web/src/main/resources/static/js/lib/bundle.min.js
diff --git a/dal/src/main/resources/static/js/lib/carbon.js b/web/src/main/resources/static/js/lib/carbon.js
similarity index 100%
rename from dal/src/main/resources/static/js/lib/carbon.js
rename to web/src/main/resources/static/js/lib/carbon.js
diff --git a/dal/src/main/resources/static/js/lib/highlight.min.js b/web/src/main/resources/static/js/lib/highlight.min.js
similarity index 100%
rename from dal/src/main/resources/static/js/lib/highlight.min.js
rename to web/src/main/resources/static/js/lib/highlight.min.js
diff --git a/dal/src/main/resources/static/js/lib/jquery-3.1.1.js b/web/src/main/resources/static/js/lib/jquery-3.1.1.js
similarity index 100%
rename from dal/src/main/resources/static/js/lib/jquery-3.1.1.js
rename to web/src/main/resources/static/js/lib/jquery-3.1.1.js
diff --git a/dal/src/main/resources/static/js/lib/prism.js b/web/src/main/resources/static/js/lib/prism.js
similarity index 95%
rename from dal/src/main/resources/static/js/lib/prism.js
rename to web/src/main/resources/static/js/lib/prism.js
index 9180534..a0b1642 100644
--- a/dal/src/main/resources/static/js/lib/prism.js
+++ b/web/src/main/resources/static/js/lib/prism.js
@@ -7,7 +7,7 @@ Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|
Prism.languages.java=Prism.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+(?:e[+-]?\d+)?[df]?\b/i,operator:{pattern:/(^|[^.])(?:\+[+=]?|-[-=]?|!=?|<=?|>>?>?=?|==?|&[&=]?|\|[|=]?|\*=?|\/=?|%=?|\^=?|[?:~])/m,lookbehind:!0}}),Prism.languages.insertBefore("java","function",{annotation:{alias:"punctuation",pattern:/(^|[^.])@\w+/,lookbehind:!0}});
!function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replace(/[\n\t]/g," ").indexOf(t)>-1}function n(e,n,i){for(var o,a=n.replace(/\s+/g,"").split(","),l=+e.getAttribute("data-line-offset")||0,d=r()?parseInt:parseFloat,c=d(getComputedStyle(e).lineHeight),s=0;o=a[s++];){o=o.split("-");var u=+o[0],m=+o[1]||u,h=document.createElement("div");h.textContent=Array(m-u+2).join(" \n"),h.setAttribute("aria-hidden","true"),h.className=(i||"")+" line-highlight",t(e,"line-numbers")||(h.setAttribute("data-start",u),m>u&&h.setAttribute("data-end",m)),h.style.top=(u-l-1)*c+"px",t(e,"line-numbers")?e.appendChild(h):(e.querySelector("code")||e).appendChild(h)}}function i(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var i=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(i&&!document.getElementById(t)){var r=t.slice(0,t.lastIndexOf(".")),o=document.getElementById(r);o&&(o.hasAttribute("data-line")||o.setAttribute("data-line",""),n(o,i,"temporary "),document.querySelector(".temporary.line-highlight").scrollIntoView())}}if("undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector){var r=function(){var e;return function(){if("undefined"==typeof e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding=0,t.style.border=0,t.innerHTML="
+ *
*
*
* );
@@ -19339,4 +19339,4 @@ module.exports = Object.assign || function (target, source) {
};
},{}]},{},[90])(90)
-});
\ No newline at end of file
+});
diff --git a/dal/src/main/resources/static/js/lib/remarkable.min.js b/web/src/main/resources/static/js/lib/remarkable.min.js
similarity index 100%
rename from dal/src/main/resources/static/js/lib/remarkable.min.js
rename to web/src/main/resources/static/js/lib/remarkable.min.js
diff --git a/web/src/main/resources/static/js/lib/temp.js b/web/src/main/resources/static/js/lib/temp.js
new file mode 100644
index 0000000..6207c02
--- /dev/null
+++ b/web/src/main/resources/static/js/lib/temp.js
@@ -0,0 +1,107 @@
+
+class ProductCategoryRow extends React.Component {
+ render() {
+ return (
{this.props.category} );
+ }
+}
+
+class ProductRow extends React.Component {
+ render() {
+ var name = this.props.product.stocked ?
+ this.props.product.name :
+
+ {this.props.product.name}
+ ;
+ return (
+
+ {name}
+ {this.props.product.price}
+
+ );
+ }
+}
+
+class ProductTable extends React.Component {
+ render() {
+ var rows = [];
+ var lastCategory = null;
+ this.props.products.forEach((product) => {
+ if (product.name.indexOf(this.props.filterText) === -1 || (!product.stocked && this.props.inStockOnly)) {
+ return;
+ }
+ if (product.category !== lastCategory) {
+ rows.push(
);
+ }
+ rows.push(
);
+ lastCategory = product.category;
+ });
+ return (
+
+
+
+ Name
+ Price
+
+
+ {rows}
+
+ );
+ }
+}
+
+class SearchBar extends React.Component {
+ render() {
+ return (
+
+
+
+
+ {' '}
+ Only show products in stock
+
+
+ );
+ }
+}
+
+class FilterableProductTable extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ filterText: '',
+ inStockOnly: false
+ };
+ }
+
+ render() {
+ return (
+
+ );
+ }
+}
+
+
+var PRODUCTS = [
+ {category: 'Sporting Goods', price: '$49.99', stocked: true, name: 'Football'},
+ {category: 'Sporting Goods', price: '$9.99', stocked: true, name: 'Baseball'},
+ {category: 'Sporting Goods', price: '$29.99', stocked: false, name: 'Basketball'},
+ {category: 'Electronics', price: '$99.99', stocked: true, name: 'iPod Touch'},
+ {category: 'Electronics', price: '$399.99', stocked: false, name: 'iPhone 5'},
+ {category: 'Electronics', price: '$199.99', stocked: true, name: 'Nexus 7'}
+];
+
+ReactDOM.render(
+
,
+ document.getElementById('container')
+);
+VIEW COMPILED
diff --git a/web/src/main/resources/static/js/original.js b/web/src/main/resources/static/js/original.js
new file mode 100644
index 0000000..4467ff5
--- /dev/null
+++ b/web/src/main/resources/static/js/original.js
@@ -0,0 +1,21 @@
+'use strict';
+import {Blog,copyarr,TempBlog} from './article';
+
+
+export default class OriginalBlog extends React.Component {
+
+ render() {
+
+ return (
+
+
+
+ );
+ }
+}
+
+
diff --git a/web/src/main/resources/static/js/originalDetail.js b/web/src/main/resources/static/js/originalDetail.js
new file mode 100644
index 0000000..81812eb
--- /dev/null
+++ b/web/src/main/resources/static/js/originalDetail.js
@@ -0,0 +1,51 @@
+'use strict';
+class OriginalDetail extends React.Component {
+ constructor(props) {
+ super(props);
+ this.handleChange = this.handleChange.bind(this);
+ this.state = {value: null};
+ }
+
+ getBlog() {
+ $.get("/detail?id="+window.blogid, function (result) {
+ console.log(result);
+ this.setState({value: result});
+ }.bind(this));
+ }
+
+ highLight() {
+ hljs.initHighlighting.called = false;
+ hljs.initHighlighting();
+ }
+
+ handleChange() {
+ this.getBlog();
+ }
+
+ getRawMarkup() {
+ var md = new Remarkable();
+ return {__html: md.render(this.state.value)};
+ }
+
+ // 先插入dom
+ componentDidMount(prevProps, prevState) {
+ console.log("didmount");
+ this.getBlog();
+ }
+
+ // 再高亮
+ componentDidUpdate(prevProps, prevState) {
+ console.log("update");
+ this.highLight();
+ }
+
+ render() {
+
+ return (
+
+ );
+ }
+}
+
+ReactDOM.render(
, document.getElementById('originalBlog'));
+
diff --git a/web/src/main/resources/static/package.json b/web/src/main/resources/static/package.json
new file mode 100644
index 0000000..2a0f7c5
--- /dev/null
+++ b/web/src/main/resources/static/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "react-webpack",
+ "version": "1.0.0",
+ "description": "webpack demo",
+ "main": "index.js",
+ "scripts": {
+ "start": "webpack-dev-server --hot --progress --colors",
+ "build": "webpack --progress --colors"
+ },
+ "keywords": [
+ "react",
+ "webpack"
+ ],
+ "author": "xyy",
+ "devDependencies": {
+ "babel-core": "^6.5.2",
+ "babel-loader": "^6.2.2",
+ "babel-plugin-react-transform": "^2.0.0",
+ "css-loader": "^0.23.1",
+ "less": "^2.6.0",
+ "less-loader": "^2.2.2",
+ "react-hot-loader": "^1.3.0",
+ "react-transform-hmr": "^1.0.2",
+ "webpack": "^1.12.11",
+ "webpack-dev-server": "^1.14.1"
+ },
+ "dependencies": {
+ "babel-preset-es2015": "^6.5.0",
+ "babel-preset-react": "^6.5.0",
+ "graceful": "~1.0.0",
+ "html-webpack-plugin": "^2.8.2",
+ "lodash": "~3.10.1",
+ "react": "^0.14.7",
+ "react-dom": "^0.14.7",
+ "react-kendo": "~0.13.11",
+ "react-router": "^2.0.0",
+ "recluster": "~0.3.7"
+ }
+}
diff --git a/web/src/main/resources/static/webpack.config.js b/web/src/main/resources/static/webpack.config.js
new file mode 100644
index 0000000..313197b
--- /dev/null
+++ b/web/src/main/resources/static/webpack.config.js
@@ -0,0 +1,23 @@
+var webpack = require('webpack');
+var path = require('path');
+
+module.exports = {
+ entry: {
+ // 'webpack/hot/dev-server',
+ // 'webpack-dev-server/client?http://localhost:8080',
+ 'app': './js/app.js',
+ 'writeBlog': './js/admin/writeBlog.js',
+ },
+ output: {
+ path: path.resolve("./build"),
+ filename: '[name].bundle.js',
+ // publicPath: '/static'
+ },
+ module: {
+ loaders: [{
+ test: /\.jsx?$/,
+ loaders: ['babel-loader?presets[]=es2015&presets[]=react'],
+ include: path.join(__dirname, '.')
+ }]
+ },
+};
diff --git a/dal/src/main/resources/templates/layout/default.vm b/web/src/main/resources/templates/layout/default.vm
similarity index 58%
rename from dal/src/main/resources/templates/layout/default.vm
rename to web/src/main/resources/templates/layout/default.vm
index 5f7ccca..e0bfaff 100755
--- a/dal/src/main/resources/templates/layout/default.vm
+++ b/web/src/main/resources/templates/layout/default.vm
@@ -1,7 +1,9 @@
-
+
+
+
sun
@@ -17,17 +19,28 @@
+##
+
+
+##
+## Unicorns
+## All the things
+##
-
+
## #parse('layout/sidebar.vm')
-
-
+ $screen_content
+
diff --git a/dal/src/main/resources/templates/layout/sidebar.vm b/web/src/main/resources/templates/layout/sidebar.vm
similarity index 100%
rename from dal/src/main/resources/templates/layout/sidebar.vm
rename to web/src/main/resources/templates/layout/sidebar.vm
diff --git a/web/src/main/resources/templates/screen/admin/submitArticles.vm b/web/src/main/resources/templates/screen/admin/submitArticles.vm
new file mode 100644
index 0000000..59b9f64
--- /dev/null
+++ b/web/src/main/resources/templates/screen/admin/submitArticles.vm
@@ -0,0 +1,2 @@
+
+
diff --git a/web/src/main/resources/templates/screen/admin/writeBlog.vm b/web/src/main/resources/templates/screen/admin/writeBlog.vm
new file mode 100644
index 0000000..454c32c
--- /dev/null
+++ b/web/src/main/resources/templates/screen/admin/writeBlog.vm
@@ -0,0 +1,2 @@
+
+
diff --git a/web/src/main/resources/templates/screen/index.vm b/web/src/main/resources/templates/screen/index.vm
new file mode 100755
index 0000000..9ae3bca
--- /dev/null
+++ b/web/src/main/resources/templates/screen/index.vm
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
Good Blogs For Everyone
+
+
+
+
+
+
+
+
diff --git a/web/src/main/resources/templates/screen/originalBlog.vm b/web/src/main/resources/templates/screen/originalBlog.vm
new file mode 100644
index 0000000..af58cac
--- /dev/null
+++ b/web/src/main/resources/templates/screen/originalBlog.vm
@@ -0,0 +1,5 @@
+
+
+
diff --git a/dal/src/main/resources/templates/screen/index.vm b/web/src/main/resources/templates/screen/temp.vm
old mode 100755
new mode 100644
similarity index 65%
rename from dal/src/main/resources/templates/screen/index.vm
rename to web/src/main/resources/templates/screen/temp.vm
index 392695b..90e6d5d
--- a/dal/src/main/resources/templates/screen/index.vm
+++ b/web/src/main/resources/templates/screen/temp.vm
@@ -1,40 +1,3 @@
-
-
-
-
-
-
-
-
-
-
Example
-
-
@@ -71,3 +34,66 @@
+
+
+
+
+
+
+
+
March 29, 2014
+
+
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry Lorem Ipsum ....
+
MORE
+
+
+
+
+
+
+
+
+
March 29, 2014
+
+
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry Lorem Ipsum ....
+
MORE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
${name}
diff --git a/web/src/test/java/com/helloxyy/sun/test/DailyTest.java b/web/src/test/java/com/helloxyy/sun/test/DailyTest.java
new file mode 100644
index 0000000..721ee7d
--- /dev/null
+++ b/web/src/test/java/com/helloxyy/sun/test/DailyTest.java
@@ -0,0 +1,23 @@
+package com.helloxyy.sun.test;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Created by xyy on 17-1-6.
+ */
+public class DailyTest {
+
+ public static void main(String[] args) throws ParseException {
+
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ Date date=df.parse("2017-01-04 21:38:20");
+
+ System.out.println(date);
+
+
+ }
+}
diff --git a/web/src/test/java/com/helloxyy/sun/test/ResourceTest.java b/web/src/test/java/com/helloxyy/sun/test/ResourceTest.java
new file mode 100644
index 0000000..c3b3979
--- /dev/null
+++ b/web/src/test/java/com/helloxyy/sun/test/ResourceTest.java
@@ -0,0 +1,70 @@
+package com.helloxyy.sun.test;
+
+import com.helloxyy.sun.BootStrap;
+import com.helloxyy.sun.utils.FileUtil;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Date;
+
+/**
+ * Created by xyy on 17-1-1.
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration(classes = BootStrap.class)
+@WebAppConfiguration
+public class ResourceTest {
+
+ @Test
+ public void test1() throws IOException {
+ Resource resource = new ClassPathResource("/blog/test.md");
+ String fileName = resource.getFilename();
+ System.out.println(fileName);
+ System.out.println(resource.getURL());
+ System.out.println(resource.getURI());
+ // if (resource.isReadable()) {
+ // //每次都会打开一个新的流
+ // InputStream is = resource.getInputStream();
+ // this.printContent(is);
+ // }
+
+ String content = FileUtil.read(resource.getFile());
+ System.out.println(content);
+ }
+
+ @Test
+ public void test2() throws Exception{
+ System.out.println(FileUtil.readRelativeFile("/blog/test.md"));
+ }
+
+
+ @Test
+ public void testDate(){
+ Date date=new Date("2017-01-04 21:38:20");
+ System.out.println(date);
+ }
+
+ private void printContent(InputStream is) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ String line;
+ while ((line = br.readLine()) != null) {
+ System.out.println(line);
+ }
+ if (is != null) {
+ is.close();
+ }
+ if (br != null) {
+ br.close();
+ }
+ }
+
+}