Examples of ParameterParser


Examples of org.apache.turbine.util.parser.ParameterParser

    {
        // Name of the button.
        String theButton = null;

        // ParameterParser.
        ParameterParser pp = data.getParameters();

        String button = pp.convert(BUTTON);
        String key = null;

        // Loop through and find the button.
        for (Iterator it = pp.keySet().iterator(); it.hasNext();)
        {
            key = (String) it.next();
            if (key.startsWith(button))
            {
                if (considerKey(key, pp))
                {
                    theButton = formatString(key);
                    break;
                }
            }
        }

        if (theButton == null)
        {
            throw new NoSuchMethodException(
                    "ActionEvent: The button was null");
        }

        try
        {
            Method method = getClass().getMethod(theButton, methodParams);
            Object[] methodArgs = new Object[] { data, context };

            if (log.isDebugEnabled())
            {
                log.debug("Invoking " + method);
            }

            method.invoke(this, methodArgs);
        }
        catch (NoSuchMethodException nsme)
        {
            // Attempt to execute things the old way..
            if (log.isDebugEnabled())
            {
                log.debug("Couldn't locate the Event ( " + theButton
                        + "), running executeEvents() in "
                        + super.getClass().getName());
            }

            super.executeEvents(data);
        }
        catch (InvocationTargetException ite)
        {
            Throwable t = ite.getTargetException();
            if (t instanceof Exception)
            {
                throw (Exception) t;
            }
            else
            {
                throw ite;
            }
        }
        finally
        {
            pp.remove(key);
        }
    }
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

     *
     * @return the valid flag
     */
    protected boolean validate()
    {
        ParameterParser pp = (ParameterParser) super.parser;
        if (isMultiValued)
        {
            FileItem[] ss = pp.getFileItems(getKey());
            // this definition of not set might need refined.  But
            // not sure the situation will arise.
            if (ss.length == 0)
            {
                setFlag = false;
            }

            if (validator != null)
            {
                for (int i = 0; i < ss.length; i++)
                {
                    try
                    {
                        ((FileValidator) validator).assertValidity(ss[i]);
                    }
                    catch (ValidationException ve)
                    {
                        setMessage(ve.getMessage());
                    }
                }
            }

            if (setFlag && validFlag)
            {
                doSetValue();
            }
        }
        else
        {
            FileItem s = pp.getFileItem(getKey());
            if (s == null || s.getSize() == 0)
            {
                setFlag = false;
            }

View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

    /**
     * Sets the value of the field from data in the parser.
     */
    protected void doSetValue()
    {
        ParameterParser pp = (ParameterParser) super.parser;
        if (isMultiValued)
        {
            setTestValue(pp.getFileItems(getKey()));
        }
        else
        {
            setTestValue(pp.getFileItem(getKey()));
        }
    }
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

                .append(" within the screen.")
                .append("<p>")
                .append("Please click ");

        message.addElement(sb.toString());
        ParameterParser pp;
        pp = (ParameterParser) data.getUser().getTemp("prev_parameters");
        pp.remove("_session_access_counter");

        TurbineURI back = new TurbineURI(data,(String) data.getUser().getTemp("prev_screen"));
        back.addPathInfo(pp);
        message.addElement(new A().setHref(back.getRelativeLink()).addElement("here"));
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

    {
        // Name of the button.
        String theButton = null;

        // ParameterParser.
        ParameterParser pp = data.getParameters();

        String button = pp.convert(BUTTON);
        String key = null;

        // Loop through and find the button.
        for (Iterator it = pp.keySet().iterator(); it.hasNext();)
        {
            key = (String) it.next();
            if (key.startsWith(button))
            {
                if (considerKey(key, pp))
                {
                    theButton = formatString(key);
                    break;
                }
            }
        }

        if (theButton == null)
        {
            throw new NoSuchMethodException(
                    "ActionEvent: The button was null");
        }

        Method method = null;
        try
        {
            method = getClass().getMethod(theButton, methodParams);
            Object[] methodArgs = new Object[] { data, context };

            if (log.isDebugEnabled())
            {
                log.debug("Invoking " + method);
            }

            method.invoke(this, methodArgs);
        }
        catch (NoSuchMethodException nsme)
        {
            // Attempt to execute things the old way..
            if (log.isDebugEnabled())
            {
                log.debug("Couldn't locate the Event ( " + theButton
                        + "), running executeEvents() in "
                        + super.getClass().getName());
            }

            super.executeEvents(data);
        }
        catch (InvocationTargetException ite)
        {
            Throwable t = ite.getTargetException();
            log.error("Invokation of " + method , t);
        }
        finally
        {
            pp.remove(key);
        }
    }
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

     *
     * @return the valid flag
     */
    protected boolean validate()
    {
        ParameterParser pp = (ParameterParser) super.parser;
        if (isMultiValued)
        {
            FileItem[] ss = pp.getFileItems(getKey());
            // this definition of not set might need refined.  But
            // not sure the situation will arise.
            if (ss.length == 0)
            {
                setFlag = false;
            }

            if (validator != null)
            {
                for (int i = 0; i < ss.length; i++)
                {
                    try
                    {
                        ((FileValidator) validator).assertValidity(ss[i]);
                    }
                    catch (ValidationException ve)
                    {
                        setMessage(ve.getMessage());
                    }
                }
            }

            if (setFlag && validFlag)
            {
                doSetValue();
            }
        }
        else
        {
            FileItem s = pp.getFileItem(getKey());
            if (s == null || s.getSize() == 0)
            {
                setFlag = false;
            }

View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

    /**
     * Sets the value of the field from data in the parser.
     */
    protected void doSetValue()
    {
        ParameterParser pp = (ParameterParser) super.parser;
        if (isMultiValued)
        {
            setTestValue(pp.getFileItems(getKey()));
        }
        else
        {
            setTestValue(pp.getFileItem(getKey()));
        }
    }
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

                .append(" within the screen.")
                .append("<p>")
                .append("Please click ");

        message.addElement(sb.toString());
        ParameterParser pp;
        pp = (ParameterParser) data.getUser().getTemp("prev_parameters");
        pp.remove("_session_access_counter");

        TurbineURI back = new TurbineURI(data,(String) data.getUser().getTemp("prev_screen"));
        back.addPathInfo(pp);
        message.addElement(new A().setHref(back.getRelativeLink()).addElement("here"));
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

            throws Exception
    {
        // Name of the button.
        String theButton = null;
        // Parameter parser.
        ParameterParser pp = data.getParameters();

        String button = pp.convert(BUTTON);
        String key = null;

        // Loop through and find the button.
        for (Iterator it = pp.keySet().iterator(); it.hasNext();)
        {
            key = (String) it.next();
            if (key.startsWith(button))
            {
                if (considerKey(key, pp))
                {
                    theButton = formatString(key);
                    break;
                }
            }
        }

        if (theButton == null)
        {
            throw new NoSuchMethodException("ActionEvent: The button was null");
        }

        Method method = null;

        try
        {
            method = getClass().getMethod(theButton, methodParams);
            Object[] methodArgs = new Object[] { data };

            if (log.isDebugEnabled())
            {
                log.debug("Invoking " + method);
            }

            method.invoke(this, methodArgs);
        }
        catch (InvocationTargetException ite)
        {
            Throwable t = ite.getTargetException();
            log.error("Invokation of " + method , t);
        }
        finally
        {
            pp.remove(key);
        }
    }
View Full Code Here

Examples of org.apache.turbine.util.parser.ParameterParser

        TurbineRunData data;
        try
        {
            data = (TurbineRunData) pool.getInstance(cfg[0]);
           
            ParameterParser pp = (ParameterParser) pool.getInstance(cfg[1]);
            data.setParameterParser(pp);
           
            CookieParser cp = (CookieParser) pool.getInstance(cfg[2]);
            data.setCookieParser(cp);
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.