2023-09-21 13:25
@xinyin025 我gitee拉取下来,sqlite-jdbc改为3.7.2 运行正常
2023-09-20 21:21
@JFinal 不着急,新项目开发中,用的17。看21发布了,想着直接升21也没关系。本地去除Compiler.class后,运行正常~
2023-09-06 10:52
@zzutligang 1K也不算大,你上面业务对象也不大,就算循环了,并发不大的情况下也可以正常渲染JSON,内存可以算出来的。虽然是业务问题,但JF已经考虑到了
2023-09-06 10:43
@zzutligang 防止业务死循环,上面对象套对象,如果有两个相互是对方父级,那么转JSON字符串的时候就相互调用了,JVM就GG了
2023-09-05 22:48
@zzutligang [ 是一层,{ 也是一层,所以 数组 套 map 是两层。并不是只算 { map对象
2023-08-29 21:45
我也懵逼,要不贴点代码?我测试没问题呀
public static void main(String[] args) {
Okv base = null;
Okv dad = null;
String[] kin = {"媳妇", "弟弟", "妹妹"};
List<String> riches = Arrays.asList(new String[]{"房子", "车子", "票子"});
for (int i = 0; i <= 20; i++) {
Okv son = Okv.of("name", "杜" + i);
son.set("kin", kin);
son.set("riches", riches);
if (base == null){
base = son;
}else {
dad.set("son", son);
}
dad = son;
}
JFinalJson.setDefaultConvertDepth(18);
String json = JFinalJson.getJson().toJson(base);
System.out.println(json);
}
{"name":"杜0","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜1","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜2","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜3","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜4","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜5","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜6","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜7","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜8","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜9","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜10","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜11","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜12","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜13","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜14","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜15","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜16","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜17","kin":["媳妇","弟弟","妹妹"],"riches":["房子","车子","票子"],"son":{"name":"杜18","kin":null,"riches":null,"son":null}}}}}}}}}}}}}}}}}}}
2023-08-13 17:47
@Leo.du 执行ActionHandler 的时候 才创建 JsonRequest对象,自定义的 Handler 是在ActionHandler 之前执行的,所以是拿不到的。
:
需求分析:根据你业务需求,是要获取 JsonRequest ,并且是 Handler 级的获取。
简单方案:创建JsonRequest 的时候,获取该对象,因为ActionHandler 支持setJsonRequestFactory。代码大致如下:JFinalConfig的子类》
public void configConstant(Constants me) {
me.setResolveJsonRequest(true);
me.setJsonRequestFactory((jsonString, req) -> {
JsonRequest ret = new JsonRequest(jsonString, req);
// 在这里 获取到这个对象
return ret;
});
}
:
复杂点方案:自定义ActionHandler,继承ActionHandler,复制里面代码,改为自己业务的,再配置:
public void configHandler(Handlers me) {
me.setActionHandler(...)
}
2023-08-07 20:16
@hhchor 但是天笑分享的处理,就是有处理404返回的JSON呀。
除非是你Controller里面有index方法,这个是默认接收方法,如果里面代码没做返回数据处理的话,空的方法可能会返回异常RenderException。
最简单的就是里面不要写index方法。
当然以上为猜测,具体得看你代码是怎么写的了。比如是否有自定义ActionHandler之类的情况