mirror of
https://gitee.com/dromara/sa-token.git
synced 2024-12-01 19:37:42 +08:00
调整 SaRequest:getParamNames() 改为 Collection 类型(之前为 List)
This commit is contained in:
parent
d3d11ce2b9
commit
d8e9e98152
@ -20,6 +20,7 @@ import cn.dev33.satoken.exception.SaTokenException;
|
||||
import cn.dev33.satoken.router.SaHttpMethod;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -95,7 +96,7 @@ public interface SaRequest {
|
||||
* 获取 [ 请求体 ] 里提交的所有参数名称
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
List<String> getParamNames();
|
||||
Collection<String> getParamNames();
|
||||
|
||||
/**
|
||||
* 获取 [ 请求体 ] 里提交的所有参数
|
||||
|
@ -18,6 +18,7 @@ package cn.dev33.satoken.context.dubbo.model;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
import org.apache.dubbo.rpc.RpcContext;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -64,7 +65,7 @@ public class SaRequestForDubbo implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
public Collection<String> getParamNames(){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ package cn.dev33.satoken.context.dubbo3.model;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
import org.apache.dubbo.rpc.RpcContext;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -64,7 +65,7 @@ public class SaRequestForDubbo3 implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
public Collection<String> getParamNames(){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ package cn.dev33.satoken.context.grpc.model;
|
||||
import cn.dev33.satoken.context.grpc.context.SaTokenGrpcContext;
|
||||
import cn.dev33.satoken.context.model.SaRequest;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -51,7 +52,7 @@ public class SaRequestForGrpc implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
public Collection<String> getParamNames(){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -71,13 +71,8 @@ public class SaRequestForServlet implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
Enumeration<String> parameterNames = request.getParameterNames();
|
||||
List<String> list = new ArrayList<>();
|
||||
while (parameterNames.hasMoreElements()) {
|
||||
list.add(parameterNames.nextElement());
|
||||
}
|
||||
return list;
|
||||
public Collection<String> getParamNames(){
|
||||
return Collections.list(request.getParameterNames());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,10 +27,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebFilterChain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 对 SaRequest 包装类的实现(Reactor 响应式编程版)
|
||||
@ -74,9 +71,8 @@ public class SaRequestForReactor implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
Set<String> names = request.getQueryParams().keySet();
|
||||
return new ArrayList<>(names);
|
||||
public Collection<String> getParamNames(){
|
||||
return request.getQueryParams().keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,10 +27,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebFilterChain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 对 SaRequest 包装类的实现(Reactor 响应式编程版)
|
||||
@ -74,9 +71,8 @@ public class SaRequestForReactor implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
Set<String> names = request.getQueryParams().keySet();
|
||||
return new ArrayList<>(names);
|
||||
public Collection<String> getParamNames(){
|
||||
return request.getQueryParams().keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,13 +71,8 @@ public class SaRequestForServlet implements SaRequest {
|
||||
* @return 参数名称列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getParamNames(){
|
||||
Enumeration<String> parameterNames = request.getParameterNames();
|
||||
List<String> list = new ArrayList<>();
|
||||
while (parameterNames.hasMoreElements()) {
|
||||
list.add(parameterNames.nextElement());
|
||||
}
|
||||
return list;
|
||||
public Collection<String> getParamNames(){
|
||||
return Collections.list(request.getParameterNames());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,10 +20,7 @@ import cn.dev33.satoken.context.model.SaRequest;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
import org.noear.solon.core.handle.Context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author noear
|
||||
@ -48,8 +45,8 @@ public class SaRequestForSolon implements SaRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getParamNames() {
|
||||
return new ArrayList<>(ctx.paramNames());
|
||||
public Collection<String> getParamNames() {
|
||||
return ctx.paramNames();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user