Package org.apache.cocoon.webapps.session

Examples of org.apache.cocoon.webapps.session.ContextManager


            } else {
                authenticationFragment.appendChild(doc.importNode(data, true));
            }
           
            // now set this information in the temporary context
            ContextManager sessionManager = null;
            try {
                sessionManager = (ContextManager) this.manager.lookup( ContextManager.ROLE );
                SessionContext temp = sessionManager.getContext( SessionConstants.TEMPORARY_CONTEXT );
                temp.appendXML("/", authenticationFragment);
            } catch ( ServiceException se ) {
                throw new ProcessingException("Unable to lookup session manager.", se);
            } finally {
                this.manager.release( (Component)sessionManager );
View Full Code Here


    /**
     * Get the context
     */
    private SessionContext getContext(String name)
    throws ProcessingException {
        ContextManager contextManager = null;
        try {
            contextManager = (ContextManager) this.manager.lookup(ContextManager.ROLE);
            return contextManager.getContext( name );
        } catch (ServiceException ce ) {
            throw new ProcessingException("Unable to lookup context manager.", ce);
        } finally {
            this.manager.release(contextManager);
        }
View Full Code Here

                handler = new UserHandler(config, authContext);
                // store the authentication data in the context
                authContext.init(result.result);
            } else if ( result != null ) {
                // now set the failure information in the temporary context
                ContextManager contextManager = null;
                try {
                    contextManager = (ContextManager) this.manager.lookup( ContextManager.ROLE );
                    SessionContext temp = contextManager.getContext( SessionConstants.TEMPORARY_CONTEXT );
                   
                    final DocumentFragment fragment = result.result.createDocumentFragment();
                    final Node root = result.result.getDocumentElement();
                    root.normalize();
                    Node child;
View Full Code Here

                // we really ignore any exception!
            }
           
            List applicationContexts = handler.getApplicationContexts();
            if ( applicationContexts != null ) {
                ContextManager contextManager = null;

                try {
                    contextManager = (ContextManager)this.manager.lookup(ContextManager.ROLE);

                    Iterator i = applicationContexts.iterator();
                    while ( i.hasNext() ) {
                        final String current = (String)i.next();
                        contextManager.deleteContext( current );
                    }
                } catch (ServiceException ce) {
                    throw new ProcessingException("Unable to create session context.", ce);
                } finally {
                    this.manager.release( contextManager);
View Full Code Here

        UserHandler handler = state.getHandler();
       
        SessionContext context = null;

        if ( handler != null ) {
            ContextManager contextManager = null;
            try {
                contextManager = (ContextManager)this.manager.lookup(ContextManager.ROLE);
                // create new context
                context = contextManager.createContext(name, loadURI, saveURI);
                handler.addApplicationContext( name );

            } catch (ServiceException ce) {
                throw new ProcessingException("Unable to create session context.", ce);
            } catch (IOException ioe) {
View Full Code Here

        this.authenticator = new Authenticator();
        this.authenticator.enableLogging( this.getLogger() );
        this.authenticator.service( this.manager );
        this.resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
       
        ContextManager contextManager;
       
        contextManager = (ContextManager) this.manager.lookup(ContextManager.ROLE);
        // add the provider for the authentication context
        try {
            AuthenticationContextProvider contextProvider = new AuthenticationContextProvider();
            contextManager.addSessionContextProvider(contextProvider, AuthenticationConstants.SESSION_CONTEXT_NAME);
        } catch (ProcessingException local) {
            throw new ServiceException("Unable to register provider for authentication context.", local);
        }
  }
View Full Code Here

    throws ProcessingException {

        SessionContext context = null;

        ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
        ContextManager contextManager = null;
        try {
            contextManager = (ContextManager)manager.lookup(ContextManager.ROLE);
            // create new context
            context = contextManager.createContext(name, loadURI, saveURI);
            if ( this.applicationContexts == null) {
                this.applicationContexts = new ArrayList(3);
            }
            this.applicationContexts.add( name );
View Full Code Here

    public void terminate()
    throws ProcessingException {
        ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();

        if ( this.applicationContexts != null ) {
            ContextManager contextManager = null;

            try {
                contextManager = (ContextManager)manager.lookup(ContextManager.ROLE);

                Iterator i = this.applicationContexts.iterator();
                while ( i.hasNext() ) {
                    final String current = (String)i.next();
                    contextManager.deleteContext( current );
                }
            } catch (ComponentException ce) {
                throw new ProcessingException("Unable to create session context.", ce);
            } finally {
                manager.release( (Component)contextManager);
View Full Code Here

            } else {
                authenticationFragment.appendChild(doc.importNode(data, true));
            }
           
            // now set this information in the temporary context
            ContextManager sessionManager = null;
            try {
                sessionManager = (ContextManager) this.manager.lookup( ContextManager.ROLE );
                SessionContext temp = sessionManager.getContext( SessionConstants.TEMPORARY_CONTEXT );
                temp.appendXML("/", authenticationFragment);
            } catch ( ServiceException se ) {
                throw new ProcessingException("Unable to lookup session manager.", se);
            } finally {
                this.manager.release( (Component)sessionManager );
View Full Code Here

     * Composable
     */
    public void compose(ComponentManager manager)
    throws ComponentException {
        super.compose( manager );
        ContextManager contextManager = (ContextManager)manager.lookup(ContextManager.ROLE);
        // add the provider for the portal context
        SessionContextProvider provider = new SessionContextProviderImpl();
        try {
            contextManager.addSessionContextProvider(provider, PortalConstants.SESSION_CONTEXT_NAME);
        } catch (ProcessingException pe) {
            // ignore this!
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.webapps.session.ContextManager

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.