Package org.apache.struts2.dispatcher.mapper

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


              throw new ServletException(message, e);
            }
            Dispatcher.setInstance(du);
          }

          ActionMapper mapper = null;
          ActionMapping mapping = null;
          try {
            mapper = ActionMapperFactory.getMapper();
            mapping = mapper.getMapping(request, du.getConfigurationManager());
          } catch (Exception ex) {
            du.sendError(request, response, servletContext, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex);
            ActionContextCleanUp.cleanUp(req);
            return;
          }
View Full Code Here


                                        HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme,
                                        boolean includeContext, boolean encodeResult) {
        String finalAction = findString(action);
        String finalNamespace = determineNamespace(namespace, getStack(), req);
        ActionMapping mapping = new ActionMapping(finalAction, finalNamespace, method, parameters);
        ActionMapper mapper = ActionMapperFactory.getMapper();
        String uri = mapper.getUriFromActionMapping(mapping);
        return UrlHelper.buildUrl(uri, req, res, parameters, scheme, includeContext, encodeResult);
    }
View Full Code Here

    public static String buildNamespace(ValueStack stack, HttpServletRequest request) {
        ActionContext context = new ActionContext(stack.getContext());
        ActionInvocation invocation = context.getActionInvocation();

        if (invocation == null) {
            ActionMapper mapper = ActionMapperFactory.getMapper();
            ActionMapping mapping = mapper.getMapping(request,
                    Dispatcher.getInstance().getConfigurationManager());

            if (mapping != null) {
                return mapping.getNamespace();
            } else {
View Full Code Here

                    conditionalParse(e.getValue().toString(), invocation));
            }
          }
        }

        ActionMapper mapper = ActionMapperFactory.getMapper();
        StringBuffer tmpLocation = new StringBuffer(mapper.getUriFromActionMapping(new ActionMapping(actionName, namespace, method, null)));
        UrlHelper.buildParametersString(requestParameters, tmpLocation, "&");

        setLocation(tmpLocation.toString());

        super.execute(invocation);
View Full Code Here

                req,
                res,
                servletContext);

        try {
            ActionMapper actionMapper = du.getContainer().getInstance(ActionMapper.class);
            ActionMapping mapping = actionMapper.getMappingFromActionName(action);
            ActionInvocation inv = new ValidatorActionInvocation(ctx, true);
            ActionProxyFactory actionProxyFactory = du.getContainer().getInstance(ActionProxyFactory.class);
            ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, mapping.getName(), mapping.getMethod(), true, true);
            proxy.execute();
            Object a = proxy.getAction();
View Full Code Here

                req,
                res,
                servletContext);

        try {
            ActionMapper actionMapper = du.getContainer().getInstance(ActionMapper.class);
            ActionMapping mapping = actionMapper.getMappingFromActionName(action);
            ActionInvocation inv = new ValidatorActionInvocation(ctx, true);
            ActionProxyFactory actionProxyFactory = du.getContainer().getInstance(ActionProxyFactory.class);
            ActionProxy proxy = actionProxyFactory.createActionProxy(inv, namespace, mapping.getName(), mapping.getMethod(), true, true);
            proxy.execute();
            Object a = proxy.getAction();
View Full Code Here

            put(StrutsConstants.STRUTS_I18N_ENCODING, "utf-8");
            put(StrutsConstants.STRUTS_MAPPER_COMPOSITE, "struts,restful");
        }});

        // when
        ActionMapper instance = container.getInstance(ActionMapper.class, "composite");

        // then
        assertNotNull(instance);
    }
View Full Code Here

      String[] tokens = list.split(",");
      for (String token : tokens) {
        String[] kvp = token.split("=");
        String key = kvp[0];
        String name = kvp[1];
        ActionMapper mapper = container.getInstance(ActionMapper.class, name);
        if (mapper != null) {
          _prefixedActionMappers.add(new Prefixed<ActionMapper>(key, mapper));
        } else {
          throw new IllegalStateException("unknown ActionMapper " + name);
        }
View Full Code Here

    for (Prefixed<ActionMapper> prefixedActionMapper : _prefixedActionMappers) {

      String prefix = prefixedActionMapper.getPrefix();
      if (uri.startsWith(prefix)) {
        ActionMapper actionMapper = prefixedActionMapper.getValue();
        return actionMapper.getMapping(request, configManager);
      }
    }

    throw new IllegalArgumentException("no ActionMapper for uri: " + uri);
  }
View Full Code Here

            put(StrutsConstants.STRUTS_MAPPER_COMPOSITE, "struts,restful");
        }});
        Container container = du.getContainer();

        // when
        ActionMapper instance = container.getInstance(ActionMapper.class, "composite");

        // then
        assertNotNull(instance);
    }
View Full Code Here

TOP

Related Classes of org.apache.struts2.dispatcher.mapper.ActionMapper

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.