/* (non-Javadoc)
@see net.sourceforge.stripes.controller.Interceptor#intercept(net.sourceforge.stripes.controller.ExecutionContext)
426088
public Resolution intercept(ExecutionContext context) throws Exception {
        // Continue on and execute other filters and the lifecycle code.
        Resolution resolution = context.proceed();
        
        // Get all fields with session.
        Collection<Field> fields = getSessionFields(context.getActionBean().getClass());
        
        // Restores values from session.
        if (LifecycleStage.ActionBeanResolution.equals(context.getLifecycleStage())) {
            this.restoreFields(fields, context.getActionBean(), context.getActionBeanContext());
        }
        // Store values in session.
        if (LifecycleStage.EventHandling.equals(context.getLifecycleStage())) {
            // Dont't update values in session if a validation error occured.
            if (context.getActionBeanContext().getValidationErrors().isEmpty()) {
            	if (fields.size() > 0)
            		this.saveFields(fields, context.getActionBean(), context.getActionBeanContext().getRequest().getSession());
            }
        }
        
        return resolution;
    }
685590
public void intercept(Invocation inv) {
		// 阻止 JFinal 原有规则 action 请求
		Controller controller = inv.getController();
		Boolean isRestfulForward = controller.getAttr(isRestfulForwardKey);
		String methodName = inv.getMethodName();
		if (set.contains(methodName) && isRestfulForward== null) {
			inv.getController().renderError(404);
			return ;
		}
		
		if (isRestfulForward != null && isRestfulForward) {
			inv.invoke();
			return ;
		}
		
		String controllerKey = inv.getControllerKey();
		String method = controller.getRequest().getMethod().toUpperCase();
		String urlPara = controller.getPara();
		if ("GET".equals(method)) {
			if (urlPara != null && !"edit".equals(methodName)) {
				controller.setAttr(isRestfulForwardKey, Boolean.TRUE);
				controller.forwardAction(controllerKey + "/show/" + urlPara);
				return ;
			}
		}
		else if ("POST".equals(method)) {
			controller.setAttr(isRestfulForwardKey, Boolean.TRUE);
			controller.forwardAction(controllerKey + "/save");
			return ;
		}
		else if ("PUT".equals(method)) {
			controller.setAttr(isRestfulForwardKey, Boolean.TRUE);
			controller.forwardAction(controllerKey + "/update/" + urlPara);
			return ;
		}
		else if ("DELETE".equals(method)) {
			controller.setAttr(isRestfulForwardKey, Boolean.TRUE);
			controller.forwardAction(controllerKey + "/delete/" + urlPara);
			return ;
		}
		
		inv.invoke();
	}
1112574
@Override
	public void execute(ExecutionContext context){

		final String[] args = context.getArguments();
		
		String clusterValue = getArgumentValue(ARG_CLUSTER_NAME,args,null); 

		if(clusterValue != null){
			// Add all the arguments which need to be validated	
			this.createCollectiveArgumentsValues();
			this.validateArgumentList(args, true);
			
			String serverValues = getArgumentValue(ARG_SERVER_ADDRESS, args, null);
			if(serverValues == null){
				throw new IllegalArgumentException(getMessage(MISSING_VALUE_MSG , 
						"["+ARG_SERVER_ADDRESS + "]"));
			}

			String targetPathValue = getArgumentValue(ARG_OPT_TARGET_PATH, args, null);

			GeneratePluginForCollective collectiveTask = 
					new GeneratePluginForCollective(serverValues, clusterValue ,targetPathValue,commandConsole);
			ParseLoginAddress controllerAddress = null;
			try {
				controllerAddress = collectiveTask.parseCollectiveAddressValue();
			} catch (IllegalArgumentException e) {
				throw e;
			}		
			invokeGeneratePluginCfgMBean(controllerAddress, collectiveTask.getCluster(),targetPathValue,"collective");		
		}
		else{
			// Add all the arguments which need to be validated	
			this.createServerArgumentsValues();
			String serverValues = getArgumentValue(ARG_SERVER_ADDRESS, args, null);
			if(serverValues == null){
				throw new IllegalArgumentException(getMessage(MISSING_VALUE_MSG , 
						"["+ARG_SERVER_ADDRESS + "]" ));
			}

			this.validateArgumentList(args, true);

			String targetPathValue = getArgumentValue(ARG_OPT_TARGET_PATH, args, null);			
			GeneratePluginForServer serverTask = 
					new GeneratePluginForServer(serverValues, targetPathValue, commandConsole);
			ParseLoginAddress serverAddress = null;
			try {
				serverAddress = serverTask.parseServerAddressValue();
			} catch (IllegalArgumentException e) {
				throw e;
			}
			this.invokeGeneratePluginCfgMBean(serverAddress, null, targetPathValue,"server");
		}
		
	
	}
1088856
public boolean execute(Context context)
     throws Exception {
        if(context == null)
            throw new IllegalArgumentException();

        if(!_frozen)
            _frozen = true;

        boolean result = false;
        Exception saveException = null;
        for(int i = 0; i < _commands.length; i++) {
            try {
                result = _commands[i].execute(context);
                if(result)
                    break;
            }
            catch(Exception e) {
                saveException = e;
            }
        }

        if(saveException != null)
            throw saveException;
        else return result;
    }
368613
@Override
    public Message interceptMessage(Message message, String messageType, TestContext context) {
        if (message.getPayload() == null || !StringUtils.hasText(message.getPayload(String.class))) {
            return message;
        }

        String jsonPathExpression = null;
        try {
            JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
            Object jsonData = parser.parse(message.getPayload(String.class));
            DocumentContext documentContext = JsonPath.parse(jsonData);

            for (Map.Entry<String, String> entry : jsonPathExpressions.entrySet()) {
                jsonPathExpression = entry.getKey();
                String valueExpression = context.replaceDynamicContentInString(entry.getValue());

                Object value;
                if (valueExpression.equals("true")) {
                    value = true;
                } else if (valueExpression.equals("false")) {
                    value = false;
                } else {
                    try {
                        value = NumberUtils.parseNumber(valueExpression, Integer.class);
                    } catch (IllegalArgumentException e) {
                        value = valueExpression;
                    }
                }

                try {
                    documentContext.set(jsonPathExpression, value);
                } catch (PathNotFoundException e) {
                    if (!ignoreNotFound) {
                        throw new UnknownElementException(String.format("Could not find element for expression: %s", jsonPathExpression), e);
                    }
                }

                if (log.isDebugEnabled()) {
                    log.debug("Element " + jsonPathExpression + " was set to value: " + valueExpression);
                }
            }

            message.setPayload(jsonData.toString());
        } catch (ParseException e) {
            throw new CitrusRuntimeException("Failed to parse JSON text", e);
        }

        return message;
    }
242117
public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
    {
        preAction( ( ActionInterceptorContext ) context, chain );
    }
919622
@Override
	public Element execute(Context context) {
		Element result = Undef.VALUE;
		for (Operation op : ops) {
			try {
				result = op.execute(context);
			} catch (EvaluationException ee) {
				throw ee.addExceptionInfo(sourceRange, context);
			}
		}
		return result;
	}
626708
public void execute(DelegateExecution execution) {
    boolean isSkipExpressionEnabled = SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpression);
    if (!isSkipExpressionEnabled || (isSkipExpressionEnabled && !SkipExpressionUtil.shouldSkipFlowElement(execution, skipExpression))) {

      if (Context.getProcessEngineConfiguration().isEnableProcessDefinitionInfoCache()) {
        ObjectNode taskElementProperties = Context.getBpmnOverrideElementProperties(serviceTaskId, execution.getProcessDefinitionId());
        if (taskElementProperties != null && taskElementProperties.has(DynamicBpmnConstants.SERVICE_TASK_CLASS_NAME)) {
          String overrideClassName = taskElementProperties.get(DynamicBpmnConstants.SERVICE_TASK_CLASS_NAME).asText();
          if (StringUtils.isNotEmpty(overrideClassName) && !overrideClassName.equals(className)) {
            className = overrideClassName;
            activityBehaviorInstance = null;
          }
        }
      }
      
      if (activityBehaviorInstance == null) {
        activityBehaviorInstance = getActivityBehaviorInstance();
      }

      try {
        activityBehaviorInstance.execute(execution);
      } catch (BpmnError error) {
        ErrorPropagation.propagateError(error, execution);
      } catch (RuntimeException e) {
        if (!ErrorPropagation.mapException(e, (ExecutionEntity) execution, mapExceptions))
          throw e;
      }
    }
  }
1342854
@SuppressWarnings("static-method")
	protected void handleInvocationTargetException(Throwable targetException, Context context) {
		// ignore NullPointerException, as not having to check for NPEs all the time is a convenience feature
		if (!(targetException instanceof NullPointerException)) {
			Exceptions.throwUncheckedException(targetException);
		}
	}
1284030
@Override
    public void doExecute(TestContext context) {
        try {
            Message receivedMessage;
            String selector = MessageSelectorBuilder.build(messageSelector, messageSelectorMap, context);

            //receive message either selected or plain with message receiver
            if (StringUtils.hasText(selector)) {
                receivedMessage = receiveSelected(context, selector);
            } else {
                receivedMessage = receive(context);
            }

            if (receivedMessage == null) {
                throw new CitrusRuntimeException("Failed to receive message - message is not available");
            }

            //validate the message
            validateMessage(receivedMessage, context);
        } catch (IOException e) {
            throw new CitrusRuntimeException(e);
        }
    }
1048479
public Interceptor create(final InterceptorFactoryContext context) {
        final InterceptorFactory[] factories = interceptorFactories;
        final int length = factories.length;
        final Interceptor[] interceptors = new Interceptor[length];
        for (int i = 0; i < length; i++) {
            interceptors[i] = factories[i].create(context);
        }
        return new ChainedInterceptor(interceptors);
    }
222926
public static InterceptionContext forConstructorInterception(InterceptionModel interceptionModel, CreationalContext<?> ctx, BeanManagerImpl manager, SlimAnnotatedType<?> type) {
        return of(interceptionModel, ctx, manager, null, type);
    }
648309
@RuntimeType
    public Object interceptInterface(@AllArguments Object[] params,
                                     @Origin Method method) throws Throwable {
        if (ProxyParent.canInvoke(method)) {
            return Interception.invokeWrap(interception, null, method, null, params,
                () -> ProxyParent.invoke(method, proxyParent));
        } else {
            return Interception.invokeWrap(interception, null, method, null, params, null);
        }
    }
379374
@Override
	public Element execute(Context context) {

		assert (ops.length == 2 || ops.length == 3);

		// Pop the condition from the data stack.
		boolean condition = false;
		try {
			condition = ((BooleanProperty) ops[0].execute(context)).getValue();
		} catch (ClassCastException cce) {
			throw new EvaluationException(MessageUtils
					.format(MSG_INVALID_IF_ELSE_TEST), sourceRange);
		}

		// Choose the correct operation and execute it.
		Operation op = null;
		if (condition) {
			op = ops[1];
		} else if (ops.length > 2) {
			op = ops[2];
		} else {
			op = Undef.VALUE;
		}
		return op.execute(context);
	}
125808
@Override
    public void visitClassContext(ClassContext classContext) {
        localHEDetector.visitClassContext(classContext);
        try {
            hangingFieldCandidates = new HashMap<>();
            exemptExecutors = new HashMap<>();
            parseFieldsForHangingCandidates(classContext);

            if (!hangingFieldCandidates.isEmpty()) {
                stack = new OpcodeStack();
                super.visitClassContext(classContext);

                reportHangingExecutorFieldBugs();
            }
        } finally {
            stack = null;
            hangingFieldCandidates = null;
            exemptExecutors = null;
        }

    }
1058711
protected void configureHandlerInterceptor(ApplicationContext context) {
        if (context.containsBean(ENDPOINT_INTERCEPTOR_BEAN_NAME)) {
            DelegatingEndpointInterceptor endpointInterceptor = context.getBean(ENDPOINT_INTERCEPTOR_BEAN_NAME, DelegatingEndpointInterceptor.class);
            endpointInterceptor.setInterceptors(adaptInterceptors(webServiceServer.getInterceptors()));
        }
    }
955421
protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
		if (this.beanNameGenerator != null) {
			context.getBeanFactory().registerSingleton(
					AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR,
					this.beanNameGenerator);
		}
		if (this.resourceLoader != null) {
			if (context instanceof GenericApplicationContext) {
				((GenericApplicationContext) context)
						.setResourceLoader(this.resourceLoader);
			}
			if (context instanceof DefaultResourceLoader) {
				((DefaultResourceLoader) context)
						.setClassLoader(this.resourceLoader.getClassLoader());
			}
		}
		if (this.addConversionService) {
			context.getBeanFactory().setConversionService(
					ApplicationConversionService.getSharedInstance());
		}
	}