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 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 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 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 log(InvocationContext context) throws Exception { Object[] parameters = context.getParameters(); if (parameters.length > 0 && parameters[0] instanceof String) { String param = (String) parameters[0]; parameters[0] = param + " Nice to meet you."; context.setParameters(parameters); } return context.proceed(); } }
@AroundInvoke public Object validateMethodInvocation(InvocationContext ctx) throws Exception { final boolean isJaxRsMethod = extension.jaxRsResourceCache.apply(ctx.getMethod().getDeclaringClass()); return isJaxRsMethod ? ctx.proceed() : interceptor.validateMethodInvocation(ctx); }
/** * Intercepte une exécution de méthode sur un ejb. * @param context InvocationContext * @return Object * @throws Exception e */ @AroundInvoke public Object intercept(InvocationContext context) throws Exception { // NOPMD // cette méthode est appelée par le conteneur ejb grâce à l'annotation AroundInvoke if (DISABLED || !EJB_COUNTER.isDisplayed()) { return context.proceed(); } // nom identifiant la requête final String requestName = getRequestName(context); boolean systemError = false; try { EJB_COUNTER.bindContextIncludingCpu(requestName); return context.proceed(); } catch (final Error e) { // on catche Error pour avoir les erreurs systèmes // mais pas Exception qui sont fonctionnelles en général systemError = true; throw e; } finally { // on enregistre la requête dans les statistiques EJB_COUNTER.addRequestForCurrentContext(systemError); } }
@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()); } }
/** * 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); } }
@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); } }
@AroundInvoke public Object validateMethodInvocation(InvocationContext ctx) throws Exception { ExecutableValidator executableValidator = validator.forExecutables(); Object result = ctx.proceed();
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { return ctx.proceed(); } }
@AroundInvoke public Object doZoom(InvocationContext ctx) throws Exception { invocations++; return ctx.proceed(); }
@AroundInvoke public Object saveMethodEntry(InvocationContext invocationContext) throws Exception { called++; return invocationContext.proceed(); }
@AroundInvoke public Object aroundInvoke(InvocationContext ctx) throws Exception { intercepted = true; return ((Integer) ctx.proceed()) + 10; }
@AroundInvoke public Object intercept2(InvocationContext ctx) throws Exception { int id = (Integer) ctx.proceed(); assert id == 1; return id + 1; } }
@AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception { intercepted = true; return ctx.proceed(); } }
@AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception { intercepted = true; return ctx.proceed(); }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { return ctx.proceed(); } }
@AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception { if (!FooImpl.decoratorCalledFirst) FooImpl.interceptorCalledFirst = true; return ctx.proceed(); } }