Examples of JCSAdminBean


Examples of org.apache.jcs.admin.JCSAdminBean

     *
     */
    protected Template handleRequest( HttpServletRequest request, HttpServletResponse response, Context context )
        throws Exception
    {
        JCSAdminBean admin = new JCSAdminBean();

        String templateName = DEFAULT_TEMPLATE_NAME;

        // Get cacheName for actions from request (might be null)

        String cacheName = request.getParameter( CACHE_NAME_PARAM );

        // If an action was provided, handle it

        String action = request.getParameter( ACTION_PARAM );

        if ( action != null )
        {
            if ( action.equals( CLEAR_ALL_REGIONS_ACTION ) )
            {
                admin.clearAllRegions();
            }
            else if ( action.equals( CLEAR_REGION_ACTION ) )
            {
                if ( cacheName != null )
                {
                    admin.clearRegion( cacheName );
                }
            }
            else if ( action.equals( REMOVE_ACTION ) )
            {
                String[] keys = request.getParameterValues( KEY_PARAM );

                for ( int i = 0; i < keys.length; i++ )
                {
                    admin.removeItem( cacheName, keys[i] );
                }

                templateName = REGION_DETAIL_TEMPLATE_NAME;
            }
            else if ( action.equals( DETAIL_ACTION ) )
            {
                templateName = REGION_DETAIL_TEMPLATE_NAME;
            }
        }

        if ( request.getParameter( SILENT_PARAM ) != null )
        {
            // If silent parameter was passed, no output should be produced.

            return null;
        }
        // Populate the context based on the template

        if ( templateName == REGION_DETAIL_TEMPLATE_NAME )
        {
            context.put( "cacheName", cacheName );
            context.put( "elementInfoRecords", admin.buildElementInfo( cacheName ) );
        }
        else if ( templateName == DEFAULT_TEMPLATE_NAME )
        {
            context.put( "cacheInfoRecords", admin.buildCacheInfo() );
        }

        return getTemplate( templateName );
    }
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.