Package org.apache.struts2.dispatcher.mapper

Examples of org.apache.struts2.dispatcher.mapper.ActionMapping


                                        boolean includeContext, boolean encodeResult, boolean forceAddSchemeHostAndPort,
                                        boolean escapeAmp) {
        String finalAction = findString(action);
        String finalMethod = method != null ? findString(method) : null;
        String finalNamespace = determineNamespace(namespace, getStack(), req);
        ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, finalMethod, parameters);
        String uri = actionMapper.getUriFromActionMapping(mapping);
        return urlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult, forceAddSchemeHostAndPort, escapeAmp);
    }
View Full Code Here


        try {
            prepare.createActionContext(request, response);
            prepare.assignDispatcherToThread();
            prepare.setEncodingAndLocale(request, response);
            request = prepare.wrapRequest(request);
            ActionMapping mapping = prepare.findActionMapping(request, response);
            if (mapping == null) {
                boolean handled = execute.executeStaticResourceRequest(request, response);
                if (!handled)
                    throw new ServletException("Resource loading not supported, use the StrutsPrepareAndExecuteFilter instead.");
            } else {
View Full Code Here

    public static class InnerMapper implements ActionMapper {

        public InnerMapper() {}

        public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
            return new ActionMapping();
        }
View Full Code Here

    }

    public static class InnerActionMapper implements ActionMapper {

        public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager config) {
            return new ActionMapping("action", "/", null, Collections.<String, Object>emptyMap());
        }
View Full Code Here

     * @return the parameters from the action mapping in the context.  If none found, returns
     *         an empty map.
     */
    @Override
    protected Map<String, Object> retrieveParameters(ActionContext ac) {
        ActionMapping mapping = (ActionMapping) ac.get(ServletActionContext.ACTION_MAPPING);
        if (mapping != null) {
            return mapping.getParams();
        } else {
            return Collections.emptyMap();
        }
    }
View Full Code Here

    Map<PortletMode, ActionMapping> actionMap = new HashMap<PortletMode, ActionMapping>();

    dispatcher.parseModeConfig(actionMap, portletConfig, PortletMode.VIEW,
        "viewNamespace", "defaultViewAction");

    ActionMapping mapping = actionMap.get(PortletMode.VIEW);
    assertEquals("index", mapping.getName());
    assertEquals("/view", mapping.getNamespace());
    assertEquals("input", mapping.getMethod());
  }
View Full Code Here

     * For this to work the configured result for the action needs to be
     * FreeMarker, or Velocity (JSPs can be used with the Embedded JSP plugin)
     */
    protected String executeAction(String uri) throws ServletException, UnsupportedEncodingException {
        request.setRequestURI(uri);
        ActionMapping mapping = getActionMapping(request);

        assertNotNull(mapping);
        Dispatcher.getInstance().serviceAction(request, response, servletContext, mapping);

        if (response.getStatus() != HttpServletResponse.SC_OK) {
View Full Code Here

     * Creates an action proxy for a request, and sets parameters of the ActionInvocation to the passed
     * parameters. Make sure to set the request parameters in the protected "request" object before calling this method.
     */
    protected ActionProxy getActionProxy(String uri) {
        request.setRequestURI(uri);
        ActionMapping mapping = getActionMapping(request);
        String namespace = mapping.getNamespace();
        String name = mapping.getName();
        String method = mapping.getMethod();

        Configuration config = configurationManager.getConfiguration();
        ActionProxy proxy = config.getContainer().getInstance(ActionProxyFactory.class).createActionProxy(
                namespace, name, method, new HashMap<String, Object>(), true, false);

View Full Code Here

    public void testRootMapping() throws Exception {
        req.setRequestURI("/myapp/");
        req.setServletPath("/");

        ActionMapping mapping = mapper.getMapping(req, configManager);

        assertNull(mapping);
    }
View Full Code Here

    public void testGetMapping() throws Exception {
        req.setRequestURI("/myapp/animals/dog");
        req.setServletPath("/animals/dog");

        ActionMapping mapping = mapper.getMapping(req, configManager);

        assertEquals("/animals", mapping.getNamespace());
        assertEquals("dog", mapping.getName());
        assertEquals("index", mapping.getMethod());
    }
View Full Code Here

TOP

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