Package org.apache.struts.action

Examples of org.apache.struts.action.ActionMapping


        // next, try to use Struts forward to determine state
        else if (mForward != null)
        {
            ServletContext ctx = RollerContext.getServletContext();    
      ModuleConfig mConfig = RequestUtils.getModuleConfig(req, ctx);
            ActionMapping amapping = (ActionMapping)req.getAttribute(Globals.MAPPING_KEY);
            List fconfigs = new ArrayList();
      fconfigs.add(mConfig.findForwardConfig(mForward));
            if (mSubforwards != null) {
                String[] subforwards = mSubforwards.split(",");
                for (int i=0; i<subforwards.length; i++) {
                    fconfigs.add(mConfig.findForwardConfig(subforwards[i]));
                }
            }
            for (Iterator iter = fconfigs.iterator(); iter.hasNext();) {
                ForwardConfig fconfig = (ForwardConfig)iter.next();
                String fwdPath = fconfig.getPath();
                int end = fwdPath.indexOf(".do");
                fwdPath = (end == -1) ? fwdPath : fwdPath.substring(0, end);
                if  (fwdPath.equals(amapping.getPath()))
                {
                    selected = true;
                    break;
                }
            }
View Full Code Here


    plugin.init(actionServlet, moduleConfig);
    assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX) != null);

    DelegatingActionProxy proxy = new DelegatingActionProxy();
    proxy.setServlet(actionServlet);
    ActionMapping mapping = new ActionMapping();
    mapping.setPath("/test");
    mapping.setModuleConfig(moduleConfig);
    ActionForward forward = proxy.execute(
        mapping, null, new MockHttpServletRequest(servletContext), new MockHttpServletResponse());
    assertEquals("/test", forward.getPath());

    TestAction testAction = (TestAction) plugin.getWebApplicationContext().getBean("/test");
View Full Code Here

    assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX) == null);
    assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX + "/module") != null);

    DelegatingActionProxy proxy = new DelegatingActionProxy();
    proxy.setServlet(actionServlet);
    ActionMapping mapping = new ActionMapping();
    mapping.setPath("/test2");
    mapping.setModuleConfig(moduleConfig);
    ActionForward forward = proxy.execute(
        mapping, null, new MockHttpServletRequest(servletContext), new MockHttpServletResponse());
    assertEquals("/module/test2", forward.getPath());

    TestAction testAction = (TestAction) plugin.getWebApplicationContext().getBean("/module/test2");
View Full Code Here

    assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX) != null);
    assertTrue(servletContext.getAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX + "/module") == null);

    DelegatingActionProxy proxy = new DelegatingActionProxy();
    proxy.setServlet(actionServlet);
    ActionMapping mapping = new ActionMapping();
    mapping.setPath("/test2");
    mapping.setModuleConfig(moduleConfig);
    ActionForward forward = proxy.execute(
        mapping, null, new MockHttpServletRequest(servletContext), new MockHttpServletResponse());
    assertEquals("/module/test2", forward.getPath());

    TestAction testAction = (TestAction) plugin.getWebApplicationContext().getBean("/module/test2");
View Full Code Here

        String formName = form.getName();
        jsFormName = formName;
                if(jsFormName.charAt(0) == '/') {
                    String mappingName = TagUtils.getInstance().getActionMappingName(jsFormName);
                    ActionMapping mapping = (ActionMapping) config.findActionConfig(mappingName);
                    if (mapping == null) {
                        JspException e = new JspException(messages.getMessage("formTag.mapping", mappingName));
                        pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);
                        throw e;
                    }
                    jsFormName = mapping.getAttribute();
                }
       
        results.append(this.getJavascriptBegin(methods));

        for (Iterator i = actions.iterator(); i.hasNext();) {
View Full Code Here

        responseMock = mock(HttpServletResponse.class);
        response = (HttpServletResponse) responseMock.proxy();

        String actionType = StrutsTestAction.class.getName();
        mapping = new ActionMapping();
        mapping.setPath("/myPath1");
        mapping.setType(actionType);

        service = new TestService();
        container = new DefaultPicoContainer();
View Full Code Here

    }

    protected void setUp() {
        String actionType = StrutsTestAction.class.getName();

        mapping1 = new ActionMapping();
        mapping1.setPath("/myPath1");
        mapping1.setType(actionType);

        mapping2 = new ActionMapping();
        mapping2.setPath("/myPath2");
        mapping2.setType(actionType);

        requestMock.stubs().method("getSession").will(returnValue(session));
        sessionMock.stubs().method("getServletContext").will(returnValue(servletContext));
View Full Code Here

            // calls this method (or if a plain Struts action forwards to this forward) --
            // otherwise, the page flow should be using a Forward already.
            //
            if ( fwd instanceof PageFlowActionForward )
            {
                ActionMapping mapping = ( ActionMapping ) request.getAttribute( Globals.MAPPING_KEY );
                assert mapping != null;
                ActionForm form = InternalUtils.getFormBean( mapping, request );
                Forward pfFwd = new Forward( ( ActionForward ) fwd, servletContext );
                ActionForwardHandler handler = _handlers.getActionForwardHandler();
                fwd = handler.doForward( context, pfFwd, mapping, InternalUtils.getActionName( mapping ), null, form );
View Full Code Here

    {
        if ( fc != null )
        {
            try
            {
                ActionMapping mapping = InternalUtils.getCurrentActionMapping( request );
                ActionForm form = InternalUtils.getCurrentActionForm( request );
                ActionForward fwd = fc.handleException( th, mapping, form, request, response );
                processForwardConfig( request, response, fwd );
                return true;
            }
View Full Code Here

            }

            //
            // Make sure that the requested pageflow matches the pageflow for the directory.
            //
            ActionMapping beginMapping = getBeginMapping();
            if ( beginMapping != null )
            {
                String desiredType = beginMapping.getParameter();
                desiredType = desiredType.substring( desiredType.lastIndexOf( '.' ) + 1 ) + JPF_EXTENSION;
                String requestedType = InternalUtils.getDecodedServletPath( request );
                requestedType = requestedType.substring( requestedType.lastIndexOf( '/' ) + 1 );

                if ( ! requestedType.equals( desiredType ) )
View Full Code Here

TOP

Related Classes of org.apache.struts.action.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.