format code
This commit is contained in:
@@ -4,13 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeesite.common.web;
|
package com.jeesite.common.web;
|
||||||
|
|
||||||
|
import com.jeesite.common.codec.EncodeUtils;
|
||||||
|
import com.jeesite.common.lang.StringUtils;
|
||||||
|
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.jeesite.common.codec.EncodeUtils;
|
|
||||||
import com.jeesite.common.lang.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cookie工具类
|
* Cookie工具类
|
||||||
* @author ThinkGem
|
* @author ThinkGem
|
||||||
@@ -31,8 +31,7 @@ public class CookieUtils {
|
|||||||
* 设置 Cookie
|
* 设置 Cookie
|
||||||
* @param name 名称
|
* @param name 名称
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @param maxAge 生存时间(单位秒)
|
* @param path 路径
|
||||||
* @param uri 路径
|
|
||||||
*/
|
*/
|
||||||
public static void setCookie(HttpServletResponse response, String name, String value, String path) {
|
public static void setCookie(HttpServletResponse response, String name, String value, String path) {
|
||||||
setCookie(response, name, value, path, 60*60*24*30);
|
setCookie(response, name, value, path, 60*60*24*30);
|
||||||
@@ -43,7 +42,6 @@ public class CookieUtils {
|
|||||||
* @param name 名称
|
* @param name 名称
|
||||||
* @param value 值
|
* @param value 值
|
||||||
* @param maxAge 生存时间(单位秒)
|
* @param maxAge 生存时间(单位秒)
|
||||||
* @param uri 路径
|
|
||||||
*/
|
*/
|
||||||
public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) {
|
public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) {
|
||||||
setCookie(response, name, value, "/", maxAge);
|
setCookie(response, name, value, "/", maxAge);
|
||||||
@@ -53,8 +51,8 @@ public class CookieUtils {
|
|||||||
* 设置 Cookie
|
* 设置 Cookie
|
||||||
* @param name 名称
|
* @param name 名称
|
||||||
* @param value 值
|
* @param value 值
|
||||||
|
* @param path 路径
|
||||||
* @param maxAge 生存时间(单位秒)
|
* @param maxAge 生存时间(单位秒)
|
||||||
* @param uri 路径
|
|
||||||
*/
|
*/
|
||||||
public static void setCookie(HttpServletResponse response, String name, String value, String path, int maxAge) {
|
public static void setCookie(HttpServletResponse response, String name, String value, String path, int maxAge) {
|
||||||
if (StringUtils.isNotBlank(name)){
|
if (StringUtils.isNotBlank(name)){
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class InnerFilter extends AccessControlFilter {
|
|||||||
"shiro.innerFilterAllowRemoteAddrs", "127.0.0.1"), ",");
|
"shiro.innerFilterAllowRemoteAddrs", "127.0.0.1"), ",");
|
||||||
}
|
}
|
||||||
if (prefixes != null && request instanceof HttpServletRequest){
|
if (prefixes != null && request instanceof HttpServletRequest){
|
||||||
String ip = ((HttpServletRequest)request).getRemoteAddr();
|
String ip = request.getRemoteAddr();
|
||||||
for (String prefix : prefixes){
|
for (String prefix : prefixes){
|
||||||
result = StringUtils.startsWithIgnoreCase(ip, StringUtils.trim(prefix));
|
result = StringUtils.startsWithIgnoreCase(ip, StringUtils.trim(prefix));
|
||||||
if (result){
|
if (result){
|
||||||
|
|||||||
Reference in New Issue
Block a user