Skip to content

Commit 316b441

Browse files
committed
Java:APIJSONFinal 从 APIJSONBoot 同步代码并解决跨域问题;APIJSONBoot 删除多余代码
1 parent fd91f26 commit 316b441

36 files changed

+1622
-3423
lines changed

APIJSON-Java-Server/APIJSONBoot/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<dependency>
4747
<groupId>com.github.APIJSON</groupId>
4848
<artifactId>apijson-framework</artifactId>
49-
<version>4.3.3</version>
49+
<version>4.4.0</version>
5050
</dependency>
5151
<!-- 可使用 libs 目录的 apijson-orm.jar 和 apijson-framework.jar 来替代,两种方式二选一 >>>>>>>>>> -->
5252

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoApplication.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public boolean apply(Object object, String name, Object value) {
201201
public static void main(String[] args) throws Exception {
202202
SpringApplication.run(DemoApplication.class, args);
203203

204-
Log.DEBUG = true; //上线生产环境前改为 false,可不输出 APIJSONORM 的日志 以及 SQLException 的原始(敏感)信息
204+
Log.DEBUG = true; // 上线生产环境前改为 false,可不输出 APIJSONORM 的日志 以及 SQLException 的原始(敏感)信息
205205
APIJSONApplication.init();
206206
}
207207

@@ -215,12 +215,12 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
215215
APPLICATION_CONTEXT = applicationContext;
216216
}
217217

