Package org.apache.struts.action

Examples of org.apache.struts.action.ActionError


       
        //if (submit != null) {

            if ((serviceName == null) || (serviceName.length() < 1)) {
                errors.add("serviceName",
                           new ActionError("error.serviceName.required"));
            }
           
            if ((engineName == null) || (engineName.length() < 1)) {
                errors.add("engineName",
                           new ActionError("error.engineName.required"));
            }

        //}
       
        return errors;
View Full Code Here


        //if (submit != null) {
            // validate allow/deny patterns
            if ((allow == null) || (allow.length() < 1)) {
                if ((deny == null) || (deny.length() < 1)) {
                    errors.add("allow",
                    new ActionError("error.allow.deny.required"));
                }
            }               
        //}
       
        try {
            allows = ValveUtil.precalculate(allow);           
        } catch (IllegalArgumentException e) {
            errors.add("allow", new ActionError("error.syntax"));
            return errors;
        }
        
        try {  
            denies = ValveUtil.precalculate(deny);
        } catch (IllegalArgumentException e) {
            errors.add("allow", new ActionError("error.syntax"));
            return errors;
        }
       
        String ip = request.getRemoteAddr();
       
        if (ip == null) {
            return errors;
        }
       
        for (int i = 0; i < denies.length; i++) {
            if (denies[i].matcher(ip).matches()) {
                if (allows.length < 1) {
                    errors.add("deny",
                        new ActionError("error.denyIP"));
                }
                for (int j = 0; j < allows.length; j++) {
                    if (!allows[j].matcher(ip).matches()) {
                        errors.add("deny",
                        new ActionError("error.denyIP"));
                    }
                }
            }   
        }
       
        boolean allowMatch = true;
        if (allows.length > 0) {
            allowMatch = false;
        }
        for (int i = 0; i < allows.length; i++) {
            if (allows[i].matcher(ip).matches()) {
                allowMatch = true;      
            }
        }      
        if (!allowMatch) {
            errors.add("allow", new ActionError("error.allowIP"));
        }
       
        return errors;
    }
View Full Code Here

             // TBD
            // validate allow/deny IPs
            if ((allow == null) || (allow.length() < 1)) {
                if ((deny == null) || (deny.length() < 1)) {
                    errors.add("allow",
                    new ActionError("error.allow.deny.required"));
                }
            }             
        //}
       
        try {
            allows = ValveUtil.precalculate(allow);           
        } catch (IllegalArgumentException e) {
            errors.add("allow", new ActionError("error.syntax"));
            return errors;
        }
        
        try {  
            denies = ValveUtil.precalculate(deny);
        } catch (IllegalArgumentException e) {
            errors.add("allow", new ActionError("error.syntax"));
            return errors;
        }
                
        String host = request.getRemoteHost();
        // check for IP address also in case DNS is not configured
        // to give a host name for the client machine
        String ip = request.getRemoteAddr();
   
        if (host == null) {
            return errors;
        }
       
        for (int i = 0; i < denies.length; i++) {
            if (denies[i].matcher(host).matches()) {
                if (allows.length < 1) {
                    errors.add("deny",
                        new ActionError("error.denyHost"));
                }   
                for (int j = 0; j < allows.length; j++) {
                    if (!allows[j].matcher(host).matches()) {
                        errors.add("deny",
                        new ActionError("error.denyHost"));
                    }
                }
            } else if (denies[i].matcher(ip).matches()) {
                if (allows.length < 1) {
                    errors.add("deny",
                        new ActionError("error.denyHost"));
                }              
                for (int j = 0; j < allows.length; j++) {
                    if (!allows[j].matcher(ip).matches()) {
                        errors.add("deny",
                        new ActionError("error.denyHost"));
                    }
                }
            }
        }
       
        boolean allowMatch = true;
       
        if ((allows != null) && (allows.length > 0)) {
            allowMatch = false;
        }
       
        for (int i = 0; i < allows.length; i++) {
            if (allows[i].matcher(host).matches()) {
                allowMatch = true;      
            }
        }
       
        if (!allowMatch) {
            errors.add("allow", new ActionError("error.allowHost"));
        }       
       
        return errors;
    }
