Package org.apache.cocoon.components.flow

Examples of org.apache.cocoon.components.flow.WebContinuation


    public FOM_WebContinuation makeWebContinuation(Continuation k,
                                                   FOM_WebContinuation parent,
                                                   int timeToLive)
        throws Exception {
        if (k == null) return null;
        WebContinuation wk;
        ContinuationsManager contMgr;
        contMgr = (ContinuationsManager)
            componentManager.lookup(ContinuationsManager.ROLE);
        wk = contMgr.createWebContinuation(unwrap(k),
                                           (parent == null ? null : parent.getWebContinuation()),
View Full Code Here


                        startElement.attributes.getValue(CONTINUATION);
                    int level = 0;
                    if (BACK.equals(cont)) {
                        level = 3;
                    }
                    WebContinuation wk = kont;
                    for (int i = 0; i < level; i++) {
                        wk = wk.getParentContinuation();
                        if (wk == null) {
                            throw new SAXParseException("No such continuation",
                                                        ev.location,
                                                        null);
                        }
                    }
                    String kontId = wk.getId();
                    AttributesImpl newAttrs =
                        new AttributesImpl(startElement.attributes);
                    int i = newAttrs.getIndex(ID);
                    String phase = attrs.getValue(PHASE);
                    if (phase == null) {
View Full Code Here

                    cache.remove(uri);
                }
            }
        }
        Object bean = FlowHelper.getContextObject(objectModel);
        WebContinuation kont = FlowHelper.getWebContinuation(objectModel);
        setContexts(bean, kont,
                    ObjectModelHelper.getRequest(objectModel),
                    ObjectModelHelper.getResponse(objectModel),
                    ObjectModelHelper.getContext(objectModel),
                    parameters,
View Full Code Here

        // Use the current sitemap's service manager for components
        final ServiceManager sitemapManager = (ServiceManager) webAppContext.getBean(AvalonUtils.SERVICE_MANAGER_ROLE);

        AppleController app = instantiateController(className, sitemapManager);

        WebContinuation wk = null;
        if (!(app instanceof StatelessAppleController)) {
            wk = this.continuationsMgr.createWebContinuation(app, null, 0, getInterpreterID(), this);
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Instantiated a stateful apple, continuationid = " + wk.getId());
            }
        }

        DefaultContext appleContext = new DefaultContext(avalonContext);
        if (wk != null) {
            appleContext.put("continuation-id", wk.getId());
        }

        LifecycleHelper.setupComponent(app, getLogger(), appleContext, sitemapManager, null);

        processApple(params, redirector, app, wk);
View Full Code Here

        processApple(params, redirector, app, wk);
    }

    public void handleContinuation(String continuationId, List params, Redirector redirector) throws Exception {
        WebContinuation wk = this.continuationsMgr.lookupWebContinuation(continuationId, getInterpreterID());
        if (wk == null) {
            // Throw an InvalidContinuationException to be handled inside the
            // <map:handle-errors> sitemap element.
            throw new InvalidContinuationException("The continuation ID " + continuationId + " is invalid.");
        }

        AppleController app = (AppleController) wk.getContinuation();

        getLogger().debug("found apple from continuation: " + app);

        // TODO access control checks? exception to be thrown for illegal
        // access?
View Full Code Here


    private void forwardTo(String uri, Object bizData,
                           Continuation continuation)
        throws Exception {
        WebContinuation wk = null;
        if (continuation != null) {
            ContinuationsManager contMgr = (ContinuationsManager)
                componentManager.lookup(ContinuationsManager.ROLE);
            wk = lastContinuation =
                contMgr.createWebContinuation(continuation,
View Full Code Here

    public void handleContinuation(String id, List params,
                                   Environment environment)
        throws Exception
    {
        WebContinuation wk = continuationsMgr.lookupWebContinuation(id);

        if (wk == null) {

            /*
             * Throw an InvalidContinuationException to be handled inside the
             * <map:handle-errors> sitemap element.
             */
            throw new InvalidContinuationException("The continuation ID " + id + " is invalid.");
        }

        Context context = Context.enter();
        context.setOptimizationLevel(OPTIMIZATION_LEVEL);
        context.setGeneratingDebug(true);
        context.setCompileFunctionsWithDynamicScope(true);

        // Obtain the continuation object from it, and setup the
        // FOM_Cocoon object associated in the dynamic scope of the saved
        // continuation with the environment and context objects.
        Continuation k = (Continuation)wk.getContinuation();
        Scriptable kScope = k.getParentScope();
        synchronized (kScope) {
            FOM_Cocoon cocoon = (FOM_Cocoon)kScope.get("cocoon", kScope);
            cocoon.setup(this, environment, manager);
            if (enableDebugger) {
View Full Code Here

                    cache.remove(uri);
                }
            }
        }
        Object bean = FlowHelper.getContextObject(objectModel);
        WebContinuation kont = FlowHelper.getWebContinuation(objectModel);
        setContext(bean, kont,
                   FOM_JavaScriptFlowHelper.getRequest(objectModel),
                   FOM_JavaScriptFlowHelper.getResponse(objectModel),
                   FOM_JavaScriptFlowHelper.getSession(objectModel),
                   FOM_JavaScriptFlowHelper.getContext(objectModel),
View Full Code Here

        // FIXME: Initialize the Velocity context. Use objectModel to pass these
        final Object bean = FlowHelper.getContextObject(objectModel);
        if (bean != null) {

            final WebContinuation kont = FlowHelper.getWebContinuation(objectModel);

            // Hack? I use JXPath to determine the properties of the bean object
            final JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
            DynamicPropertyHandler h = null;
            final PropertyDescriptor[] props;
View Full Code Here

                                                                    attributes);
                    } else if (TAG_SUBMIT.equals(name)) {
                        String continuation = attributes.getValue("continuation");

                        if (continuation!=null) {
                            WebContinuation kont =
        FlowHelper.getWebContinuation(objectModel);

                            if (kont != null) {
                                int level = 0;

                                if (continuation.equals("back")) {
                                    level = 3;
                                }
                                AttributesImpl impl = new AttributesImpl(attributes);
                                int index = impl.getIndex("id");
                                String id = impl.getValue(index);
                                String kId = kont.getContinuation(level).getId();

                                id = kId+":"+id;
                                if (index>=0) {
                                    impl.setValue(index, id);
                                } else {
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.flow.WebContinuation

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.