|
@@ -103,7 +103,7 @@ public class GenerateHtmlImpl implements GenerateHtml {
|
|
|
try {
|
|
|
copyResourceToFile();
|
|
|
return "[静态页服务]:拷贝静态资源文件成功! ^_^";
|
|
|
- } catch (IOException e) {
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("[静态页服务]:拷贝静态资源文件异常!", e);
|
|
|
return "[静态页服务]:拷贝静态资源文件异常!"+e.toString();
|
|
|
}
|
|
@@ -176,16 +176,13 @@ public class GenerateHtmlImpl implements GenerateHtml {
|
|
|
}
|
|
|
//分析相对目录
|
|
|
String tempPath = "";
|
|
|
- String pathFlag = "/static/";
|
|
|
- String sUrl = resource.getURL().toString();
|
|
|
- if (sUrl.startsWith("file:")) {
|
|
|
- tempPath = sUrl.substring("file:".length() - 1);
|
|
|
- }
|
|
|
- int rootPathIndex = tempPath.indexOf(pathFlag);
|
|
|
- if (rootPathIndex < 0) {
|
|
|
+ String[] urls = resource.getURL().toString().split("/static/");
|
|
|
+ if (urls.length >= 2 ){
|
|
|
+ tempPath = urls[urls.length-1];
|
|
|
+ } else {
|
|
|
throw new RuntimeException("relativeRootPath有误:无法分析相对目录");
|
|
|
}
|
|
|
- tempPath = tempPath.substring(rootPathIndex + pathFlag.length(), tempPath.length() - fileName.length());
|
|
|
+ tempPath = tempPath.substring(0, tempPath.length() - fileName.length());
|
|
|
if (StringUtils.isEmpty(tempPath)) {
|
|
|
tempPath = File.separator;
|
|
|
}
|