View Full Code Here

                Iterator names = mBServer.queryNames(oname, null).iterator();
                while (names.hasNext()) {      
                    if (mBServer.isRegistered((ObjectName)names.next())) {
                        ActionErrors errors = new ActionErrors();
                        errors.add("serviceName",
                               new ActionError("error.serviceName.exists"));
                        saveErrors(request, errors);
                        return (new ActionForward(mapping.getInput()));
                    }
                }
               
                oname = new ObjectName(engineName + TomcatTreeBuilder.ENGINE_TYPE);
                if (mBServer.isRegistered(oname)) {
                    ActionErrors errors = new ActionErrors();
                    errors.add("serviceName",
                               new ActionError("error.engineName.exists"));
                    saveErrors(request, errors);
                    return (new ActionForward(mapping.getInput()));
                }
               
                // Look up our MBeanFactory MBean
View Full Code Here

                // Ensure that the requested connector name and port is unique
                if (mBServer.isRegistered(oname) ||
                    (!mBServer.queryNames(search, null).isEmpty())) {
                    ActionErrors errors = new ActionErrors();
                    errors.add("connectorName",
                               new ActionError("error.connectorName.exists"));
                    saveErrors(request, errors);
                    return (new ActionForward(mapping.getInput()));
                }

                // Look up our MBeanFactory MBean
View Full Code Here

        //if (submit != null) {

            // groupname is a required field
            if ((groupname == null) || (groupname.length() < 1)) {
                errors.add("groupname",
                           new ActionError("users.error.groupname.required"));
            }

            // Quotes not allowed in groupname
            if ((groupname != null) && (groupname.indexOf('"') >= 0)) {
                errors.add("groupname",
                           new ActionError("users.error.quotes"));
            }

            // Quotes not allowed in description
            if ((description != null) && (description.indexOf('"') > 0)) {
                errors.add("description",
                           new ActionError("users.error.quotes"));
            }

        //}

        return (errors);
View Full Code Here

        //if (submit != null) {

            // rolename is a required field
            if ((rolename == null) || (rolename.length() < 1)) {
                errors.add("rolename",
                           new ActionError("users.error.rolename.required"));
            }

            // Quotes not allowed in rolename
            if ((rolename != null) && (rolename.indexOf('"') >= 0)) {
                errors.add("rolename",
                           new ActionError("users.error.quotes"));
            }

            // Quotes not allowed in description
            if ((description != null) && (description.indexOf('"') > 0)) {
                errors.add("description",
                           new ActionError("users.error.quotes"));
            }

        //}

        return (errors);
View Full Code Here

               
                if (mserver.isRegistered(oname) ||
                                        mserver.isRegistered(encodedOName)) {
                    ActionErrors errors = new ActionErrors();
                    errors.add("jndiName",
                               new ActionError("resources.invalid.name"));
                    saveErrors(request, errors);
                    return (new ActionForward(mapping.getInput()));
                }       
               
                oname = ResourceUtils.getNamingResourceObjectName(domain,
View Full Code Here

        // validate if this alias already exists.
        List aliasVals = aform.getAliasVals();
        if (aliasVals.contains(values[0])) {
           ActionErrors errors = new ActionErrors();
            errors.add("aliasName",
                       new ActionError("error.aliasName.exists"));
            saveErrors(request, errors);
            return (new ActionForward(mapping.getInput()));
        }
       
        try {
View Full Code Here

    public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
        if ((username == null) || (username.length() < 1))
            errors.add("username", new ActionError("error.username.required"));
        if ((password == null) || (password.length() < 1))
            errors.add("password", new ActionError("error.password.required"));

        return errors;

    }
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionError

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.