public class PathKitExt extends Object
| 构造器和说明 |
|---|
PathKitExt() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getLocationPath()
1:获取 PathKitExt 类文件所处 jar 包文件所在的目录,注意在 "非部署" 环境中获取到的
通常是 maven 本地库中的某个目录,因为在开发时项目所依赖的 jar 包在 maven 本地库中
这种情况不能使用
2:PathKitExt 自身在开发时,也就是未打成 jar 包时,获取到的是 APP_BASE/target/classes
这种情况多数不必关心,因为 PathKitExt 在使用时必定处于 jar 包之中
3:获取到的 locationPath 目录用于生成部署时的 config 目录,该值只会在 "部署" 环境下被获取
也用于生成 webRootPath、rootClassPath,这两个值也只会在 "部署" 时被获取
这样就兼容了部署与非部署两种场景
注意:该路径尾部的 "/" 或 "\\" 已被去除
|
static String |
getRootClassPath() |
static String |
getWebRootPath() |
static String |
removeSlashEnd(String path) |
static void |
setRootClassPath(String rootClassPath)
用途与使用方式与 setWebRootPath(...)
|
static void |
setWebRootPath(String webRootPath)
如果 jfinal-undertow 生成的 path 仍然不能满足需要,可以在 UndertowServer 启动之前
先手动注入值,例如:
PathKitExt.setWebRootPath(...);
UndertowServer.start(...);
注意:建议优先通过配置 undertow.resourcePath 的方式来解决,例如:
undertow.resourcePath = IDEA开发时的module名称/src/main/webapp, src/main/webapp, webapp
上述配置适合于 IDEA 下在 maven module 中启动项目时使用
TODO: 未来在 IDEA 的 maven module 中启动项目的场景下解决一下自动探测该目录的适配问题
|
public static String getLocationPath()
public static String getRootClassPath()
public static String getWebRootPath()
public static void setWebRootPath(String webRootPath)
public static void setRootClassPath(String rootClassPath)
Copyright © 2022. All rights reserved.