mirror of https://github.com/halo-dev/halo
Remove http servlet request inject
parent
80551dd28b
commit
e244a91a2e
|
@ -1,9 +1,5 @@
|
||||||
package run.halo.app.cache.lock;
|
package run.halo.app.cache.lock;
|
||||||
|
|
||||||
import run.halo.app.cache.StringCacheStore;
|
|
||||||
import run.halo.app.exception.FrequentAccessException;
|
|
||||||
import run.halo.app.exception.ServiceException;
|
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
@ -13,8 +9,11 @@ import org.aspectj.lang.reflect.MethodSignature;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import run.halo.app.cache.StringCacheStore;
|
||||||
|
import run.halo.app.exception.FrequentAccessException;
|
||||||
|
import run.halo.app.exception.ServiceException;
|
||||||
|
import run.halo.app.utils.ServletUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,12 +33,8 @@ public class CacheLockInterceptor {
|
||||||
|
|
||||||
private final StringCacheStore cacheStore;
|
private final StringCacheStore cacheStore;
|
||||||
|
|
||||||
private final HttpServletRequest httpServletRequest;
|
public CacheLockInterceptor(StringCacheStore cacheStore) {
|
||||||
|
|
||||||
public CacheLockInterceptor(StringCacheStore cacheStore,
|
|
||||||
HttpServletRequest httpServletRequest) {
|
|
||||||
this.cacheStore = cacheStore;
|
this.cacheStore = cacheStore;
|
||||||
this.httpServletRequest = httpServletRequest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Around("@annotation(run.halo.app.cache.lock.CacheLock)")
|
@Around("@annotation(run.halo.app.cache.lock.CacheLock)")
|
||||||
|
@ -121,7 +116,7 @@ public class CacheLockInterceptor {
|
||||||
|
|
||||||
if (cacheLock.traceRequest()) {
|
if (cacheLock.traceRequest()) {
|
||||||
// Append http request info
|
// Append http request info
|
||||||
cacheKeyBuilder.append(delimiter).append(ServletUtil.getClientIP(httpServletRequest));
|
cacheKeyBuilder.append(delimiter).append(ServletUtils.getRequestIp());
|
||||||
}
|
}
|
||||||
|
|
||||||
return cacheKeyBuilder.toString();
|
return cacheKeyBuilder.toString();
|
||||||
|
|
Loading…
Reference in New Issue