Package com.volantis.mcs.protocols.forms

Examples of com.volantis.mcs.protocols.forms.SessionFormData


        Link link = new Link(fragmentName, URLConstants.NEXT_FORM_FRAGMENT, styles);
        link.setFormFragment(formFragmentInstance);

        protocol.doFormLink(dom, attributes, link);

        SessionFormData retrievedFormData =
                formDataManager.getSessionFormData(formSpecifier);
        assertEquals("Unexpected FormFragmentData in the SessionContext " +
                fragmentName + " field.", testURL,
                retrievedFormData.getFieldValue(URLConstants.NEXT_FORM_FRAGMENT));
    }
View Full Code Here


        // Determine which URL to go to from which submission
        // button was pressed to get here
        String targetURL = null;

        SessionFormData formData = pageContext.getFormDataManager().
                getSessionFormData(formSpecifier);

        if (request.getParameter(URLConstants.NEXT_FORM_FRAGMENT) != null) {
            targetURL = formData.getFieldValue(URLConstants.NEXT_FORM_FRAGMENT);
        } else if (request.getParameter(URLConstants.PREV_FORM_FRAGMENT) !=
                null) {
            targetURL = formData.getFieldValue(URLConstants.PREV_FORM_FRAGMENT);
        } else if (request.getParameter(URLConstants.RESET_FORM_FRAGMENT) !=
                null) {
            targetURL = formData.getFieldValue(URLConstants.RESET_FORM_FRAGMENT);
        } else {
            targetURL = formData.getFieldValue(URLConstants.ACTION_FORM_FRAGMENT);
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Target URL is " + targetURL);
        }

        if (targetURL == null) {
            requestContext.release();
            throw new ServletException("No target URL for dispatch.");
        }

        // Strip the context path from the front of the target URL if it is
        // there
        targetURL = removeContextPath(targetURL, request);

        // Strip the session id from the URL if there is one
        targetURL = removeSession(targetURL);


        // Make sure the target URL starts with a / (required by dispatcher).
        if (!targetURL.startsWith("/")) {
            targetURL = "/" + targetURL;
        }

        // Add the passed form parameters into the session
        en = request.getParameterNames();

        while (en.hasMoreElements()) {
            String pName = (String) en.nextElement();
            if (!(pName.equals(URLConstants.FORM_PARAMETER)) &&
                    !(pName.equals(URLConstants.NEXT_FORM_FRAGMENT)) &&
                    !(pName.equals(URLConstants.PREV_FORM_FRAGMENT)) &&
                    !(pName.equals(URLConstants.ACTION_FORM_FRAGMENT)) &&
                    !(pName.equals(URLConstants.
                                   FORM_FRAGMENTATION_PARAMETER)) &&
                    !(pName.equals(URLConstants.RESET_FORM_FRAGMENT))) {
                String pValue = (String) request.getParameter(pName);

                if (logger.isDebugEnabled()) {
                    logger.debug("Writing attribute " + pName + "=" +
                                 pValue + " to the session context.");
                }

                formData.setFieldValue(pName, pValue);
            }
        }

        // Forward to the appropriate destination
        if (logger.isDebugEnabled()) {
View Full Code Here

            HttpServletResponse response) throws ServletException, IOException {

        MarinerURL marinerTargetURL = new MarinerURL(targetURL);
        String formSpecifier = (String)request.getParameter("vform");
        String formName = (String)request.getParameter("vformname");
        SessionFormData formData =
                getFormDataManager(request).getSessionFormData(formSpecifier);

        // If the form's action is to go to the Remap servlet, add the form
        // fields to the request parameters.  
        if (marinerTargetURL.getExternalForm().endsWith("MarinerATGRemap")) {
View Full Code Here

    // Javadoc inherited.
    public EmulatedXFormDescriptor getEmulatedXFormDescriptor(
            String containingFormName) {
        // Get any form data stored in the session for this form.
        SessionFormData sessionFormData = getFormDataManager().
                getSessionFormDataByName(containingFormName);

        EmulatedXFormDescriptor xfd = null;
        if (sessionFormData != null) {
            FormDescriptor fd = sessionFormData.getFormDescriptor();
            if (fd instanceof EmulatedXFormDescriptor) {
                xfd = (EmulatedXFormDescriptor)fd;
            } else {
                throw new IllegalArgumentException("XDIME2 form descriptors " +
                        "must be EmulatedXFormDescriptor instances");
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("URL after Rewriting is " + absoluteLink);
        }

        final FormDescriptor fd = attributes.getFormDescriptor();
        SessionFormData formData = context.getFormDataManager().getSessionFormData(fd);
        final String linkName = link.getLinkName();
        formData.setFieldValue(linkName, absoluteLink);

        if (logger.isDebugEnabled()) {
            logger.debug("Setting field " + linkName + "=" + absoluteLink +
                    " for form name=" + formName);
        }
View Full Code Here

        }
       
        // Set the field value in the session
        FormDataManager dataManager = context.getFormDataManager();
        if (dataManager != null) {
            SessionFormData sessionData = dataManager.getSessionFormData(formSpecifier);
            sessionData.setFieldValue(URLConstants.ACTION_FORM_FRAGMENT,
                    transformedLink);
        }
    }
View Full Code Here

            XFFormAttributes formAttributes = attributes.getFormAttributes();
            if (formAttributes != null) {
                // Retrieve the form data from the session context.
                String formSpecifier = getFormSpecifier(formAttributes);
                SessionFormData sessionData =
                        context.getFormDataManager().getSessionFormData(formSpecifier);
                initialValue = sessionData.getFieldValue(attributes.getName());
            }
        }

        if (initialValue == null) {
            initialValue = getPlainText(attributes.getInitial());
View Full Code Here

                    return;
                }

                // Get the current values stored in the session.
                String formSpecifier = getFormSpecifier(formAttributes);
                SessionFormData sessionData =
                        context.getFormDataManager().getSessionFormData(formSpecifier);
                MarinerURL url = sessionData.getAsMarinerURL();
                String[] initialValues;
                if (url == null) {
                    initialValues = null;
                } else {
                    initialValues = url.getParameterValues(attributes.getName());
View Full Code Here

            // Store the form data in the XFFormAttributes.
            xfFormAttributes.setFormData(model.getFormData());

            // Get the form data from the session context. The act of
            // retrieving it causes it to be created if it isn't already there.
            SessionFormData formData = formDataManager.getSessionFormData(fd);
            // The fd in the session is built up over requests for subsequent
            // fragments, so add the fields found in this request to it.
            formData.addFieldDescriptors(fd.getFields());

            // Set the form specifier (which identifies the form in the
            // session) on the form descriptor and form attributes.
            String formSpecifier = formData.getFormSpecifier();
            xfFormAttributes.setFormSpecifier(formSpecifier);
            // Store everything else in the form descriptor and store it.
            fd.setFormSpecifier(formSpecifier);
            fd.setFormAttributes(xfFormAttributes);
        }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.forms.SessionFormData

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.