mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-08-30 05:22:01 +00:00
- 优化JsScriptLoader,支持JAR包内和文件系统的自动资源文件发现 - 移除预定义文件列表,完全依赖自动检测 - 添加getNoRedirect方法支持重定向处理 - 添加sendMultipartForm方法支持文件上传 - 添加代理配置支持 - 修复JSON解析的压缩处理问题 - 添加默认请求头支持(Accept-Encoding、User-Agent、Accept-Language) - 更新文档,修正导出方式说明 - 优化README.md结构,删除不符合模块定位的内容 - 升级parser版本到10.2.1
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package cn.qaiu;
|
|
|
|
import io.vertx.core.Vertx;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import cn.qaiu.parser.custom.CustomParserRegistry;
|
|
|
|
public class WebClientVertxInit {
|
|
private Vertx vertx = null;
|
|
private static final WebClientVertxInit INSTANCE = new WebClientVertxInit();
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(WebClientVertxInit.class);
|
|
|
|
public static void init(Vertx vx) {
|
|
INSTANCE.vertx = vx;
|
|
|
|
// 自动加载JavaScript解析器脚本
|
|
try {
|
|
CustomParserRegistry.autoLoadJsScripts();
|
|
} catch (Exception e) {
|
|
log.warn("自动加载JavaScript解析器脚本失败", e);
|
|
}
|
|
}
|
|
|
|
public static Vertx get() {
|
|
if (INSTANCE.vertx == null) {
|
|
log.info("getVertx: Vertx实例不存在, 创建Vertx实例.");
|
|
INSTANCE.vertx = Vertx.vertx();
|
|
|
|
// 如果Vertx实例是新创建的,也尝试加载JavaScript脚本
|
|
try {
|
|
CustomParserRegistry.autoLoadJsScripts();
|
|
} catch (Exception e) {
|
|
log.warn("自动加载JavaScript解析器脚本失败", e);
|
|
}
|
|
}
|
|
return INSTANCE.vertx;
|
|
}
|
|
} |