Examples of StorageHandler


Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

     * @param resolver the ActionResolver to set as the current one in the user session.
     */
    public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request,
                                                 ServletContext servletContext )
    {
        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
        String currentLongLivedJpfAttrName =
                ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );

        if ( resolver == null )
        {
            sh.removeAttribute( rc, currentJpfAttrName );
            sh.removeAttribute( rc, currentLongLivedJpfAttrName );
            return;
        }

        //
        // If this is a long-lived page flow, also store the instance in an attribute that never goes away.
        //
        if ( resolver.isPageFlow() && isLongLived( ( ( PageFlowController ) resolver ).getModuleConfig() ) )
        {
            String longLivedAttrName = getLongLivedFlowAttr( resolver.getModulePath() );
            longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest );

            // Only set this attribute if it's not already there.  We want to avoid our onDestroy() callback that's
            // invoked when the page flow's session attribute is unbound.
            if ( sh.getAttribute( rc, longLivedAttrName ) != resolver )
            {
                sh.setAttribute( rc, longLivedAttrName, resolver );
            }

            sh.setAttribute( rc, currentLongLivedJpfAttrName, resolver.getModulePath() );
            sh.removeAttribute( rc, currentJpfAttrName );
        }
        else
        {
            sh.setAttribute( rc, currentJpfAttrName, resolver );
            sh.removeAttribute( rc, currentLongLivedJpfAttrName );
        }
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

    public static FacesBackingBean getFacesBackingBean( ServletRequest request, ServletContext servletContext )
    {
        if ( request instanceof HttpServletRequest )
        {
            StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
            HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( ( HttpServletRequest ) request );
            RequestContext rc = new RequestContext( unwrappedRequest, null );
            String attrName = ScopedServletUtils.getScopedSessionAttrName( FACES_BACKING_ATTR, unwrappedRequest );
            return ( FacesBackingBean ) sh.getAttribute( rc, attrName );
        }

        return null;
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

        // instance if it's being removed.  Also, if the session is null (after having been invalidated
        // by the user), don't recreate it.
        //
        if ( request.getAttribute( REMOVING_PAGEFLOW_ATTR ) != this && request.getSession( false ) != null )
        {
            StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
            HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
            RequestContext rc = new RequestContext( unwrappedRequest, null );
       
            //
            // If this is a long-lived page flow, there are two attributes to deal with.
            //
            if ( isLongLived() )
            {
                String longLivedAttrName = InternalUtils.getLongLivedFlowAttr( getModulePath() );
                longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest );
                String currentLongLivedAttrName =
                    ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
                sh.ensureFailover( rc, longLivedAttrName, this );
                sh.ensureFailover( rc, currentLongLivedAttrName, getModulePath() );
            }
            else
            {
                String attrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
                sh.ensureFailover( rc, attrName, this );
            }
        }
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

     * @param servletContext the current ServletContext.
     * @return a {@link PageFlowStack} of nested page flows ({@link PageFlowController}s) for the current user session.
     */   
    public static PageFlowStack get( HttpServletRequest request, ServletContext servletContext, boolean createIfNotExist )
    {
        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
        PageFlowStack jpfStack = ( PageFlowStack ) sh.getAttribute( rc, attrName );
       
        if ( jpfStack == null && createIfNotExist )
        {
            jpfStack = new PageFlowStack( servletContext );
            jpfStack.save( request );
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

     *
     * @param request the current HttpServletRequest.
     */
    public void destroy( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
       
        sh.removeAttribute( rc, attrName );
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

        return -1;
    }
   
    void ensureFailover( HttpServletRequest request, ServletContext servletContext )
    {
        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
       
        sh.ensureFailover( rc, attrName, this );
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

        sh.ensureFailover( rc, attrName, this );
    }
   
    void save( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
       
        sh.setAttribute( rc, attrName, this );
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

     * Store this object in the user session, in the appropriate place.  Used by the framework; normally should not be
     * called directly.
     */
    public void persistInSession( HttpServletRequest request, HttpServletResponse response )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName =
                ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
       
        sh.setAttribute( rc, attrName, this );
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

    /**
     * Remove this instance from the session.
     */
    protected void removeFromSession( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName =
                ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
       
        sh.removeAttribute( rc, attrName );
    }
View Full Code Here

Examples of org.apache.beehive.netui.pageflow.handler.StorageHandler

     *
     * @param request the current HttpServletRequest
     */
    public void ensureFailover( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attr =
                ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
        sh.ensureFailover( rc, attr, this );
    }
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.