Package com.opensymphony.xwork2.validator.validators

Examples of com.opensymphony.xwork2.validator.validators.EmailValidator


        @Override
        public boolean contains(Object o) {
          return !ObjectUtils.equals(o, "file");
        }
      };
      ClassFinder finder = new ClassFinder(getClassLoaderInterface(), buildUrls(), false, jarProtocols);
      for (String packageName : actionPackages) {
        Test<ClassFinder.ClassInfo> test = getPackageFinderTest(packageName);
        classes.addAll(finder.findClasses(test));
      }
    } catch (Exception ex) {
      logger.error("Unable to scan named packages", ex);
    }
    return classes;
View Full Code Here


  }

  protected ClassLoaderInterface getClassLoaderInterface() {
    if (isReloadEnabled()) return new ClassLoaderInterfaceDelegate(reloadingClassLoader);
    else {
      ClassLoaderInterface classLoaderInterface = null;
      ActionContext ctx = ActionContext.getContext();
      if (ctx != null) classLoaderInterface = (ClassLoaderInterface) ctx
          .get(ClassLoaderInterface.CLASS_LOADER_INTERFACE);
      return (ClassLoaderInterface) ObjectUtils.defaultIfNull(classLoaderInterface,
          new ClassLoaderInterfaceDelegate(getClassLoader()));
View Full Code Here

  }

  private Set<URL> buildUrls() {
    Set<URL> urls = CollectUtils.newHashSet();
    Enumeration<URL> em;
    ClassLoaderInterface classloader = getClassLoaderInterface();
    try {
      em = classloader.getResources("struts-plugin.xml");
      while (em.hasMoreElements()) {
        URL url = em.nextElement();
        urls.add(new URL(substringBeforeLast(url.toExternalForm(), "struts-plugin.xml")));
      }
      em = classloader.getResources("struts.xml");
      while (em.hasMoreElements()) {
        URL url = em.nextElement();
        urls.add(new URL(substringBeforeLast(url.toExternalForm(), "struts.xml")));
      }
    } catch (IOException e) {
View Full Code Here

    logger.info("Action scan completely,create {} action in {} ms", newActions,
        System.currentTimeMillis() - start);
  }

  protected ClassLoaderInterface getClassLoaderInterface() {
    if (isReloadEnabled()) return new ClassLoaderInterfaceDelegate(reloadingClassLoader);
    else {
      ClassLoaderInterface classLoaderInterface = null;
      ActionContext ctx = ActionContext.getContext();
      if (ctx != null) classLoaderInterface = (ClassLoaderInterface) ctx
          .get(ClassLoaderInterface.CLASS_LOADER_INTERFACE);
      return (ClassLoaderInterface) ObjectUtils.defaultIfNull(classLoaderInterface,
          new ClassLoaderInterfaceDelegate(getClassLoader()));
    }
  }
View Full Code Here

            public String getMyEmail() {
                return email;
            }
        };

        EmailValidator validator = new EmailValidator();
        validator.setValidatorContext(new DelegatingValidatorContext(action));
        validator.setFieldName("myEmail");
        validator.setDefaultMessage("invalid email");
        validator.setValueStack(ActionContext.getContext().getValueStack());
        validator.validate(action);

        return (action.getFieldErrors().size() == 0);
    }
View Full Code Here

            public String getEmailExpression() {
                return expression;
            }
        };

        EmailValidator validator = new EmailValidator();
        ValueStack valueStack = ActionContext.getContext().getValueStack();
        valueStack.push(action);
        validator.setValueStack(valueStack);

        validator.setValidatorContext(new DelegatingValidatorContext(action));
        validator.setFieldName("myEmail");
        validator.setDefaultMessage("invalid email");
        validator.setRegexExpression("${emailExpression}");

        validator.validate(action);

        return (action.getFieldErrors().size() == 0);
    }
View Full Code Here

        return (action.getFieldErrors().size() == 0);
    }

    public void testCaseSensitiveViaExpression() throws Exception {
        EmailValidator validator = verifyCaseSensitive(true);
        assertTrue(validator.isCaseSensitive());

        validator = verifyCaseSensitive(false);
        assertFalse(validator.isCaseSensitive());
    }
View Full Code Here

            public boolean getEmailCaseSensitive() {
                return caseSensitive;
            }
        };

        EmailValidator validator = new EmailValidator();
        ValueStack valueStack = ActionContext.getContext().getValueStack();
        valueStack.push(action);
        validator.setValueStack(valueStack);

        validator.setCaseSensitiveExpression("${emailCaseSensitive}");

        return validator;
    }
View Full Code Here

        return validator;
    }

    public void testTrimViaExpression() throws Exception {
        EmailValidator validator = verifyTrim(true);
        assertTrue(validator.isTrimed());

        validator = verifyTrim(false);
        assertFalse(validator.isTrimed());
    }
View Full Code Here

            public boolean getTrimEmail() {
                return trim;
            }
        };

        EmailValidator validator = new EmailValidator();
        ValueStack valueStack = ActionContext.getContext().getValueStack();
        valueStack.push(action);
        validator.setValueStack(valueStack);

        validator.setTrimExpression("${trimEmail}");

        return validator;
    }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.validator.validators.EmailValidator

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.