Refine search
@AroundInvoke public Object intercept(final InvocationContext ic) throws Exception { try { return ic.proceed(); } catch (final WebApplicationException wae) { if (store != null) { store.setException(wae); } throw wae; } } }
@AroundInvoke public Object validateMethodInvocation(InvocationContext ctx) throws Exception { ExecutableValidator executableValidator = validator.forExecutables(); Set<ConstraintViolation<Object>> violations = executableValidator.validateParameters( ctx.getTarget(), ctx.getMethod(), ctx.getParameters() );
@AroundInvoke public Object validateMethodInvocation(InvocationContext ctx) throws Exception { final boolean isJaxRsMethod = extension.jaxRsResourceCache.apply(ctx.getMethod().getDeclaringClass()); return isJaxRsMethod ? ctx.proceed() : interceptor.validateMethodInvocation(ctx); }
@AroundInvoke public Object log(InvocationContext context) throws Exception { Object[] parameters = context.getParameters(); if (parameters.length > 0 && parameters[0] instanceof String) { String param = (String) parameters[0]; parameters[0] = "Hi " + param + " !"; context.setParameters(parameters); } return context.proceed(); } }
/** * This interceptor will catch all exception and convert them using the exceptionhandler * @param ctx the invocation context * @return the result * @throws JaxRsResponseException an exception that can be handled by a jee container */ @AroundInvoke public Object intercept(final InvocationContext ctx) throws JaxRsResponseException { try { return ctx.proceed(); } catch (final Exception theException) { final AbstractJaxRsProvider theServer = (AbstractJaxRsProvider) ctx.getTarget(); throw convertException(theServer, theException); } }
/** * Intercepts a call to bean method annotated by any of the fault tolerance * annotations. * * @param context Invocation context. * @return Whatever the intercepted method returns. * @throws Throwable If a problem occurs. */ @AroundInvoke public Object interceptCommand(InvocationContext context) throws Throwable { try { LOGGER.fine("Interceptor called for '" + context.getTarget().getClass() + "::" + context.getMethod().getName() + "'"); // Create method introspector and executer retrier final MethodIntrospector introspector = new MethodIntrospector( context.getTarget().getClass(), context.getMethod()); final CommandRetrier retrier = new CommandRetrier(context, introspector); return retrier.execute(); } catch (Throwable t) { LOGGER.fine("Throwable caught by interceptor '" + t.getMessage() + "'"); throw t; } } }
@AroundInvoke private Object aroundMethod(InvocationContext context) throws Exception { return called(context, context.getMethod()); }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { contextDataOK = ctx.getContextData().get("foo").equals("bar"); ctx.getContextData().put("foo", "barbar"); return ctx.proceed(); }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { Object[] parameters = new Object[]{"1", new HashSet<Integer>()}; ctx.setParameters(parameters); return ctx.proceed(); } }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { return ctx.getParameters()[0]; } }
@AroundInvoke public Object aroundInvoke(InvocationContext invocation) throws Exception { return invoke( new EJBInvocationContext(invocation), EventType.AROUND_INVOKE); }
@AroundInvoke public Object logMethod(InvocationContext ic) throws Exception { logger.entering(ic.getTarget().toString(), ic.getMethod().getName()); logger.severe("I3>>>" + ic.getTarget().toString() + " - " + ic.getMethod().getName()); try { return ic.proceed(); } finally { logger.severe("I3<<<" + ic.getTarget().toString() + " - " + ic.getMethod().getName()); logger.exiting(ic.getTarget().toString(), ic.getMethod().getName()); } } }
@AroundInvoke public Object invoke(InvocationContext ctx) throws Exception { try { Object result = ctx.proceed(); CompleteTask completeTaskAnnotation = ctx.getMethod().getAnnotation(CompleteTask.class); boolean endConversation = completeTaskAnnotation.endConversation(); businessProcess.completeTask(endConversation); return result; } catch (InvocationTargetException e) { throw new ProcessEngineCdiException("Error while completing task: "+e.getCause().getMessage(), e.getCause()); } }
@AroundInvoke public Object log(InvocationContext context) throws Exception { Object[] parameters = context.getParameters(); if (parameters.length > 0 && parameters[0] instanceof String) { String param = (String) parameters[0]; parameters[0] = "Hi " + param + " !"; context.setParameters(parameters); } return context.proceed(); } }
@AroundInvoke public Object invokeMockableBean(InvocationContext ctx) throws Throwable { Class<?> javaClass = ReflectionsUtils.getOriginalClass(ctx.getTarget().getClass()); if (invocationTargetManager.get().isAlternativeEnabled(javaClass)) { return callAlternative(ctx, javaClass); } else if (invocationTargetManager.get().isMockEnabled(javaClass)) { return callMock(ctx, javaClass); } else { return ctx.proceed(); } }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { return ctx.getMethod().equals(SimpleBean.class.getMethod("testGetMethod")); } }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { return ctx.getParameters()[0]; } }
@AroundInvoke public Object logMethodEntry(InvocationContext ctx) throws Exception { MultivaluedMap<String, String> params = jaxrsService.getUriInfo().getQueryParameters(); String user = params.getFirst("user"); if (nameService.getName().equals(user)) { return ctx.proceed(); } else { throw new ForbiddenException("Forbidden resource for the user: " + user); } } }
@AroundInvoke public Object logMethod(InvocationContext ic) throws Exception { logger.entering(ic.getTarget().toString(), ic.getMethod().getName()); logger.severe("I2>>>" + ic.getTarget().toString() + " - " + ic.getMethod().getName()); try { return ic.proceed(); } finally { logger.severe("I2<<<" + ic.getTarget().toString() + " - " + ic.getMethod().getName()); logger.exiting(ic.getTarget().toString(), ic.getMethod().getName()); } } }
@AroundInvoke public Object invoke(InvocationContext ctx) throws Exception { try { Object result = ctx.proceed(); StartProcess startProcessAnnotation = ctx.getMethod().getAnnotation(StartProcess.class); String key = startProcessAnnotation.value(); Map<String, Object> variables = extractVariables(startProcessAnnotation, ctx); businessProcess.startProcessByKey(key, variables); return result; } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if(cause != null && cause instanceof Exception) { throw (Exception) cause; } else { throw e; } } catch (Exception e) { throw new ProcessEngineException("Error while starting process using @StartProcess on method '"+ctx.getMethod()+"': " + e.getMessage(), e); } }