delete ruoyi 1.1.6

This commit is contained in:
RuoYi
2018-07-02 09:12:48 +08:00
parent 35a2114fc8
commit fccd5830a4
472 changed files with 0 additions and 86036 deletions

View File

@ -1,112 +0,0 @@
package com.ruoyi.common.utils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/**
* 客户端工具类
*
* @author ruoyi
*/
public class ServletUtils
{
/**
* 获取getStrAttribute
*/
public static String getStrAttribute(String name)
{
return StringUtils.valueAsStr(getRequestAttributes().getRequest().getAttribute(name));
}
/**
* 获取getIntAttribute
*/
public static int getIntAttribute(String name)
{
return StringUtils.valueAsInt(getRequestAttributes().getRequest().getAttribute(name));
}
/**
* 获取getStrParameter
*/
public static String getStrParameter(String name)
{
return StringUtils.valueAsStr(getRequestAttributes().getRequest().getParameter(name));
}
/**
* 获取getIntParameter
*/
public static Integer getIntParameter(String name)
{
return StringUtils.valueAsInt(getRequestAttributes().getRequest().getParameter(name));
}
public static ServletRequestAttributes getRequestAttributes()
{
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
return (ServletRequestAttributes) attributes;
}
/**
* 获取request
*/
public static HttpServletRequest getRequest()
{
return getRequestAttributes().getRequest();
}
/**
* 获取response
*/
public static HttpServletResponse getResponse()
{
return getRequestAttributes().getResponse();
}
/**
* 获取session
*/
public static HttpSession getSession()
{
return getRequest().getSession();
}
/**
* 是否是Ajax异步请求
*/
public static boolean isAjaxRequest(HttpServletRequest request)
{
String accept = request.getHeader("accept");
if (accept != null && accept.indexOf("application/json") != -1)
{
return true;
}
String xRequestedWith = request.getHeader("X-Requested-With");
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
{
return true;
}
String uri = request.getRequestURI();
if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
{
return true;
}
String ajax = request.getParameter("__ajax");
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
{
return true;
}
return false;
}
}