Examples of Validators


Examples of org.slim3.controller.validator.Validators

        putEnteringLog();
        try {
            if (checkAdmin()) {
                User tmp = getService().get(uid);
                if (tmp != null && tmp instanceof Administrator) {
                    Validators v = new Validators(request);
                    v.add("name", v.required());
                    v.add("mail", v.required(), v.regexp(VALID_PAT_MAILADDR));
                    if (v.validate()) {
                        getService().put(uid, name, mail);
                        return redirect("/user/");
                    } else {
                        return forward("/user/edit.jsp");
                    }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

        service.insert(blog);
        return redirect(basePath);
    }

    protected boolean validate() {
        Validators v = new Validators(request);
        v.add(meta.title, v.required());
        v.add(meta.content, v.required());
        return v.validate();
    }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

            request));
        return redirect(basePath);
    }

    protected boolean validate() {
        Validators v = new Validators(request);
        v.add(meta.title, v.required());
        v.add(meta.content, v.required());
        return v.validate();
    }
View Full Code Here

Examples of org.slim3.controller.validator.Validators

    /*
     * (non-Javadoc) {@inheritDoc}
     */
    @Override
    public Navigation run() throws Exception {
        Validators v = new Validators(request);
        v.add(
            "startWeek",
            v.required(),
            v.integerType(),
            v.longRange(START_WEEK_MIN, START_WEEK_MAX));
        v.add("keyword", v.maxlength(KEYWORD_MAX_LENGTH));
        if (!v.validate()) {
            response.setStatus(UNAUTHORIZED);
            Errors errors = v.getErrors();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < errors.size(); i++) {
                sb.append(errors.get(i) + "\n");
            }
            response.setContentType("text/plain;charset=UTF-8");
View Full Code Here

Examples of org.slim3.controller.validator.Validators

     */
    @Override
    public Navigation run() throws Exception {
        LOGGER.info("BEGIN: " + this.getClass().getName());

        Validators v = new Validators(request);
        v.add("keys[]", v.required());
        if (!v.validate()) {
            response.setStatus(UNAUTHORIZED);
            if (LOGGER.isLoggable(Level.WARNING)) {
                Errors errors = v.getErrors();
                for (int i = 0; i < errors.size(); i++) {
                    LOGGER.warning(errors.get(i));
                }
            }
        } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.