增加ctxPath参数,当映射根路径不同的时候使用
This commit is contained in:
@@ -7,7 +7,6 @@ package com.jeesite.common.web;
|
|||||||
import com.jeesite.common.codec.EncodeUtils;
|
import com.jeesite.common.codec.EncodeUtils;
|
||||||
import com.jeesite.common.io.PropertiesUtils;
|
import com.jeesite.common.io.PropertiesUtils;
|
||||||
import com.jeesite.common.lang.StringUtils;
|
import com.jeesite.common.lang.StringUtils;
|
||||||
|
|
||||||
import jakarta.servlet.http.Cookie;
|
import jakarta.servlet.http.Cookie;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@@ -96,7 +95,8 @@ public class CookieUtils {
|
|||||||
* @return 值
|
* @return 值
|
||||||
*/
|
*/
|
||||||
public static String getCookie(HttpServletRequest request, HttpServletResponse response, String name, boolean isRemove) {
|
public static String getCookie(HttpServletRequest request, HttpServletResponse response, String name, boolean isRemove) {
|
||||||
return getCookie(request, response, name, request != null ? request.getContextPath() : "", false);
|
String ctxPath = PropertiesUtils.getInstance().getProperty("ctxPath", request != null ? request.getContextPath() : StringUtils.EMPTY);
|
||||||
|
return getCookie(request, response, name, ctxPath, isRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ import com.jeesite.common.lang.ExceptionUtils;
|
|||||||
import com.jeesite.common.lang.StringUtils;
|
import com.jeesite.common.lang.StringUtils;
|
||||||
import com.jeesite.common.mapper.JsonMapper;
|
import com.jeesite.common.mapper.JsonMapper;
|
||||||
import com.jeesite.common.mapper.XmlMapper;
|
import com.jeesite.common.mapper.XmlMapper;
|
||||||
|
import jakarta.servlet.ServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import jakarta.servlet.ServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -56,7 +56,7 @@ public class ServletUtils {
|
|||||||
|
|
||||||
// 是否打印错误信息参数到视图页面(生产环境关闭)
|
// 是否打印错误信息参数到视图页面(生产环境关闭)
|
||||||
private static final Boolean PRINT_ERROR_INFO = PROPS.getPropertyToBoolean("error.page.printErrorInfo", "true");
|
private static final Boolean PRINT_ERROR_INFO = PROPS.getPropertyToBoolean("error.page.printErrorInfo", "true");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前请求对象
|
* 获取当前请求对象
|
||||||
* web.xml: <listener><listener-class>
|
* web.xml: <listener><listener-class>
|
||||||
@@ -106,7 +106,8 @@ public class ServletUtils {
|
|||||||
if (StringUtils.contains(url, "://")){
|
if (StringUtils.contains(url, "://")){
|
||||||
response.sendRedirect(url);
|
response.sendRedirect(url);
|
||||||
}else{
|
}else{
|
||||||
response.sendRedirect(request.getContextPath() + url);
|
String ctxPath = PropertiesUtils.getInstance().getProperty("ctxPath", request.getContextPath());
|
||||||
|
response.sendRedirect(ctxPath + url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public class CmsUtils {
|
|||||||
private static final SiteService siteService = SpringUtils.getBean(SiteService.class);
|
private static final SiteService siteService = SpringUtils.getBean(SiteService.class);
|
||||||
private static final CategoryService categoryService = SpringUtils.getBean(CategoryService.class);
|
private static final CategoryService categoryService = SpringUtils.getBean(CategoryService.class);
|
||||||
private static final ArticleService articleService = SpringUtils.getBean(ArticleService.class);
|
private static final ArticleService articleService = SpringUtils.getBean(ArticleService.class);
|
||||||
private static final ServletContext context = SpringUtils.getBean(ServletContext.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -243,7 +242,7 @@ public class CmsUtils {
|
|||||||
*/
|
*/
|
||||||
public static String getUrlDynamic(Article article) {
|
public static String getUrlDynamic(Article article) {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append(Static.context.getContextPath());
|
str.append(Global.getCtxPath());
|
||||||
if (StringUtils.isNotBlank(article.getHref())) {
|
if (StringUtils.isNotBlank(article.getHref())) {
|
||||||
if (article.getHref().contains("://")) {
|
if (article.getHref().contains("://")) {
|
||||||
return article.getHref();
|
return article.getHref();
|
||||||
@@ -265,7 +264,7 @@ public class CmsUtils {
|
|||||||
*/
|
*/
|
||||||
public static String getUrlDynamic(Category category) {
|
public static String getUrlDynamic(Category category) {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append(Static.context.getContextPath()).append(Global.getFrontPath());
|
str.append(Global.getCtxPath()).append(Global.getFrontPath());
|
||||||
if (StringUtils.isNotBlank(category.getHref())) {
|
if (StringUtils.isNotBlank(category.getHref())) {
|
||||||
if (category.getHref().contains("://")) {
|
if (category.getHref().contains("://")) {
|
||||||
return category.getHref();
|
return category.getHref();
|
||||||
@@ -285,7 +284,7 @@ public class CmsUtils {
|
|||||||
*/
|
*/
|
||||||
public static String getUrlDynamic(Site site) {
|
public static String getUrlDynamic(Site site) {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append(Static.context.getContextPath()).append(Global.getFrontPath());
|
str.append(Global.getCtxPath()).append(Global.getFrontPath());
|
||||||
if (StringUtils.isNotBlank(site.getDomain())) {
|
if (StringUtils.isNotBlank(site.getDomain())) {
|
||||||
if (site.getDomain().contains("://")) {
|
if (site.getDomain().contains("://")) {
|
||||||
return site.getDomain();
|
return site.getDomain();
|
||||||
@@ -305,7 +304,7 @@ public class CmsUtils {
|
|||||||
*/
|
*/
|
||||||
public static String getAdminUrlDynamic(Category category) {
|
public static String getAdminUrlDynamic(Category category) {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append(Static.context.getContextPath()).append(Global.getAdminPath());
|
str.append(Global.getCtxPath()).append(Global.getAdminPath());
|
||||||
String adminUrlParam = null; // 管理地址的参数
|
String adminUrlParam = null; // 管理地址的参数
|
||||||
// 如果试图配置里配置了管理路径,则使用视图中的管理路径
|
// 如果试图配置里配置了管理路径,则使用视图中的管理路径
|
||||||
if (StringUtils.isNotBlank(category.getViewConfig())) {
|
if (StringUtils.isNotBlank(category.getViewConfig())) {
|
||||||
@@ -389,8 +388,8 @@ public class CmsUtils {
|
|||||||
if (StringUtils.isBlank(src)) {
|
if (StringUtils.isBlank(src)) {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
if (src.startsWith(Static.context.getContextPath() + "/userfiles")) {
|
if (src.startsWith(Global.getCtxPath() + "/userfiles")) {
|
||||||
return src.substring(Static.context.getContextPath().length());
|
return src.substring(Global.getCtxPath().length());
|
||||||
} else {
|
} else {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
@@ -405,10 +404,10 @@ public class CmsUtils {
|
|||||||
if (StringUtils.isBlank(src)) {
|
if (StringUtils.isBlank(src)) {
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
if (src.startsWith(Static.context.getContextPath() + "/userfiles")) {
|
if (src.startsWith(Global.getCtxPath() + "/userfiles")) {
|
||||||
return src;
|
return src;
|
||||||
} else {
|
} else {
|
||||||
return Static.context.getContextPath() + src;
|
return Global.getCtxPath() + src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,10 +493,6 @@ public class CmsUtils {
|
|||||||
return Static.articleService;
|
return Static.articleService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ServletContext getServletContext() {
|
|
||||||
return Static.context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <V> V getCache(String key) {
|
public static <V> V getCache(String key) {
|
||||||
return CacheUtils.get(CMS_CACHE, key);
|
return CacheUtils.get(CMS_CACHE, key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,8 +105,9 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
// 如果设置了外部链接,则跳转到指定链接
|
// 如果设置了外部链接,则跳转到指定链接
|
||||||
if (StringUtils.isNotBlank(category.getHref())) {
|
if (StringUtils.isNotBlank(category.getHref())) {
|
||||||
if (category.getHref().startsWith(request.getContextPath())) {
|
String ctxPath = Global.getCtxPath();
|
||||||
category.setHref(category.getHref().replaceFirst(request.getContextPath(), ""));
|
if (category.getHref().startsWith(ctxPath)) {
|
||||||
|
category.setHref(category.getHref().replaceFirst(ctxPath, StringUtils.EMPTY));
|
||||||
}
|
}
|
||||||
return REDIRECT + category.getHref();
|
return REDIRECT + category.getHref();
|
||||||
}
|
}
|
||||||
@@ -266,8 +267,9 @@ public class FrontController extends BaseController {
|
|||||||
|
|
||||||
// 如果设置了外部链接,则跳转到指定链接
|
// 如果设置了外部链接,则跳转到指定链接
|
||||||
if (StringUtils.isNotBlank(article.getHref())) {
|
if (StringUtils.isNotBlank(article.getHref())) {
|
||||||
if (article.getHref().startsWith(request.getContextPath())) {
|
String ctxPath = Global.getCtxPath();
|
||||||
article.setHref(article.getHref().replaceFirst(request.getContextPath(), ""));
|
if (article.getHref().startsWith(ctxPath)) {
|
||||||
|
article.setHref(article.getHref().replaceFirst(ctxPath, StringUtils.EMPTY));
|
||||||
}
|
}
|
||||||
return REDIRECT + article.getHref();
|
return REDIRECT + article.getHref();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ public class PermissionsFilter extends org.apache.shiro.web.filter.authz.Permiss
|
|||||||
// AJAX不支持Redirect改用Forward
|
// AJAX不支持Redirect改用Forward
|
||||||
String loginUrl = Global.getProperty("shiro.defaultPath");
|
String loginUrl = Global.getProperty("shiro.defaultPath");
|
||||||
HttpServletRequest req = ((HttpServletRequest) request);
|
HttpServletRequest req = ((HttpServletRequest) request);
|
||||||
if (StringUtils.equals(req.getContextPath()+loginUrl, req.getRequestURI())){
|
|
||||||
|
if (StringUtils.equals(Global.getCtxPath() + loginUrl, req.getRequestURI())){
|
||||||
loginUrl = Global.getProperty("shiro.loginUrl");
|
loginUrl = Global.getProperty("shiro.loginUrl");
|
||||||
}
|
}
|
||||||
if (ServletUtils.isAjaxRequest(req)) {
|
if (ServletUtils.isAjaxRequest(req)) {
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package com.jeesite.common.ueditor;
|
package com.jeesite.common.ueditor;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import com.jeesite.common.config.Global;
|
import com.jeesite.common.config.Global;
|
||||||
import com.jeesite.common.ueditor.define.ActionMap;
|
import com.jeesite.common.ueditor.define.ActionMap;
|
||||||
import com.jeesite.common.ueditor.define.AppInfo;
|
import com.jeesite.common.ueditor.define.AppInfo;
|
||||||
@@ -12,6 +8,9 @@ import com.jeesite.common.ueditor.define.State;
|
|||||||
import com.jeesite.common.ueditor.hunter.FileManager;
|
import com.jeesite.common.ueditor.hunter.FileManager;
|
||||||
import com.jeesite.common.ueditor.hunter.ImageHunter;
|
import com.jeesite.common.ueditor.hunter.ImageHunter;
|
||||||
import com.jeesite.common.ueditor.upload.Uploader;
|
import com.jeesite.common.ueditor.upload.Uploader;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class ActionEnter {
|
public class ActionEnter {
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ public class ActionEnter {
|
|||||||
this.request = request;
|
this.request = request;
|
||||||
this.rootPath = rootPath;
|
this.rootPath = rootPath;
|
||||||
this.actionType = actionType;
|
this.actionType = actionType;
|
||||||
this.contextPath = request.getContextPath();
|
this.contextPath = Global.getCtxPath();
|
||||||
this.configManager = ConfigManager.getInstance(this.rootPath, this.contextPath, request.getRequestURI());
|
this.configManager = ConfigManager.getInstance(this.rootPath, this.contextPath, request.getRequestURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package com.jeesite.common.ueditor.hunter;
|
package com.jeesite.common.ueditor.hunter;
|
||||||
|
|
||||||
import java.io.File;
|
import com.jeesite.common.config.Global;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import com.jeesite.common.ueditor.PathFormat;
|
import com.jeesite.common.ueditor.PathFormat;
|
||||||
import com.jeesite.common.ueditor.define.AppInfo;
|
import com.jeesite.common.ueditor.define.AppInfo;
|
||||||
import com.jeesite.common.ueditor.define.BaseState;
|
import com.jeesite.common.ueditor.define.BaseState;
|
||||||
import com.jeesite.common.ueditor.define.MultiState;
|
import com.jeesite.common.ueditor.define.MultiState;
|
||||||
import com.jeesite.common.ueditor.define.State;
|
import com.jeesite.common.ueditor.define.State;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class FileManager {
|
public class FileManager {
|
||||||
|
|
||||||
@@ -70,7 +69,7 @@ public class FileManager {
|
|||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
url = url.substring(index + USERFILES_BASE_URL.length());
|
url = url.substring(index + USERFILES_BASE_URL.length());
|
||||||
}
|
}
|
||||||
fileState.putInfo("url", request.getContextPath() + USERFILES_BASE_URL + url);
|
fileState.putInfo("url", Global.getCtxPath() + USERFILES_BASE_URL + url);
|
||||||
state.addState(fileState);
|
state.addState(fileState);
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.jeesite.common.config.Global;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
@@ -80,7 +81,7 @@ public class ImageHunter {
|
|||||||
String physicalPath = this.rootPath + savePath;
|
String physicalPath = this.rootPath + savePath;
|
||||||
State state = StorageManager.saveFileByInputStream(connection.getInputStream(), physicalPath);
|
State state = StorageManager.saveFileByInputStream(connection.getInputStream(), physicalPath);
|
||||||
if (state.isSuccess()) {
|
if (state.isSuccess()) {
|
||||||
state.putInfo("url", request.getContextPath() + PathFormat.format(savePath));
|
state.putInfo("url", Global.getCtxPath() + PathFormat.format(savePath));
|
||||||
state.putInfo("source", urlStr);
|
state.putInfo("source", urlStr);
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package com.jeesite.common.ueditor.upload;
|
package com.jeesite.common.ueditor.upload;
|
||||||
|
|
||||||
import java.util.Map;
|
import com.jeesite.common.config.Global;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
|
|
||||||
import com.jeesite.common.ueditor.PathFormat;
|
import com.jeesite.common.ueditor.PathFormat;
|
||||||
import com.jeesite.common.ueditor.define.AppInfo;
|
import com.jeesite.common.ueditor.define.AppInfo;
|
||||||
import com.jeesite.common.ueditor.define.BaseState;
|
import com.jeesite.common.ueditor.define.BaseState;
|
||||||
import com.jeesite.common.ueditor.define.FileType;
|
import com.jeesite.common.ueditor.define.FileType;
|
||||||
import com.jeesite.common.ueditor.define.State;
|
import com.jeesite.common.ueditor.define.State;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public final class Base64Uploader {
|
public final class Base64Uploader {
|
||||||
|
|
||||||
@@ -27,8 +26,8 @@ public final class Base64Uploader {
|
|||||||
String physicalPath = (String) conf.get("rootPath") + savePath;
|
String physicalPath = (String) conf.get("rootPath") + savePath;
|
||||||
State storageState = StorageManager.saveBinaryFile(data, physicalPath);
|
State storageState = StorageManager.saveBinaryFile(data, physicalPath);
|
||||||
if (storageState.isSuccess()) {
|
if (storageState.isSuccess()) {
|
||||||
String ctx = request.getContextPath(); // ThinkGem 修正上传图片后返回无contextpath问题
|
String ctxPath = Global.getCtxPath(); // ThinkGem 修正上传图片后返回无contextpath问题
|
||||||
storageState.putInfo("url", ctx + PathFormat.format(savePath));
|
storageState.putInfo("url", ctxPath + PathFormat.format(savePath));
|
||||||
storageState.putInfo("type", suffix);
|
storageState.putInfo("type", suffix);
|
||||||
storageState.putInfo("original", "");
|
storageState.putInfo("original", "");
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jeesite.common.ueditor.upload;
|
package com.jeesite.common.ueditor.upload;
|
||||||
|
|
||||||
|
import com.jeesite.common.config.Global;
|
||||||
import com.jeesite.common.image.ImageUtils;
|
import com.jeesite.common.image.ImageUtils;
|
||||||
import com.jeesite.common.io.FileUtils;
|
import com.jeesite.common.io.FileUtils;
|
||||||
import com.jeesite.common.media.VideoUtils;
|
import com.jeesite.common.media.VideoUtils;
|
||||||
@@ -73,7 +74,7 @@ public class BinaryUploader {
|
|||||||
|
|
||||||
if (storageState != null && storageState.isSuccess()) {
|
if (storageState != null && storageState.isSuccess()) {
|
||||||
int actionCode = ((Integer) conf.get("actionCode")).intValue();
|
int actionCode = ((Integer) conf.get("actionCode")).intValue();
|
||||||
String ctx = request.getContextPath(); // ThinkGem 修正上传图片后返回无contextpath问题
|
String ctxPath = Global.getCtxPath(); // ThinkGem 修正上传图片后返回无contextpath问题
|
||||||
|
|
||||||
// 上传图片后,进行图片压缩
|
// 上传图片后,进行图片压缩
|
||||||
if (actionCode == ActionMap.UPLOAD_IMAGE) {
|
if (actionCode == ActionMap.UPLOAD_IMAGE) {
|
||||||
@@ -105,7 +106,7 @@ public class BinaryUploader {
|
|||||||
};
|
};
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
storageState.putInfo("url", ctx + PathFormat.format(savePath) + "." + v.getOutputFileExtension());
|
storageState.putInfo("url", ctxPath + PathFormat.format(savePath) + "." + v.getOutputFileExtension());
|
||||||
storageState.putInfo("type", "." + v.getOutputFileExtension());
|
storageState.putInfo("type", "." + v.getOutputFileExtension());
|
||||||
storageState.putInfo("original", originFileName + "." + v.getInputFileExtension());
|
storageState.putInfo("original", originFileName + "." + v.getInputFileExtension());
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ public class BinaryUploader {
|
|||||||
return storageState;
|
return storageState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storageState.putInfo("url", ctx + PathFormat.format(savePath));
|
storageState.putInfo("url", ctxPath + PathFormat.format(savePath));
|
||||||
storageState.putInfo("type", suffix);
|
storageState.putInfo("type", suffix);
|
||||||
storageState.putInfo("original", originFileName + suffix);
|
storageState.putInfo("original", originFileName + suffix);
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import com.jeesite.common.lang.StringUtils;
|
|||||||
import com.jeesite.common.ueditor.define.AppInfo;
|
import com.jeesite.common.ueditor.define.AppInfo;
|
||||||
import com.jeesite.common.ueditor.define.BaseState;
|
import com.jeesite.common.ueditor.define.BaseState;
|
||||||
import com.jeesite.common.ueditor.define.State;
|
import com.jeesite.common.ueditor.define.State;
|
||||||
import com.jeesite.common.web.http.ServletUtils;
|
|
||||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -204,8 +202,7 @@ public class StorageManager {
|
|||||||
String url = FileUploadUtils.ossFileUpload(file, StringUtils.substringAfter(
|
String url = FileUploadUtils.ossFileUpload(file, StringUtils.substringAfter(
|
||||||
FileUtils.path(file.getAbsolutePath()), Global.USERFILES_BASE_URL));
|
FileUtils.path(file.getAbsolutePath()), Global.USERFILES_BASE_URL));
|
||||||
if (!StringUtils.contains(url, "://")) {
|
if (!StringUtils.contains(url, "://")) {
|
||||||
HttpServletRequest request = ServletUtils.getRequest();
|
url = FileUtils.path(Global.getCtxPath() + url);
|
||||||
url = FileUtils.path((request != null ? request.getContextPath() : StringUtils.EMPTY) + url);
|
|
||||||
}
|
}
|
||||||
storageState.putInfo("url", url);
|
storageState.putInfo("url", url);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class UserfilesController extends BaseController {
|
|||||||
String uid = request.getParameter("uid");
|
String uid = request.getParameter("uid");
|
||||||
if (StringUtils.isNotBlank(url) && StringUtils.isNotBlank(uid)){
|
if (StringUtils.isNotBlank(url) && StringUtils.isNotBlank(uid)){
|
||||||
fileUrl = url; //EncodeUtils.decodeUrl(url); 不用解码,否则腾讯云存储的时候预览不能显示
|
fileUrl = url; //EncodeUtils.decodeUrl(url); 不用解码,否则腾讯云存储的时候预览不能显示
|
||||||
fileUri = request.getContextPath() + Global.getAdminPath() + "/file/download/" + uid;
|
fileUri = Global.getCtxPath() + Global.getAdminPath() + "/file/download/" + uid;
|
||||||
filePath = fileName;
|
filePath = fileName;
|
||||||
} else if (StringUtils.isNotBlank(fileName)){
|
} else if (StringUtils.isNotBlank(fileName)){
|
||||||
fileUri += "?fileName=" + EncodeUtils.encodeUrl(fileName);
|
fileUri += "?fileName=" + EncodeUtils.encodeUrl(fileName);
|
||||||
|
|||||||
@@ -117,8 +117,7 @@ public class LogUtils {
|
|||||||
Object targetData = request.getAttribute(WebDataBinder.class.getName()+".TARGET");
|
Object targetData = request.getAttribute(WebDataBinder.class.getName()+".TARGET");
|
||||||
|
|
||||||
// 异步保存日志
|
// 异步保存日志
|
||||||
logThreadPool.submit(new SaveLogThread(log, handler, request.getContextPath(),
|
logThreadPool.submit(new SaveLogThread(log, handler, Global.getCtxPath(), throwable, sourceData, targetData));
|
||||||
throwable, sourceData, targetData));
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 保存日志线程
|
* 保存日志线程
|
||||||
|
|||||||
@@ -230,10 +230,11 @@ public class LoginController extends BaseController{
|
|||||||
successUrl = (String)request.getAttribute("__url");
|
successUrl = (String)request.getAttribute("__url");
|
||||||
}
|
}
|
||||||
if (StringUtils.contains(successUrl, "://")){
|
if (StringUtils.contains(successUrl, "://")){
|
||||||
|
String ctxPath = Global.getCtxPath();
|
||||||
String domain = ServletUtils.getRequestDomain(successUrl);
|
String domain = ServletUtils.getRequestDomain(successUrl);
|
||||||
successUrl = StringUtils.substring(successUrl, domain.length());
|
successUrl = StringUtils.substring(successUrl, domain.length());
|
||||||
if (StringUtils.startsWith(successUrl, request.getContextPath())) {
|
if (StringUtils.startsWith(successUrl, ctxPath)) {
|
||||||
successUrl = StringUtils.substringAfter(successUrl, request.getContextPath());
|
successUrl = StringUtils.substringAfter(successUrl, ctxPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(successUrl)){
|
if (StringUtils.isBlank(successUrl)){
|
||||||
@@ -251,7 +252,7 @@ public class LoginController extends BaseController{
|
|||||||
}
|
}
|
||||||
model.addAttribute("sessionid", (String)session.getId());
|
model.addAttribute("sessionid", (String)session.getId());
|
||||||
if (!StringUtils.contains(successUrl, "://")){
|
if (!StringUtils.contains(successUrl, "://")){
|
||||||
successUrl = request.getContextPath() + successUrl;
|
successUrl = Global.getCtxPath() + successUrl;
|
||||||
}
|
}
|
||||||
model.addAttribute("__url", successUrl); // 告诉浏览器登录后跳转的页面
|
model.addAttribute("__url", successUrl); // 告诉浏览器登录后跳转的页面
|
||||||
// 初始密码策略和密码修改策略验证(0:关闭;1:提醒用户;2:强制修改初始或旧密码)
|
// 初始密码策略和密码修改策略验证(0:关闭;1:提醒用户;2:强制修改初始或旧密码)
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ for (var menu in p.menuList![]){
|
|||||||
if (@StringUtils.startsWith(href, "///")){
|
if (@StringUtils.startsWith(href, "///")){
|
||||||
href = @StringUtils.substring(href, 2);
|
href = @StringUtils.substring(href, 2);
|
||||||
} else if (@StringUtils.startsWith(href, "//")){
|
} else if (@StringUtils.startsWith(href, "//")){
|
||||||
href = @request.getContextPath() + @StringUtils.substring(href, 1);
|
href = @Global.getCtxPath() + @StringUtils.substring(href, 1);
|
||||||
} else if (@StringUtils.startsWith(href, "/")){
|
} else if (@StringUtils.startsWith(href, "/")){
|
||||||
href = @request.getContextPath() + @Global.getAdminPath() + href;
|
href = @Global.getCtxPath() + @Global.getAdminPath() + href;
|
||||||
}
|
}
|
||||||
attrs = attrs + 'href="' + href + '"';
|
attrs = attrs + 'href="' + href + '"';
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user