public class SpiUtils extends Object
| 构造器和说明 |
|---|
SpiUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
checkRemoteIp(javax.servlet.http.HttpServletRequest request,
List<String> topIpList)
检查发起SPI请求的来源IP是否是TOP机房的出口IP。
|
static CheckResult |
checkSign(javax.servlet.http.HttpServletRequest request,
String secret)
校验SPI请求签名,不支持带上传文件的HTTP请求。
|
static boolean |
checkSign4FileRequest(javax.servlet.http.HttpServletRequest request,
Map<String,String> form,
String secret)
校验SPI请求签名,适用于带文件上传的POST请求。
|
static boolean |
checkSign4FormRequest(javax.servlet.http.HttpServletRequest request,
String secret)
已过时。
请使用checkSign方法
|
static boolean |
checkSign4TextRequest(javax.servlet.http.HttpServletRequest request,
String body,
String secret)
已过时。
请使用checkSign方法
|
static boolean |
checkTimestamp(javax.servlet.http.HttpServletRequest request,
int minutes)
检查SPI请求到达服务器端是否已经超过指定的分钟数,如果超过则拒绝请求。
|
static Map<String,String> |
getFormMap(javax.servlet.http.HttpServletRequest request,
Map<String,String> queryMap)
获取表单参数为map
|
static Map<String,String> |
getHeaderMap(javax.servlet.http.HttpServletRequest request,
String charset)
获取header参数为map
|
static Map<String,String> |
getQueryMap(javax.servlet.http.HttpServletRequest request,
String charset)
获取url参数为map
|
static String |
getStreamAsString(InputStream stream,
String charset)
获取body为字符串
|
public static CheckResult checkSign(javax.servlet.http.HttpServletRequest request, String secret) throws IOException
request - HttpServletRequest对象实例secret - APP密钥IOExceptionpublic static boolean checkSign4FormRequest(javax.servlet.http.HttpServletRequest request,
String secret)
throws IOException
request - 请求对象secret - app对应的secretIOExceptionpublic static boolean checkSign4TextRequest(javax.servlet.http.HttpServletRequest request,
String body,
String secret)
throws IOException
request - 请求对象body - 请求体的文本内容secret - app对应的secretIOExceptionpublic static boolean checkSign4FileRequest(javax.servlet.http.HttpServletRequest request,
Map<String,String> form,
String secret)
throws IOException
request - 请求对象form - 除了文件参数以外的所有普通文本参数的map集合secret - app对应的secretIOExceptionpublic static Map<String,String> getHeaderMap(javax.servlet.http.HttpServletRequest request, String charset) throws IOException
IOExceptionpublic static Map<String,String> getQueryMap(javax.servlet.http.HttpServletRequest request, String charset) throws IOException
IOExceptionpublic static Map<String,String> getFormMap(javax.servlet.http.HttpServletRequest request, Map<String,String> queryMap) throws IOException
IOExceptionpublic static String getStreamAsString(InputStream stream, String charset) throws IOException
IOExceptionpublic static boolean checkTimestamp(javax.servlet.http.HttpServletRequest request,
int minutes)
Copyright © 2020. All rights reserved.