Package com.opensymphony.webwork.dispatcher.mapper

Examples of com.opensymphony.webwork.dispatcher.mapper.ActionMapping


     *
     */
    @SuppressWarnings("unchecked")
    protected ActionInvocation invokeAction(DispatcherUtils du, HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionDefinition actionDefinition, Map<String, String> params) throws ServletException
    {
        ActionMapping mapping = getActionMapping(actionDefinition, params);
        Map<String, Object> extraContext = du.createContextMap(request, response, mapping, context);

        // If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
        OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
        if (null != stack)
        {
            extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
        }

        try
        {
            prepareContinuationAction(request, extraContext);

            ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(actionDefinition.getNamespace(), actionDefinition.getAction(), extraContext, actionDefinition.isExecuteResult(), false);
            proxy.setMethod(actionDefinition.getMethod());
            request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());

            // if the ActionMapping says to go straight to a result, do it!
            if (mapping.getResult() != null)
            {
                Result result = mapping.getResult();
                result.execute(proxy.getInvocation());
            }
            else
            {
                proxy.execute();
View Full Code Here


    /**
     *
     */
    protected ActionMapping getActionMapping(ActionDefinition actionDefinition, Map<String, String> params)
    {
        ActionMapping actionMapping = new ActionMapping(actionDefinition.getAction(), actionDefinition.getNamespace(), actionDefinition.getMethod(), params);
        return actionMapping;
    }
View Full Code Here

            if ( StringUtils.isBlank( path ) ||
                 StringUtils.equals( path, "/" ) ||
                 StringUtils.equals( path, ".action" ) )
            {
                // Return "root" browse.
                return new ActionMapping( ACTION_BROWSE, "/", "", null );
            }
            else
            {
                Map params = new HashMap();

                if ( path.charAt( 0 ) == '/' )
                {
                    path = path.substring( 1 );
                }

                String[] parts = path.split( "/" );
                switch ( parts.length )
                {
                    case 1:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        return new ActionMapping( ACTION_BROWSE_GROUP, "/", "", params );

                    case 2:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        params.put( PARAM_ARTIFACT_ID, parts[1] );
                        return new ActionMapping( ACTION_BROWSE_ARTIFACT, "/", "", params );

                    case 3:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        params.put( PARAM_ARTIFACT_ID, parts[1] );
                        params.put( PARAM_VERSION, parts[2] );
                        return new ActionMapping( ACTION_SHOW_ARTIFACT, "/", "", params );

                    case 4:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        params.put( PARAM_ARTIFACT_ID, parts[1] );
                        params.put( PARAM_VERSION, parts[2] );

                        if ( METHOD_DEPENDENCIES.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_DEPENDENCIES, "/", "", params );
                        }
                        else if ( METHOD_MAILING_LISTS.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_MAILING_LISTS, "/", "", params );
                        }
                        else if ( METHOD_USEDBY.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_DEPENDEES, "/", "", params );
                        }
                        else if ( METHOD_DEPENDENCY_TREE.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_DEPENDENCY_TREE, "/", "", params );
                        }
                        break;
                }
            }
        }
View Full Code Here

            if ( StringUtils.isBlank( path ) ||
                 StringUtils.equals( path, "/" ) ||
                 StringUtils.equals( path, ".action" ) )
            {
                // Return "root" browse.
                return new ActionMapping( ACTION_BROWSE, "/", "", null );
            }
            else
            {
                Map params = new HashMap();

                if ( path.charAt( 0 ) == '/' )
                {
                    path = path.substring( 1 );
                }

                String[] parts = path.split( "/" );
                switch ( parts.length )
                {
                    case 1:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        return new ActionMapping( ACTION_BROWSE_GROUP, "/", "", params );

                    case 2:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        params.put( PARAM_ARTIFACT_ID, parts[1] );
                        return new ActionMapping( ACTION_BROWSE_ARTIFACT, "/", "", params );

                    case 3:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        params.put( PARAM_ARTIFACT_ID, parts[1] );
                        params.put( PARAM_VERSION, parts[2] );
                        return new ActionMapping( ACTION_SHOW_ARTIFACT, "/", "", params );

                    case 4:
                        params.put( PARAM_GROUP_ID, parts[0] );
                        params.put( PARAM_ARTIFACT_ID, parts[1] );
                        params.put( PARAM_VERSION, parts[2] );

                        if ( METHOD_DEPENDENCIES.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_DEPENDENCIES, "/", "", params );
                        }
                        else if ( METHOD_MAILING_LISTS.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_MAILING_LISTS, "/", "", params );
                        }
                        else if ( METHOD_USEDBY.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_DEPENDEES, "/", "", params );
                        }
                        else if ( METHOD_DEPENDENCY_TREE.equals( parts[3] ) )
                        {
                            return new ActionMapping( ACTION_SHOW_ARTIFACT_DEPENDENCY_TREE, "/", "", params );
                        }
                        break;
                }
            }
        }
View Full Code Here

        if ( path.startsWith( BROWSE_PREFIX ) )
        {
            path = path.substring( BROWSE_PREFIX.length() );
            if ( path.length() == 0 )
            {
                return new ActionMapping( "browse", "/", "", null );
            }
            else
            {
                String[] parts = path.split( "/" );
                if ( parts.length == 1 )
                {
                    Map params = new HashMap();
                    params.put( "groupId", parts[0] );
                    return new ActionMapping( "browseGroup", "/", "", params );
                }
                else if ( parts.length == 2 )
                {
                    Map params = new HashMap();
                    params.put( "groupId", parts[0] );
                    params.put( "artifactId", parts[1] );
                    return new ActionMapping( "browseArtifact", "/", "", params );
                }
                else if ( parts.length == 3 )
                {
                    Map params = new HashMap();
                    params.put( "groupId", parts[0] );
                    params.put( "artifactId", parts[1] );
                    params.put( "version", parts[2] );
                    return new ActionMapping( "showArtifact", "/", "", params );
                }
                else if ( parts.length == 4 )
                {
                    Map params = new HashMap();
                    params.put( "groupId", parts[0] );
                    params.put( "artifactId", parts[1] );
                    params.put( "version", parts[2] );

                    if ( "dependencies".equals( parts[3] ) )
                    {
                        return new ActionMapping( "showArtifactDependencies", "/", "", params );
                    }
                    else if ( "mailingLists".equals( parts[3] ) )
                    {
                        return new ActionMapping( "showArtifactMailingLists", "/", "", params );
                    }
                    else if ( "usedby".equals( parts[3] ) )
                    {
                        return new ActionMapping( "showArtifactDependees", "/", "", params );
                    }
                    else if ( "dependencyTree".equals( parts[3] ) )
                    {
                        return new ActionMapping( "showArtifactDependencyTree", "/", "", params );
                    }
                }
            }
        }
        else if ( path.startsWith( PROXY_PREFIX ) )
        {
            // retain the leading /
            path = path.substring( PROXY_PREFIX.length() - 1 );

            Map params = new HashMap();
            params.put( "path", path );
            return new ActionMapping( "proxy", "/", "", params );
        }

        return super.getMapping( httpServletRequest );
    }
View Full Code Here

TOP

Related Classes of com.opensymphony.webwork.dispatcher.mapper.ActionMapping

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.