@Override public String toLongString() { return "execution(" + getSignature().toLongString() + ")"; }
/** * Return the ProceedingJoinPoint for the current invocation, * instantiating it lazily if it hasn't been bound to the thread already. * @param rmi the current Spring AOP ReflectiveMethodInvocation, * which we'll use for attribute binding * @return the ProceedingJoinPoint to make available to advice methods */ protected ProceedingJoinPoint lazyGetProceedingJoinPoint(ProxyMethodInvocation rmi) { return new MethodInvocationProceedingJoinPoint(rmi); }
private MethodWrapper putIfAbsent(Method method, String methodName, MethodInvocationProceedingJoinPoint pjp) throws NoSuchMethodException { MethodWrapper methodWrapper = thriftMethodWrapperMap.get(method); if (methodWrapper == null) { Method targetMethod = pjp.getTarget().getClass().getMethod(methodName, method.getParameterTypes()); ThriftMethodProvider provider = targetMethod.getAnnotation(ThriftMethodProvider.class); methodWrapper = new MethodWrapper() .setMethod(method) .setMethodName(methodName) .setReturnType(method.getReturnType()) .setAccessLogOn(provider.accessLogOn()); int rate = provider.rate(); if (rate > 0) { methodWrapper.setRateLimiter(RateLimiter.create(provider.rate())); } thriftMethodWrapperMap.put(method, methodWrapper); } return methodWrapper; }
@Nullable protected ValidateServiceMethodContext getValidateServiceMethodContext(ProceedingJoinPoint ctx) { ValidateServiceMethodContext validatedContext = null; if (ctx instanceof MethodInvocationProceedingJoinPoint) { MethodInvocationProceedingJoinPoint methodInvocationCtx = (MethodInvocationProceedingJoinPoint) ctx; Method method = ((MethodSignature) ctx.getSignature()).getMethod(); Validated validated = getValidated(method, ctx.getSignature().getDeclaringType()); if (validated != null) { Object[] args = methodInvocationCtx.getArgs(); ExecutableValidator validator = beanValidation.getValidator().forExecutables(); validatedContext = new ValidateServiceMethodContext(validator, ctx.getThis(), method, args, validated.value()); } } return validatedContext; }
@Override public String toShortString() { return "execution(" + getSignature().toShortString() + ")"; }
/** * Lazily instantiate joinpoint for the current invocation. * Requires MethodInvocation to be bound with ExposeInvocationInterceptor. * <p>Do not use if access is available to the current ReflectiveMethodInvocation * (in an around advice). * @return current AspectJ joinpoint, or through an exception if we're not in a * Spring AOP invocation. */ public static JoinPoint currentJoinPoint() { MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation(); if (!(mi instanceof ProxyMethodInvocation)) { throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi); } ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi; JoinPoint jp = (JoinPoint) pmi.getUserAttribute(JOIN_POINT_KEY); if (jp == null) { jp = new MethodInvocationProceedingJoinPoint(pmi); pmi.setUserAttribute(JOIN_POINT_KEY, jp); } return jp; }
@Override public String toString() { return "execution(" + getSignature().toString() + ")"; }
/** * Return the ProceedingJoinPoint for the current invocation, * instantiating it lazily if it hasn't been bound to the thread already. * @param rmi the current Spring AOP ReflectiveMethodInvocation, * which we'll use for attribute binding * @return the ProceedingJoinPoint to make available to advice methods */ protected ProceedingJoinPoint lazyGetProceedingJoinPoint(ProxyMethodInvocation rmi) { return new MethodInvocationProceedingJoinPoint(rmi); }
@Override public String toString() { return "execution(" + getSignature().toString() + ")"; }
/** * Return the ProceedingJoinPoint for the current invocation, * instantiating it lazily if it hasn't been bound to the thread already. * @param rmi the current Spring AOP ReflectiveMethodInvocation, * which we'll use for attribute binding * @return the ProceedingJoinPoint to make available to advice methods */ protected ProceedingJoinPoint lazyGetProceedingJoinPoint(ProxyMethodInvocation rmi) { return new MethodInvocationProceedingJoinPoint(rmi); }
@Override public String toShortString() { return "execution(" + getSignature().toShortString() + ")"; }
/** * Lazily instantiate joinpoint for the current invocation. * Requires MethodInvocation to be bound with ExposeInvocationInterceptor. * <p>Do not use if access is available to the current ReflectiveMethodInvocation * (in an around advice). * @return current AspectJ joinpoint, or through an exception if we're not in a * Spring AOP invocation. */ public static JoinPoint currentJoinPoint() { MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation(); if (!(mi instanceof ProxyMethodInvocation)) { throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi); } ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi; JoinPoint jp = (JoinPoint) pmi.getUserAttribute(JOIN_POINT_KEY); if (jp == null) { jp = new MethodInvocationProceedingJoinPoint(pmi); pmi.setUserAttribute(JOIN_POINT_KEY, jp); } return jp; }
@Override public String toString() { return "execution(" + getSignature().toString() + ")"; }
/** * Lazily instantiate joinpoint for the current invocation. * Requires MethodInvocation to be bound with ExposeInvocationInterceptor. * <p>Do not use if access is available to the current ReflectiveMethodInvocation * (in an around advice). * @return current AspectJ joinpoint, or through an exception if we're not in a * Spring AOP invocation. */ public static JoinPoint currentJoinPoint() { MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation(); if (!(mi instanceof ProxyMethodInvocation)) { throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi); } ProxyMethodInvocation pmi = (ProxyMethodInvocation) mi; JoinPoint jp = (JoinPoint) pmi.getUserAttribute(JOIN_POINT_KEY); if (jp == null) { jp = new MethodInvocationProceedingJoinPoint(pmi); pmi.setUserAttribute(JOIN_POINT_KEY, jp); } return jp; }
@Override public String toShortString() { return "execution(" + getSignature().toShortString() + ")"; }
@Override public String toLongString() { return "execution(" + getSignature().toLongString() + ")"; }
@Override public String toLongString() { return "execution(" + getSignature().toLongString() + ")"; }
public String calculateName() { Object target = joinPoint.getTarget(); if (joinPoint instanceof MethodInvocationProceedingJoinPoint) { Signature signature = ((MethodInvocationProceedingJoinPoint) joinPoint).getSignature(); if (signature instanceof MethodSignatureImpl) { String method = ((MethodSignatureImpl) signature).getName(); return calculateName(target.getClass(), method); } } return calculateShortName(target.getClass()); }
public Object handle(ProceedingJoinPoint pjp) throws Throwable { MethodInvocationProceedingJoinPoint methodPjp = (MethodInvocationProceedingJoinPoint) pjp; Method method = ((MethodSignature) methodPjp.getSignature()).getMethod(); ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest request = requestAttributes.getRequest();