org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint Java Examples

The following examples show how to use org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrustedServiceInterceptor.java    From cuba with Apache License 2.0 6 votes vote down vote up
/**
 * Check if the client is permitted to call the service method.
 *
 * @param ctx context
 */
protected void checkTrustedAccess(ProceedingJoinPoint ctx) {
    RemoteClientInfo remoteClientInfo = RemoteClientInfo.get();

    if (remoteClientInfo != null
            && ctx instanceof MethodInvocationProceedingJoinPoint) {
        if (!trustedLoginHandler.checkAddress(remoteClientInfo.getAddress())) {
            log.warn("Client is not allowed to call '{}' since IP '{}' is not trusted",
                    ctx.getSignature().toShortString(),
                    remoteClientInfo.getAddress());

            throw new TrustedAccessRequiredException();
        }
    }
}
 
Example #2
Source File: MockInterceptor.java    From fluent-validator with Apache License 2.0 5 votes vote down vote up
@Around("execution(* com.baidu.unbiz.fluentvalidator.service.impl.CarServiceImpl.*(..))")
public Object validate4AjaxQuery(ProceedingJoinPoint pjp) throws Throwable {
    MethodInvocationProceedingJoinPoint methodJoinPoint = (MethodInvocationProceedingJoinPoint) pjp;
    MethodSignature methodSignature = (MethodSignature) methodJoinPoint.getSignature();
    System.out.println("here we enter aspectJ interceptor");
    Object[] args = pjp.getArgs();
    System.out.println(Arrays.asList(args));
    System.out.println(methodSignature);

    return pjp.proceed();
}
 
Example #3
Source File: ReflectUtil.java    From dog with GNU Lesser General Public License v3.0 3 votes vote down vote up
public static Annotation[][] getParameterAnnotations(ProceedingJoinPoint pjp) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {

        MethodInvocationProceedingJoinPoint methodJoinPoint = (MethodInvocationProceedingJoinPoint) pjp;

        Field methodInvocationfield = methodJoinPoint.getClass().getDeclaredField("methodInvocation");

        methodInvocationfield.setAccessible(true);

        Annotation[][] argAnnotations = ((ReflectiveMethodInvocation) methodInvocationfield.get(methodJoinPoint)).getMethod().getParameterAnnotations();

        return argAnnotations;
    }