218-
//SpringBoot 2.x 自定义端口方式
218+
// SpringBoot 2.x 自定义端口方式
219219
// @Bean
220220
// public TomcatServletWebServerFactory servletContainer(){
221221
// return new TomcatServletWebServerFactory(8081) ;
222222
// }
223-
//SpringBoot 1.x 自定义端口方式,配置文件加 server.port=80 无效(MacOS 10.10.?)
223+
// SpringBoot 1.x 自定义端口方式,配置文件加 server.port=80 无效(MacOS 10.10.?)
224224
@Bean
225225
public EmbeddedServletContainerCustomizer containerCustomizer() {
226226
return new EmbeddedServletContainerCustomizer() {

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,14 +1004,18 @@ public JSONObject putBalance(@RequestBody String request, HttpSession session) {
10041004
* @return
10051005
*/
10061006
@SuppressWarnings("unchecked")
1007-
@RequestMapping(value = "/delegate")
1007+
@RequestMapping(value = "delegate")
10081008
public String delegate(
10091009
@RequestParam(value = "$_type", required = false) String type,
10101010
@RequestParam(value = "$_except_headers", required = false) String exceptHeaders,
10111011
@RequestParam("$_delegate_url") String url,
10121012
@RequestBody(required = false) String body,
10131013
HttpMethod method, HttpSession session
10141014
) {
1015+
1016+
if (Log.DEBUG == false) {
1017+
return DemoParser.newErrorResult(new IllegalAccessException("非 DEBUG 模式下不允许使用服务器代理!")).toJSONString();
1018+
}
10151019

10161020
if ("GRPC".equals(type)) {
10171021
int index = url.indexOf("://");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/

APIJSON-Java-Server/APIJSONFinal/pom.xml

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4-
<groupId>htdi.jfinal</groupId>
4+
<groupId>apijson.jfinal</groupId>
55
<artifactId>apijson-final</artifactId>
66
<packaging>jar</packaging>
7-
<version>4.0.0</version>
8-
<name>APIJSON Demo based on JFinal</name>
7+
<version>4.4.0</version>
8+
<name>Demo project for APIJSON Server based on JFinal</name>
99
<url>http://maven.apache.org</url>
1010
<dependencies>
11-
<!-- APIJSONORM 需要用的 JSON 封装/解析库,1.2.24 以上 -->
1211
<dependency>
1312
<groupId>com.alibaba</groupId>
1413
<artifactId>fastjson</artifactId>
15-
<version>1.2.58</version>
14+
<version>1.2.74</version>
1615
</dependency>
1716

18-
<!-- APIJSONBoot 需要用的 JFinal 框架,3.5 以上 -->
1917
<dependency>
20-
<groupId>com.jfinal</groupId>
21-
<artifactId>jfinal-undertow</artifactId>
22-
<version>1.9</version>
18+
<groupId>javax.servlet</groupId>
19+
<artifactId>javax.servlet-api</artifactId>
20+
<version>4.0.1</version>
2321
</dependency>
2422

23+
<!-- 可使用 libs 目录的 apijson-orm.jar 和 apijson-framework.jar 来替代,两种方式二选一 <<<<<<<<<< -->
2524
<dependency>
26-
<groupId>com.jfinal</groupId>
27-
<artifactId>jfinal</artifactId>
28-
<version>4.6</version>
25+
<groupId>com.github.Tencent</groupId>
26+
<artifactId>APIJSON</artifactId>
27+
<version>4.2.4</version>
2928
</dependency>
29+
<dependency>
30+
<groupId>com.github.APIJSON</groupId>
31+
<artifactId>apijson-framework</artifactId>
32+
<version>4.4.0</version>
33+
</dependency>
34+
<!-- 可使用 libs 目录的 apijson-orm.jar 和 apijson-framework.jar 来替代,两种方式二选一 >>>>>>>>>> -->
3035

31-
<!-- APIJSONBoot 需要用的数据库 JDBC 驱动 -->
36+
<!-- 数据库 JDBC 驱动 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -->
3237
<dependency>
3338
<groupId>mysql</groupId>
3439
<artifactId>mysql-connector-java</artifactId>
35-
<version>8.0.11</version>
40+
<version>8.0.16</version>
3641
</dependency>
3742
<dependency>
3843
<groupId>org.postgresql</groupId>
@@ -44,19 +49,44 @@
4449
<artifactId>jtds</artifactId>
4550
<version>1.3.1</version>
4651
</dependency>
52+
<!-- 没找到合适且稳定的 Oracle 的 JDBC Maven 依赖,需要自行下载 jar 包 -->
53+
<!-- 数据库 JDBC 驱动 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
54+
55+
<!-- APIJSONBoot 需要用的 JFinal 框架,3.5 以上 -->
4756
<dependency>
48-
<groupId>com.github.APIJSON</groupId>
49-
<artifactId>apijson-orm</artifactId>
50-
<version>LATEST</version>
57+
<groupId>com.jfinal</groupId>
58+
<artifactId>jfinal-undertow</artifactId>
59+
<version>1.9</version>
5160
</dependency>
52-
<!-- 没找到合适且稳定的 Oracle 的 JDBC Maven 依赖,已在 libs 目录放了对应的 jar 包来替代 -->
53-
61+
<dependency>
62+
<groupId>com.jfinal</groupId>
63+
<artifactId>jfinal</artifactId>
64+
<version>4.6</version>
65+
</dependency>
66+
<!-- cors跨域 -->
67+
<dependency>
68+
<groupId>com.thetransactioncompany</groupId>
69+
<artifactId>cors-filter</artifactId>
70+
<version>2.5</version>
71+
</dependency>
72+
5473
</dependencies>
74+
75+
<repositories>
76+
<!-- APIJSON 必须用到的托管平台 -->
77+
<repository>
78+
<id>jitpack.io</id>
79+
<url>https://jitpack.io</url>
80+
<snapshots>
81+
<enabled>true</enabled>
82+
</snapshots>
83+
</repository>
84+
</repositories>
85+
5586
<build>
5687
<!-- <finalName>helloworld</finalName> -->
5788

5889
<plugins>
59-
6090
<plugin>
6191
<groupId>org.apache.maven.plugins</groupId>
6292
<artifactId>maven-compiler-plugin</artifactId>
@@ -118,7 +148,7 @@
118148
<transformers>
119149
<transformer
120150
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
121-
<mainClass>apijson.demo.server.AppRunnableConfig</mainClass>
151+
<mainClass>apijson.jfinal.AppRunnableConfig</mainClass>
122152
</transformer>
123153

124154
<!-- 下面的配置支持排除指定文件打包到 jar 之中,可以用于排除需要修改的配置文件以便于在外部的 config 目录下的 同名配置文件生效,建议使用

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoFunctionParser.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/DemoFunctionParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot;
15+
package apijson.demo;
1616

1717
import java.util.ArrayList;
1818
import java.util.Arrays;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoObjectParser.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/DemoObjectParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot;
15+
package apijson.demo;
1616

1717
import java.util.List;
1818

1919
import javax.servlet.http.HttpSession;
20-
import javax.validation.constraints.NotNull;
2120

2221
import com.alibaba.fastjson.JSONObject;
2322

23+
import apijson.NotNull;
2424
import apijson.RequestMethod;
2525
import apijson.orm.AbstractObjectParser;
2626
import apijson.orm.AbstractParser;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoParser.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/DemoParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot;
15+
package apijson.demo;
1616

1717
import apijson.RequestMethod;
1818
import apijson.framework.APIJSONParser;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoSQLConfig.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/DemoSQLConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot;
15+
package apijson.demo;
1616

1717
import static apijson.framework.APIJSONConstant.ID;
1818
import static apijson.framework.APIJSONConstant.PRIVACY_;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoSQLExecutor.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/DemoSQLExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot;
15+
package apijson.demo;
1616

1717
import apijson.framework.APIJSONSQLExecutor;
1818

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/DemoVerifier.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/DemoVerifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot;
15+
package apijson.demo;
1616

1717
import apijson.framework.APIJSONVerifier;
1818

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/model/Privacy.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/model/Privacy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot.model;
15+
package apijson.demo.model;
1616

1717
import static apijson.RequestRole.ADMIN;
1818
import static apijson.RequestRole.OWNER;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/model/User.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/model/User.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot.model;
15+
package apijson.demo.model;
1616

1717
import static apijson.RequestRole.ADMIN;
1818
import static apijson.RequestRole.UNKNOWN;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/model/Verify.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/model/Verify.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.boot.model;
15+
package apijson.demo.model;
1616

1717
import static apijson.RequestRole.ADMIN;
1818
import static apijson.RequestRole.CIRCLE;

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/boot/model/package-info.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/model/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
* @author Lemon
2424
*
2525
*/
26-
package apijson.boot.model;
26+
package apijson.demo.model;

APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/server/package-info.java renamed to APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
* @author Lemon
66
*
77
*/
8-
package apijson.demo.server;
8+
package apijson.demo;

APIJSON-Java-Server/APIJSONFinal/src/main/java/apijson/demo/server/AppRunnableConfig.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)