Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.ActionProxyFactory


        try {
            ActionMapper actionMapper = du.getContainer().getInstance(ActionMapper.class);
            ActionMapping mapping = actionMapper.getMappingFromActionName(action);
            ActionInvocation inv = new ValidatorActionInvocation(ctx, true);
            ActionProxyFactory actionProxyFactory = du.getContainer().getInstance(ActionProxyFactory.class);
            ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, mapping.getName(), mapping.getMethod(), true, true);
            proxy.execute();
            Object a = proxy.getAction();

            if (a instanceof ValidationAware) {
                ValidationAware aware = (ValidationAware) a;
View Full Code Here


                req,
                res,
                servletContext);

        try {
            ActionProxyFactory actionProxyFactory = du.getContainer().getInstance(ActionProxyFactory.class);
            ActionProxy proxy = actionProxyFactory.createActionProxy(namespace, actionName, null, ctx, true, true);
            proxy.execute();
            Object action = proxy.getAction();

            if (action instanceof ValidationAware) {
                ValidationAware aware = (ValidationAware) action;
View Full Code Here

public class SpecialWidgetWardenInterceptor extends AbstractInterceptor {
 
  @Override
  public String intercept(ActionInvocation invocation) throws Exception {
    FrontPageConfigAction action = (FrontPageConfigAction) invocation.getAction();
    ActionProxyFactory proxyFactory = (ActionProxyFactory) invocation.getInvocationContext().getContainer().getInstance(ActionProxyFactory.class);
    try {
      proxyFactory.createActionProxy("/do/jpfrontshortcut/Page/SpecialWidget", action.getShowletAction(), null, new HashMap());
    } catch (Throwable t) {
      ApsSystemUtils.getLogger().error("There is no Action mapped for namespace /do/jpfrontshortcut/Page/SpecialWidget and action name " + action.getShowletAction() + ".");
      return "configSimpleParameter";
    }
    return invocation.invoke();
View Full Code Here

                application,
                req,
                res);

        try {
            ActionProxyFactory actionProxyFactory = du.getContainer().getInstance(ActionProxyFactory.class);
            ActionProxy proxy = actionProxyFactory.createActionProxy(namespace, actionName, null, ctx, true, true);
            proxy.execute();
            Object action = proxy.getAction();

            if (action instanceof ValidationAware) {
                ValidationAware aware = (ValidationAware) action;
View Full Code Here

      String[] tokens = list.split(",");
      for (String token : tokens) {
        String[] kvp = token.split("=");
        String key = kvp[0];
        String name = kvp[1];
        ActionProxyFactory factory = container.getInstance(
            ActionProxyFactory.class, name);
        if (factory != null) {
          _prefixedActionProxyFactories.add(new Prefixed<ActionProxyFactory>(
              key, factory));
        } else {
View Full Code Here

    for (Prefixed<ActionProxyFactory> prefixedActionMapper : _prefixedActionProxyFactories) {

      String prefix = prefixedActionMapper.getPrefix();
      if (namespace.startsWith(prefix)) {
        ActionProxyFactory actionProxyFactory = prefixedActionMapper.getValue();
        return actionProxyFactory.createActionProxy(namespace, actionName,
            methodName, extraContext, executeResult, cleanupContext);
      }
    }

    throw new IllegalArgumentException("no ActionProxyFactory for namespace: "
View Full Code Here

    for (Prefixed<ActionProxyFactory> prefixedActionMapper : _prefixedActionProxyFactories) {

      String prefix = prefixedActionMapper.getPrefix();
      if (namespace.startsWith(prefix)) {
        ActionProxyFactory actionProxyFactory = prefixedActionMapper.getValue();
        return actionProxyFactory.createActionProxy(inv, namespace, actionName,
            methodName, executeResult, cleanupContext);
      }
    }

    throw new IllegalArgumentException("no ActionProxyFactory for namespace: "
View Full Code Here

   
    if (!(action instanceof ActionSupport)) {
      log.warn("Full Hibernate Plugin Validation Allowed only in Actions that 'ISA' ActionSupport");
      return invocation.invoke();
    }
    ActionSupport actionAs = (ActionSupport) action;
    log.debug("Full Hibernate Plugin Validation in "+actionAs.getClass());
   
    Locale clientLocale = actionAs.getLocale();
   
//    List<InvalidValue> invalidValuesFromRequest = new ArrayList<InvalidValue>();
   
    Collection invalidValuesFromRequest = validator.validate(actionAs, clientLocale,getClass().getClassLoader());
    /*
    ResourceBundle clientResourceBundle = ResourceBundle.getBundle("org.hibernate.validator.resources.DefaultValidatorMessages", clientLocale, this.getClass().getClassLoader());
    InputStream stream = getClass().getResourceAsStream("/ValidatorMessages.properties");
    ClassValidator actionValidator = null;
    if (stream!=null) {
      PluginValidatorMessages validatorMessages = new PluginValidatorMessages(stream);
      validatorMessages.setParent(clientResourceBundle);
      actionValidator = new ClassValidator(action.getClass(),validatorMessages);
    } else {
      actionValidator = new ClassValidator(action.getClass(),clientResourceBundle);
    }
   
    // take all errors but discard when the field do not came from the request
    // Only the first validation error by field is used.
    InvalidValue[] invalidValues = actionValidator.getInvalidValues(action);
    List<String> invalidFieldNames = new ArrayList<String>();
    Map parameters = ActionContext.getContext().getParameters();
    for (InvalidValue invalidValue : invalidValues) {
      String fieldFullName = invalidValue.getPropertyPath();
      if (invalidFieldNames.contains(fieldFullName))
        continue;
      if (parameters.containsKey(fieldFullName)) {
        invalidValuesFromRequest.add(invalidValue);
        invalidFieldNames.add(fieldFullName);
      }
    }
    invalidValues=null;
    invalidFieldNames.clear();
    invalidFieldNames=null;
    actionValidator=null;
    */
    if (invalidValuesFromRequest.isEmpty()) {
      log.debug("Full Hibernate Plugin Validation found no erros.");
      actionAs.validate();
      if (actionAs.hasActionErrors() || actionAs.hasFieldErrors()) {
        log.debug("Full Hibernate Plugin found custom validation errors: "+actionAs.getFieldErrors()+" "+actionAs.getActionErrors());
        return actionAs.input();
      }
      else {
        return invocation.invoke();
      }
    } else {
      validator.addFieldErrors(actionAs, invalidValuesFromRequest);
      /*for (InvalidValue invalidValue : invalidValuesFromRequest) {
        StringBuilder sbMessage = new StringBuilder(actionAs.getText(invalidValue.getPropertyPath(),""));
        if (sbMessage.length()>0)
          sbMessage.append(" - ");
        sbMessage.append(actionAs.getText(invalidValue.getMessage()));
        actionAs.addFieldError(invalidValue.getPropertyPath(), sbMessage.toString());
      }*/
      log.debug("Full Hibernate Plugin Validation found "+actionAs.getFieldErrors().size()+" validation Errors.");
      actionAs.validate();
      if (action instanceof Preparable) {
        Method methodPrepare = Preparable.class.getDeclaredMethod("prepare");
        methodPrepare.invoke(action);
      }
      return actionAs.input();
    }

  }
View Full Code Here

    Locale result = null;
    OgnlValueStack stack = (OgnlValueStack) ActionContext.getContext().getValueStack();

    for (Object o : stack.getRoot()) {
      if (o instanceof LocaleProvider) {
        LocaleProvider lp = (LocaleProvider) o;
        result = lp.getLocale();
        break;
      }
    }

    // Falling back to the request locale
View Full Code Here

  public void test21() {
    ActionBuilder actionNameBuilder = new DefaultActionBuilder();
    ProfileService profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);

    ObjectFactory of = new ObjectFactory();
    final DummyContainer mockContainer = new DummyContainer();
    Configuration configuration = new DefaultConfiguration() {
      @Override
      public Container getContainer() {
        return mockContainer;
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.ActionProxyFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.