mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-02-27 16:50:24 +08:00
新增curr-domain配置
This commit is contained in:
@@ -6,9 +6,11 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebFilterChain;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
import cn.dev33.satoken.reactor.context.SaReactorHolder;
|
||||
import cn.dev33.satoken.reactor.context.SaReactorSyncHolder;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
|
||||
/**
|
||||
* Request for Reactor
|
||||
@@ -20,7 +22,7 @@ public class SaRequestForReactor implements SaRequest {
|
||||
/**
|
||||
* 底层Request对象
|
||||
*/
|
||||
ServerHttpRequest request;
|
||||
protected ServerHttpRequest request;
|
||||
|
||||
/**
|
||||
* 实例化
|
||||
@@ -75,10 +77,14 @@ public class SaRequestForReactor implements SaRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前请求的url,例:http://xxx.com/?id=127
|
||||
* 返回当前请求的url,例:http://xxx.com/test
|
||||
* @return see note
|
||||
*/
|
||||
public String getUrl() {
|
||||
String currDomain = SaManager.getConfig().getCurrDomain();
|
||||
if(SaFoxUtil.isEmpty(currDomain) == false) {
|
||||
return currDomain + this.getRequestPath();
|
||||
}
|
||||
return request.getURI().toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SaResponseForReactor implements SaResponse {
|
||||
/**
|
||||
* 底层Response对象
|
||||
*/
|
||||
ServerHttpResponse response;
|
||||
protected ServerHttpResponse response;
|
||||
|
||||
/**
|
||||
* 实例化
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SaStorageForReactor implements SaStorage {
|
||||
/**
|
||||
* 底层Request对象
|
||||
*/
|
||||
ServerWebExchange exchange;
|
||||
protected ServerWebExchange exchange;
|
||||
|
||||
/**
|
||||
* 实例化
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
import cn.dev33.satoken.exception.SaTokenException;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
|
||||
/**
|
||||
* Request for Servlet
|
||||
@@ -21,7 +22,7 @@ public class SaRequestForServlet implements SaRequest {
|
||||
/**
|
||||
* 底层Request对象
|
||||
*/
|
||||
HttpServletRequest request;
|
||||
protected HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 实例化
|
||||
@@ -80,10 +81,14 @@ public class SaRequestForServlet implements SaRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前请求的url,例:http://xxx.com/?id=127
|
||||
* 返回当前请求的url,例:http://xxx.com/test
|
||||
* @return see note
|
||||
*/
|
||||
public String getUrl() {
|
||||
String currDomain = SaManager.getConfig().getCurrDomain();
|
||||
if(SaFoxUtil.isEmpty(currDomain) == false) {
|
||||
return currDomain + this.getRequestPath();
|
||||
}
|
||||
return request.getRequestURL().toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SaResponseForServlet implements SaResponse {
|
||||
/**
|
||||
* 底层Request对象
|
||||
*/
|
||||
HttpServletResponse response;
|
||||
protected HttpServletResponse response;
|
||||
|
||||
/**
|
||||
* 实例化
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SaStorageForServlet implements SaStorage {
|
||||
/**
|
||||
* 底层Request对象
|
||||
*/
|
||||
HttpServletRequest request;
|
||||
protected HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 实例化
|
||||
|
||||
@@ -2,7 +2,9 @@ package cn.dev33.satoken.solon.model;
|
||||
|
||||
import org.noear.solon.core.handle.Context;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
|
||||
/**
|
||||
* @author noear
|
||||
@@ -10,7 +12,7 @@ import cn.dev33.satoken.context.model.SaRequest;
|
||||
*/
|
||||
public class SaRequestForSolon implements SaRequest {
|
||||
|
||||
Context ctx;
|
||||
protected Context ctx;
|
||||
|
||||
public SaRequestForSolon(){
|
||||
ctx = Context.current();
|
||||
@@ -43,6 +45,10 @@ public class SaRequestForSolon implements SaRequest {
|
||||
|
||||
@Override
|
||||
public String getUrl() {
|
||||
String currDomain = SaManager.getConfig().getCurrDomain();
|
||||
if(SaFoxUtil.isEmpty(currDomain) == false) {
|
||||
return currDomain + this.getRequestPath();
|
||||
}
|
||||
return ctx.url();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import cn.dev33.satoken.context.model.SaResponse;
|
||||
*/
|
||||
public class SaResponseForSolon implements SaResponse {
|
||||
|
||||
Context ctx;
|
||||
protected Context ctx;
|
||||
|
||||
public SaResponseForSolon() {
|
||||
ctx = Context.current();
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.noear.solon.core.handle.Context;
|
||||
*/
|
||||
public class SaStorageForSolon implements SaStorage {
|
||||
|
||||
Context ctx;
|
||||
protected Context ctx;
|
||||
|
||||
public SaStorageForSolon() {
|
||||
ctx = Context.current();
|
||||
|
||||
Reference in New Issue
Block a user