public class WebServiceUtils
extends java.lang.Object
构造器和说明 |
---|
WebServiceUtils() |
限定符和类型 | 方法和说明 |
---|---|
static boolean |
ajaxRequest(javax.servlet.http.HttpServletRequest request) |
static boolean |
captchaCheck(StateHubService service,
java.lang.String token)
验证码验证
|
static boolean |
containLimitChars(CharLimitType type,
java.lang.String inputString)
特殊字符后端限制
|
static boolean |
containSearchKeyword(java.lang.String originText,
java.lang.String keyword)
是否包含搜索关键词,不区分大小写
|
static boolean |
containSearchKeyword(java.lang.String originText,
java.lang.String keyword,
boolean caseSensitive)
是否包含搜索关键词
|
static boolean |
containSQLChars(java.lang.String inputString)
是否包含SQL注入字符
|
static java.util.Map<java.lang.String,java.lang.Object> |
createInitializeData(User user)
注入用户信息
|
static java.util.Map<java.lang.String,java.lang.Object> |
createSystemConfig()
注入系统信息
|
static java.lang.String |
createUniquePostId(java.lang.String departmentId,
java.lang.String postId)
构造带有连接符部门职位ID,实际职位ID=父部门ID#职位ID
|
static java.lang.String |
dealWithClassName(java.lang.String className)
前端传过来的是com/xxx/xxx.class(max,linux) 或者 com\xxx\xxx.class(windows)
需要处理成包名
|
static java.lang.String |
dealWithIP(java.lang.String ip)
如果ip是127.0.0.1或者0:0:0:0:0:0:0:1,转为localhost
|
static java.lang.String |
generateCaptcha(int num)
生成指定长度的校验码
|
static java.lang.String |
generateErrorWebPage(java.lang.String result,
java.lang.String reason,
java.lang.String solution)
返回错误页面
|
static java.lang.String |
generateNoPrivilegeAccessPage()
返回无权限访问该页面的提示页面
|
static java.lang.String |
generateUnavailableWebPage(java.lang.String result,
java.lang.String reason,
java.lang.String solution)
返回功能不支持页面
|
static java.lang.String |
generateVoteToken(java.lang.String sessionId,
java.lang.String votePath)
模板认证的token 用来识别超链之类的子模板
|
static java.lang.String |
getBase64DecodeStr(java.lang.String encodeStr)
base64解码
|
static java.lang.String |
getBrowserInfoFromRequest(java.lang.String browserDetails)
获取浏览器信息
|
static java.util.Map<java.lang.String,java.lang.Object> |
getConfigValue(Configuration configuration)
获取config对象的值
|
static java.util.List<FileNodeBean> |
getFileNodes(java.lang.String parentPath,
java.lang.String rootDirectory,
java.lang.String[] acceptSuffix)
分层获取文件
|
static GZIPResponseWrapper |
getGZIPResponseWrapper(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
获取GZip响应
|
static java.util.Map<java.lang.String,java.lang.Object> |
getHyperlinks()
获取超链
|
static java.lang.String |
getIpInfoFromRequest(javax.servlet.http.HttpServletRequest request)
获取请求ip
|
static java.lang.String |
getOSInfoFromRequest(java.lang.String browserDetails)
获取操作系统信息
|
static java.util.List<FileNodeBean> |
getRecursiveFileNodes(java.lang.String pPath,
java.lang.String rootDirectory,
java.lang.String[] acceptSuffix)
获取某个文件夹下面所有子文件
|
static java.lang.String |
getServiceFullUrl(javax.servlet.http.HttpServletRequest request,
java.lang.String mapping)
获取服务器url
|
static java.lang.String |
getStackTraceInfo(java.lang.Exception ex)
从异常中获取具体的堆栈信息
|
static java.lang.String |
getUsernameByText(java.lang.String text)
zed(123) 转 123
|
static java.util.List<java.lang.Object> |
getVisualizationParam()
动态获取常规页面的参数
|
static boolean |
isDefaultPassword(java.lang.String password)
密码是否是 “******”
|
static boolean |
lackDriver(java.lang.Throwable e,
java.lang.String driver)
是否为缺少
|
static DepRole |
parseUniqueDepartmentPostId(java.lang.String uniquePostId)
解析带有连接符的部门职位ID
|
static java.lang.String[] |
parseUniquePostId(java.lang.String uniquePostId)
解析带有连接符的部门职位ID
|
static java.lang.String |
parseWebPageResource(java.lang.String pagePackagePath,
java.util.Map<java.lang.String,java.lang.Object> parametersMap)
解析web页资源
|
static java.lang.String |
parseWebPageResourceSafe(java.lang.String pagePackagePath,
java.util.Map<java.lang.String,java.lang.Object> parametersMap)
调用此接口必须保证注入的参数是json,或者是下列几个固定参数,或者注入的就是字符串
|
static java.util.List<FileNodeBean> |
searchFileNodes(java.lang.String pPath,
java.lang.String rootDirectory,
java.lang.String[] acceptSuffix,
java.lang.String keyword)
文件搜索
|
static void |
setConfigValue(Configuration configuration,
java.util.Map<java.lang.String,java.lang.Object> param)
设置config对象的值
|
static void |
setRolePageQueryResHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int page,
int count,
java.lang.String keyword)
设置角色分页查询的响应头
|
static void |
setUserPageQueryResHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int page,
int count,
java.lang.String keyword,
boolean asc,
int filter,
int total)
设置用户分页查询的响应头
|
static void |
setVisualizationParam(java.lang.String category,
java.util.Map<java.lang.String,java.lang.Object> param)
修改参数
|
public static java.lang.String generateNoPrivilegeAccessPage() throws java.lang.Exception
java.lang.Exception
- 异常public static java.lang.String generateUnavailableWebPage(java.lang.String result, java.lang.String reason, java.lang.String solution) throws java.lang.Exception
result
- 结果reason
- 原因solution
- 解决方案java.lang.Exception
- 异常public static java.lang.String generateErrorWebPage(java.lang.String result, java.lang.String reason, java.lang.String solution) throws java.lang.Exception
result
- 结果reason
- 原因solution
- 解决方案java.lang.Exception
- 异常public static java.lang.String getStackTraceInfo(java.lang.Exception ex)
ex
- 异常public static boolean captchaCheck(StateHubService service, java.lang.String token) throws java.lang.Exception
service
- 状态服务器token
- 令牌java.lang.Exception
- 异常public static void setUserPageQueryResHeader(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int page, int count, java.lang.String keyword, boolean asc, int filter, int total)
request
- 请求response
- 响应page
- 分页数count
- 每页用户数keyword
- 关键词asc
- 是否升序filter
- 过滤器public static void setRolePageQueryResHeader(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int page, int count, java.lang.String keyword)
request
- 请求response
- 响应page
- 分页数count
- 每页角色数keyword
- 关键词public static java.lang.String createUniquePostId(java.lang.String departmentId, java.lang.String postId)
departmentId
- 部门IDpostId
- 职位IDpublic static java.lang.String[] parseUniquePostId(java.lang.String uniquePostId)
uniquePostId
- 部门职位唯一IDpublic static DepRole parseUniqueDepartmentPostId(java.lang.String uniquePostId)
uniquePostId
- 部门职位唯一IDpublic static java.lang.String parseWebPageResource(java.lang.String pagePackagePath, java.util.Map<java.lang.String,java.lang.Object> parametersMap) throws java.lang.Exception
pagePackagePath
- 页面包路径parametersMap
- 参数列表java.lang.Exception
- 异常public static java.lang.String parseWebPageResourceSafe(java.lang.String pagePackagePath, java.util.Map<java.lang.String,java.lang.Object> parametersMap) throws java.lang.Exception
pagePackagePath
- 页面路径parametersMap
- 参数列表java.lang.Exception
public static java.lang.String dealWithClassName(java.lang.String className) throws java.lang.Exception
className
- 类名java.lang.Exception
- 异常public static java.util.Map<java.lang.String,java.lang.Object> createInitializeData(User user) throws java.lang.Exception
user
- java.lang.Exception
public static java.util.Map<java.lang.String,java.lang.Object> createSystemConfig() throws java.lang.Exception
java.lang.Exception
public static java.util.Map<java.lang.String,java.lang.Object> getHyperlinks()
java.lang.Exception
public static boolean containSearchKeyword(java.lang.String originText, java.lang.String keyword, boolean caseSensitive)
originText
- 源文本keyword
- 关键词caseSensitive
- 区分大小写public static boolean containSearchKeyword(java.lang.String originText, java.lang.String keyword)
originText
- 源文本keyword
- 关键词public static boolean ajaxRequest(javax.servlet.http.HttpServletRequest request)
public static boolean isDefaultPassword(java.lang.String password)
password
- public static java.lang.String getUsernameByText(java.lang.String text)
text
- public static java.lang.String getBase64DecodeStr(java.lang.String encodeStr)
encodeStr
- java.lang.Exception
public static java.lang.String generateCaptcha(int num)
num
- 长度public static java.lang.String getIpInfoFromRequest(javax.servlet.http.HttpServletRequest request)
request
- public static java.lang.String dealWithIP(java.lang.String ip)
ip
- public static java.lang.String getBrowserInfoFromRequest(java.lang.String browserDetails)
browserDetails
- public static GZIPResponseWrapper getGZIPResponseWrapper(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
req
- 请求res
- 响应public static java.lang.String getOSInfoFromRequest(java.lang.String browserDetails)
browserDetails
- public static boolean containSQLChars(java.lang.String inputString)
inputString
- 输入字符public static java.lang.String getServiceFullUrl(javax.servlet.http.HttpServletRequest request, java.lang.String mapping)
request
- 请求mapping
- 访问路由public static java.util.List<java.lang.Object> getVisualizationParam()
public static void setVisualizationParam(java.lang.String category, java.util.Map<java.lang.String,java.lang.Object> param)
category
- 要修改的Configurationparam
- 更新对象public static java.util.Map<java.lang.String,java.lang.Object> getConfigValue(Configuration configuration)
configuration
- config对象public static void setConfigValue(Configuration configuration, java.util.Map<java.lang.String,java.lang.Object> param)
configuration
- config对象param
- 最新值public static java.util.List<FileNodeBean> getFileNodes(java.lang.String parentPath, java.lang.String rootDirectory, java.lang.String[] acceptSuffix) throws java.lang.Exception
parentPath
- 父目录路径rootDirectory
- 根目录路径acceptSuffix
- 查询文件的后缀java.lang.Exception
- 异常public static java.util.List<FileNodeBean> getRecursiveFileNodes(java.lang.String pPath, java.lang.String rootDirectory, java.lang.String[] acceptSuffix) throws java.lang.Exception
pPath
- 父目录路径rootDirectory
- 根目录路径acceptSuffix
- 查询的文件后缀java.lang.Exception
- 异常public static java.util.List<FileNodeBean> searchFileNodes(java.lang.String pPath, java.lang.String rootDirectory, java.lang.String[] acceptSuffix, java.lang.String keyword) throws java.lang.Exception
pPath
- 父目录路径rootDirectory
- 根目录路径acceptSuffix
- 查询的文件后缀keyword
- 关键字java.lang.Exception
- 异常public static java.lang.String generateVoteToken(java.lang.String sessionId, java.lang.String votePath)
sessionId
- 父模板的sessionidvotePath
- 当前模板路径public static boolean containLimitChars(CharLimitType type, java.lang.String inputString)
type
- 限制类型inputString
- 输入字符串public static boolean lackDriver(java.lang.Throwable e, java.lang.String driver)
e
- 异常driver
- 驱动名称