mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-04 12:58:24 +08:00
跳转
This commit is contained in:
parent
abb1f0fa19
commit
4d96ab0c96
@ -5,8 +5,6 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.jiangzeyin.common.interceptor.BaseInterceptor;
|
||||
import io.jpom.system.JpomRuntimeException;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
@ -36,18 +34,9 @@ public abstract class BaseJpomInterceptor extends BaseInterceptor {
|
||||
return Convert.toBool(request.getAttribute("Page_Req"), true);
|
||||
}
|
||||
|
||||
public void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
|
||||
String proto = ServletUtil.getHeaderIgnoreCase(request, "X-Forwarded-Proto");
|
||||
if (proto == null) {
|
||||
response.sendRedirect(getHeaderProxyPath(request) + url);
|
||||
} else {
|
||||
String host = request.getHeader(HttpHeaders.HOST);
|
||||
if (StrUtil.isEmpty(host)) {
|
||||
throw new JpomRuntimeException("请配置host header");
|
||||
}
|
||||
String toUrl = StrUtil.format("{}://{}{}{}", proto, host, getHeaderProxyPath(request), url);
|
||||
response.sendRedirect(toUrl);
|
||||
}
|
||||
public void sendRedirects(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
|
||||
url = getHeaderProxyPath(request) + url;
|
||||
BaseInterceptor.sendRedirect(request, response, url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +127,7 @@ public class LoginInterceptor extends BaseJpomInterceptor {
|
||||
if (header != null) {
|
||||
url += "&r=" + header;
|
||||
}
|
||||
super.sendRedirect(request, response, url);
|
||||
super.sendRedirects(request, response, url);
|
||||
return;
|
||||
}
|
||||
ServletUtil.write(response, JsonMessage.getString(800, "登录信息已失效,重新登录"), MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||
|
@ -50,6 +50,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
<script type="text/javascript"
|
||||
th:src="@{${session.jpomProxyPath}+'/static/js/auto-line-number.js?v='+${session.staticCacheTime}}"></script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user