Package org.apache.struts2.components

Examples of org.apache.struts2.components.ActionComponent


        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        defaultActionMapper.setContainer(container);
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);


        StrutsResultSupport result = (StrutsResultSupport) actionMapping.getResult();
        assertNotNull(result);
        assertTrue(result instanceof ServletRedirectResult);

        assertEquals("myAction.action", result.getLocation());

        // TODO: need to test location but there's noaccess to the property/method, unless we use reflection
    }
View Full Code Here


        defaultActionMapper.setContainer(container);
        defaultActionMapper.setExtensions(",,");
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);


        StrutsResultSupport result = (StrutsResultSupport) actionMapping.getResult();
        assertNotNull(result);
        assertTrue(result instanceof ServletRedirectResult);

        assertEquals("myAction", result.getLocation());

        // TODO: need to test location but there's noaccess to the property/method, unless we use reflection
    }
View Full Code Here

  /**
   * reserved method parameter
   */
  public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
    ActionMapping mapping = super.getMapping(request, configManager);
    if (null != mapping) {
      String method = request.getParameter(methodParam);
      if (StringUtils.isNotEmpty(method)) {
        mapping.setMethod(method);
      }
    }
    return mapping;
  }
View Full Code Here

   * @param t
   *            the exception
   * @return the exception as a string.
   */
  protected String toString(Throwable t) {
    FastByteArrayOutputStream bout = new FastByteArrayOutputStream();
    PrintWriter wrt = new PrintWriter(bout);
    t.printStackTrace(wrt);
    wrt.close();
    return bout.toString();
  }
View Full Code Here

  freemarker.template.Configuration cfg;

  protected void buildCfg() {
    cfg = new freemarker.template.Configuration();
    cfg.setTemplateLoader(new StrutsClassTemplateLoader());
    cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
    cfg.setObjectWrapper(new BeangleObjectWrapper(true));
    cfg.setDefaultEncoding("utf-8");
  }
View Full Code Here

  public void testText() throws Exception {
    Map<String, Object> datas = CollectUtils.newHashMap();
    datas.put("b", new BeangleTagLibrary(ActionContext.getContext().getValueStack(),
        new MockHttpServletRequest(), new MockHttpServletResponse()));
    datas.put("s", new StrutsModels(ActionContext.getContext().getValueStack(),
        new MockHttpServletRequest(), new MockHttpServletResponse()));
    datas.put("watch", new StopWatch());
    StringWriter writer = new StringWriter();
    Template template = cfg.getTemplate("comp.ftl");
    // template.process(datas, writer);
View Full Code Here

            }   
           
            // Create an iterator status if the status attribute was set.
            if (statusAttr != null) {
                statusState = new IteratorStatus.StatusState();
                status = new IteratorStatus(statusState);
            }

            // we don't need this
            /*
            if (value == null) {
View Full Code Here

        @Override
        public boolean end(Writer writer, String body)
        {
            if (isReader)
            {   // A reader list
                IteratorStatus tmpStatus = status;
                status = null;
                // Iterate
                boolean result = super.end(writer, body);
                status = tmpStatus;
                if (status!=null)
View Full Code Here

    public void testGetMappingWithActionName_noDynamicMethodColonPrefix() throws Exception {

        Map parameterMap = new HashMap();
        parameterMap.put(DefaultActionMapper.METHOD_PREFIX + "someMethod", "");

        StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest();
        request.setParameterMap(parameterMap);
        request.setupGetServletPath("/someServletPath.action");

        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        defaultActionMapper.setAllowDynamicMethodCalls("false");
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);
View Full Code Here

    public void testActionPrefix() throws Exception {
        Map parameterMap = new HashMap();
        parameterMap.put(DefaultActionMapper.ACTION_PREFIX + "myAction", "");

        StrutsMockHttpServletRequest request = new StrutsMockHttpServletRequest();
        request.setParameterMap(parameterMap);
        request.setupGetServletPath("/someServletPath.action");

        DefaultActionMapper defaultActionMapper = new DefaultActionMapper();
        ActionMapping actionMapping = defaultActionMapper.getMapping(request, configManager);

        assertEquals(actionMapping.getName(), "myAction");
View Full Code Here

TOP

Related Classes of org.apache.struts2.components.ActionComponent

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.