-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
063b8a4
commit 9f866c3
Showing
8 changed files
with
325 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.vscode | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
#sublime config | ||
.DS_Store | ||
.tags | ||
.tags_sorted_by_file | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv/ | ||
venv/ | ||
ENV/ | ||
|
||
|
||
# add by wenxiaoning begin | ||
.idea/ | ||
.npmignore | ||
.serverless/ | ||
node_modules/ | ||
*/.serverless/ | ||
*/node_modules/ | ||
*/.cache/ | ||
*/local_config.py | ||
api/test/winn* | ||
winn* | ||
# add by wenxiaoning end | ||
|
||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
metrics.flask.log | ||
crawler/common | ||
*.retry | ||
*.out | ||
*.swp | ||
*.log.* | ||
|
||
# for java | ||
*.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.wxnacy.spring</groupId> | ||
<artifactId>SpringMVC-ReturnJson</artifactId> | ||
<packaging>war</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>SpringMVC-ReturnJson Maven Webapp</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<spring.version>4.0.1.RELEASE</spring.version> | ||
</properties> | ||
<dependencies> | ||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.9.3</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
<version>1.1.34</version> | ||
</dependency> | ||
<!-- Spring dependencies --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-core</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-web</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-webmvc</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>3.8.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<finalName>SpringMVC-ReturnJson</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.tomcat.maven</groupId> | ||
<artifactId>tomcat7-maven-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<port>8080</port> | ||
<path>/</path> | ||
<uriEncoding>UTF-8</uriEncoding> | ||
<!--<finalName>mgr</finalName>--> | ||
<server>tomcat7</server> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
20 changes: 20 additions & 0 deletions
20
java/SpringMVC-ReturnJson/src/main/java/com/wxnacy/spring/controller/JsonController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.wxnacy.spring.controller; | ||
|
||
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; | ||
|
||
@Controller | ||
public class JsonController { | ||
|
||
@RequestMapping(value="/api") | ||
@ResponseBody | ||
public Map api() { | ||
Map map=new HashMap(); | ||
map.put("status", "200"); | ||
return map; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
java/SpringMVC-ReturnJson/src/main/resources/dispatcher.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||
http://www.springframework.org/schema/context | ||
http://www.springframework.org/schema/context/spring-context-3.2.xsd | ||
http://www.springframework.org/schema/mvc | ||
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd "> | ||
|
||
|
||
<mvc:annotation-driven/> | ||
<mvc:annotation-driven> | ||
<mvc:message-converters register-defaults="true"> | ||
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> | ||
<property name="supportedMediaTypes" value="application/json;charset=UTF-8"/> | ||
<property name="features"> | ||
<array> | ||
<!-- [>QuoteFieldNames———-输出key时是否使用双引号,默认为true<] --> | ||
<!-- [>WriteMapNullValue——–是否输出值为null的字段,默认为false<] --> | ||
<!-- [>WriteNullNumberAsZero—-数值字段如果为null,输出为0,而非null<] --> | ||
<!-- [>WriteNullListAsEmpty—–List字段如果为null,输出为[],而非null<] --> | ||
<!-- [>WriteNullStringAsEmpty—字符类型字段如果为null,输出为”“,而非null<] --> | ||
<!-- [>WriteNullBooleanAsFalse–Boolean字段如果为null,输出为false,而非null<] --> | ||
<!-- [>DisableCircularReferenceDetect 关闭循环引用<] --> | ||
<value>WriteNullNumberAsZero</value> | ||
<value>WriteNullListAsEmpty</value> | ||
<value>WriteNullStringAsEmpty</value> | ||
<value>WriteNullBooleanAsFalse</value> | ||
<value>DisableCircularReferenceDetect</value> | ||
</array> | ||
</property> | ||
</bean> | ||
</mvc:message-converters> | ||
</mvc:annotation-driven> | ||
<context:component-scan base-package="com.wxnacy.spring.controller"/> | ||
|
||
</beans> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | ||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
version="3.0"> | ||
<servlet> | ||
<servlet-name>dispatcher</servlet-name> | ||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | ||
<init-param> | ||
<param-name>contextConfigLocation</param-name> | ||
<param-value>classpath:dispatcher.xml</param-value> | ||
</init-param> | ||
<load-on-startup>1</load-on-startup> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>dispatcher</servlet-name> | ||
<url-pattern>/</url-pattern> | ||
</servlet-mapping> | ||
|
||
<display-name>Archetype Created Web Application</display-name> | ||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
<h2>Hello World!</h2> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# 部署指定tag 的api程序 | ||
# __author__ = "wenxiaoning([email protected])" | ||
# __copyright__ = "Copyright of GoChinaTV (2017)." | ||
|
||
MSG=$1 | ||
|
||
|
||
|
||
push(){ | ||
echo '******************************' | ||
echo '********开始push api:' | ||
echo '******************************' | ||
git add . && git commit -m ${MSG} && git push | ||
echo '******************************' | ||
echo '********部署成功' | ||
echo '******************************' | ||
} | ||
|
||
main(){ | ||
if [ ! ${MSG} ] | ||
then | ||
echo 'UAGE: ./winn_push.sh <string:commit msg>' | ||
else | ||
push | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
TAG_NAME=$1 | ||
PUSH_MSG=$2 | ||
|
||
|
||
main(){ | ||
git pull origin master | ||
git add . | ||
git commit -m ${PUSH_MSG} | ||
git push origin master | ||
git tag ${TAG_NAME} | ||
git push origin ${TAG_NAME} | ||
} | ||
|
||
if [ ! ${TAG_NAME} ] | ||
then | ||
echo 'UAGE: ./push_tag.sh <regex:tag_name>' | ||
else | ||
main | ||
fi |