Skip to content

Commit c53997b

Browse files
committed
Initial commit
0 parents  commit c53997b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2817
-0
lines changed

.classpath

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
</attributes>
24+
</classpathentry>
25+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
26+
<attributes>
27+
<attribute name="maven.pomderived" value="true"/>
28+
</attributes>
29+
</classpathentry>
30+
<classpathentry kind="lib" path="libs/apijson-server.jar"/>
31+
<classpathentry kind="lib" path="libs/gson-2.3.1.jar"/>
32+
<classpathentry kind="lib" path="libs/commons-io-2.6.jar"/>
33+
<classpathentry kind="lib" path="libs/commons-logging-1.2.jar"/>
34+
<classpathentry kind="lib" path="libs/commons-fileupload-1.3.3.jar"/>
35+
<classpathentry kind="output" path="target/classes"/>
36+
</classpath>

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/

.project

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>SpringServer1.2-APIJSON</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
5+
encoding/<project>=UTF-8

.settings/org.eclipse.jdt.core.prefs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3+
org.eclipse.jdt.core.compiler.compliance=1.8
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.source=1.8

.settings/org.eclipse.m2e.core.prefs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# SpringServer1.2-APIJSON

libs/apijson-server.jar

451 KB
Binary file not shown.

libs/commons-fileupload-1.3.3.jar

68.9 KB
Binary file not shown.

libs/commons-io-2.6.jar

210 KB
Binary file not shown.

libs/commons-logging-1.2.jar

60.4 KB
Binary file not shown.

libs/gson-2.3.1.jar

206 KB
Binary file not shown.

pom.xml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>apijson.demo.server</groupId>
7+
<artifactId>apijson-demo</artifactId>
8+
<version>2.1.0-SNAPSHOT</version>
9+
<packaging>jar</packaging>
10+
11+
<name>APIJSONDemo</name>
12+
<description>Demo project for APIJSON Server</description>
13+
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>1.4.1.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
20+
21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24+
<java.version>1.8</java.version>
25+
</properties>
26+
27+
<dependencies>
28+
<dependency>
29+
<groupId>mysql</groupId>
30+
<artifactId>mysql-connector-java</artifactId>
31+
<version>5.1.40</version>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-starter</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-test</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot-starter-web</artifactId>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.springframework.boot</groupId>
49+
<artifactId>spring-boot-starter-actuator</artifactId>
50+
</dependency>
51+
52+
53+
<dependency>
54+
<groupId>com.alibaba</groupId>
55+
<artifactId>fastjson</artifactId>
56+
<version>1.2.21</version>
57+
</dependency>
58+
</dependencies>
59+
60+
<build>
61+
<plugins>
62+
<plugin>
63+
<groupId>org.springframework.boot</groupId>
64+
<artifactId>spring-boot-maven-plugin</artifactId>
65+
</plugin>
66+
<plugin>
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-compiler-plugin</artifactId>
69+
<configuration>
70+
<source>1.8</source>
71+
<target>1.8</target>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
77+
<!-- Allow access to Spring milestones and snapshots -->
78+
<!-- (you don't need this if you are using anything after 0.5.0.RELEASE) -->
79+
<repositories>
80+
<repository>
81+
<id>spring-snapshots</id>
82+
<url>http://repo.spring.io/snapshot</url>
83+
<snapshots><enabled>true</enabled></snapshots>
84+
</repository>
85+
<repository>
86+
<id>spring-milestones</id>
87+
<url>http://repo.spring.io/milestone</url>
88+
<snapshots><enabled>true</enabled></snapshots>
89+
</repository>
90+
</repositories>
91+
<pluginRepositories>
92+
<pluginRepository>
93+
<id>spring-snapshots</id>
94+
<url>http://repo.spring.io/snapshot</url>
95+
</pluginRepository>
96+
<pluginRepository>
97+
<id>spring-milestones</id>
98+
<url>http://repo.spring.io/milestone</url>
99+
</pluginRepository>
100+
</pluginRepositories>
101+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
15+
package apijson.demo.server;
16+
17+
import org.springframework.boot.SpringApplication;
18+
import org.springframework.boot.autoconfigure.SpringBootApplication;
19+
import org.springframework.context.annotation.Bean;
20+
import org.springframework.web.cors.CorsConfiguration;
21+
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
22+
import org.springframework.web.filter.CorsFilter;
23+
24+
25+
/**application
26+
* @author Lemon
27+
*/
28+
@SpringBootApplication
29+
public class APIJSONApplication {
30+
31+
public static void main(String[] args) throws Exception {
32+
SpringApplication.run(APIJSONApplication.class, args);
33+
34+
System.out.println("\n\n\n\n\n<<<<<<<<<<<<<<<<<<<<<<<<< APIJSON >>>>>>>>>>>>>>>>>>>>>>>>\n");
35+
System.out.println("开始测试:远程函数 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
36+
try {
37+
RemoteFunction.test();
38+
} catch (Exception e) {
39+
e.printStackTrace();
40+
}
41+
System.out.println("\n完成测试:远程函数 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
42+
43+
44+
System.out.println("\n\n\n开始测试:请求校验 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
45+
try {
46+
StructureUtil.test();
47+
} catch (Exception e) {
48+
e.printStackTrace();
49+
}
50+
System.out.println("\n完成测试:请求校验 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
51+
52+
System.out.println("\n\n<<<<<<<<<<<<<<<<<<<<<<<<< APIJSON已启动 >>>>>>>>>>>>>>>>>>>>>>>>\n");
53+
}
54+
55+
56+
57+
//支持JavaScript跨域请求<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
58+
/**
59+
* 跨域过滤器
60+
* @return
61+
*/
62+
@Bean
63+
public CorsFilter corsFilter() {
64+
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
65+
source.registerCorsConfiguration("/**", buildConfig());
66+
return new CorsFilter(source);
67+
}
68+
/**CORS跨域配置
69+
* @return
70+
*/
71+
private CorsConfiguration buildConfig() {
72+
CorsConfiguration corsConfiguration = new CorsConfiguration();
73+
corsConfiguration.addAllowedOrigin("*"); //允许的域名或IP地址
74+
corsConfiguration.addAllowedHeader("*"); //允许的请求头
75+
corsConfiguration.addAllowedMethod("*"); //允许的HTTP请求方法
76+
corsConfiguration.setAllowCredentials(true); //允许发送跨域凭据,前端Axios存取JSESSIONID必须要
77+
return corsConfiguration;
78+
}
79+
//支持JavaScript跨域请求 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
80+
81+
}

0 commit comments

Comments
 (0)