Package cn.dev33.satoken.context.model
Interface SaRequest
- All Known Implementing Classes:
SaRequestForMock
public interface SaRequest
Request 请求对象 包装类
- Since:
- 1.16.0
- Author:
- click33
-
Method Summary
Modifier and TypeMethodDescription转发请求getCookieFirstValue(String name) 在 [ Cookie作用域 ] 里获取一个值 (第一个此名称的)getCookieLastValue(String name) 在 [ Cookie作用域 ] 里获取一个值 (最后一个此名称的)getCookieValue(String name) 在 [ Cookie作用域 ] 里获取一个值在 [ 请求头 ] 里获取一个值default String在 [ 请求头 ] 里获取一个值getHost()查询请求 host返回当前请求的类型在 [ 请求体 ] 里获取一个参数值default String在 [ 请求体 ] 里获取一个参数值,值为空时返回默认值获取 [ 请求体 ] 里提交的所有参数获取 [ 请求体 ] 里提交的所有参数名称default StringgetParamNotNull(String name) 在 [ 请求体 ] 里获取一个值 (此值必须存在,否则抛出异常 )返回当前请求path (不包括上下文名称)获取底层被包装的源对象getUrl()返回当前请求的url,不带query参数,例:http://xxx.com/testdefault boolean在 [ 请求体 ] 里检测请求是否提供了指定参数default booleanisAjax()判断此请求是否为 Ajax 异步请求default booleanisMethod(SaHttpMethod method) 返回当前请求 Method 是否为指定值default boolean返回当前请求 Method 是否为指定值default boolean在 [ 请求体 ] 里检测提供的参数是否为指定值default boolean返回当前请求 path 是否为指定值
-
Method Details
-
getSource
Object getSource()获取底层被包装的源对象- Returns:
- /
-
getParam
在 [ 请求体 ] 里获取一个参数值- Parameters:
name- 键- Returns:
- 值
-
getParam
在 [ 请求体 ] 里获取一个参数值,值为空时返回默认值- Parameters:
name- 键defaultValue- 值为空时的默认值- Returns:
- 值
-
isParam
在 [ 请求体 ] 里检测提供的参数是否为指定值- Parameters:
name- 键value- 值- Returns:
- 是否相等
-
hasParam
在 [ 请求体 ] 里检测请求是否提供了指定参数- Parameters:
name- 参数名称- Returns:
- 是否提供
-
getParamNotNull
在 [ 请求体 ] 里获取一个值 (此值必须存在,否则抛出异常 )- Parameters:
name- 键- Returns:
- 参数值
-
getParamNames
Collection<String> getParamNames()获取 [ 请求体 ] 里提交的所有参数名称- Returns:
- 参数名称列表
-
getParamMap
获取 [ 请求体 ] 里提交的所有参数- Returns:
- 参数列表
-
getHeader
在 [ 请求头 ] 里获取一个值- Parameters:
name- 键- Returns:
- 值
-
getHeader
在 [ 请求头 ] 里获取一个值- Parameters:
name- 键defaultValue- 值为空时的默认值- Returns:
- 值
-
getCookieValue
在 [ Cookie作用域 ] 里获取一个值- Parameters:
name- 键- Returns:
- 值
-
getCookieFirstValue
在 [ Cookie作用域 ] 里获取一个值 (第一个此名称的)- Parameters:
name- 键- Returns:
- 值
-
getCookieLastValue
在 [ Cookie作用域 ] 里获取一个值 (最后一个此名称的)- Parameters:
name- 键- Returns:
- 值
-
getRequestPath
String getRequestPath()返回当前请求path (不包括上下文名称)- Returns:
- /
-
isPath
返回当前请求 path 是否为指定值- Parameters:
path- path- Returns:
- /
-
getUrl
String getUrl()返回当前请求的url,不带query参数,例:http://xxx.com/test- Returns:
- /
-
getMethod
String getMethod()返回当前请求的类型- Returns:
- /
-
isMethod
返回当前请求 Method 是否为指定值- Parameters:
method- method- Returns:
- /
-
isMethod
返回当前请求 Method 是否为指定值- Parameters:
method- method- Returns:
- /
-
getHost
String getHost()查询请求 host- Returns:
- /
-
isAjax
default boolean isAjax()判断此请求是否为 Ajax 异步请求- Returns:
- /
-
forward
转发请求- Parameters:
path- 转发地址- Returns:
- 任意值
-