Package jodd.madvoc

Examples of jodd.madvoc.ActionRequest


   * On first invoke, initializes the action configuration before further proceeding.
   *
   * @see jodd.madvoc.component.ActionMethodParser#buildActionPath(String, String, String, String, String)
   */
  public String invoke(String actionPath, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception {
    ActionRequest actionRequest = null;

    boolean characterEncodingSet = false;

    while (actionPath != null) {
      if (log.isDebugEnabled()) {
        log.debug("Action path: " + actionPath);
      }

      // build action path
      String httpMethod = servletRequest.getMethod().toUpperCase();

      actionPath = actionPathRewriter.rewrite(servletRequest, actionPath, httpMethod);

      // resolve action configuration
      ActionConfig actionConfig = actionsManager.lookup(actionPath, httpMethod);
      if (actionConfig == null) {
        return actionPath;
      }
      if (log.isDebugEnabled()) {
        log.debug("Invoking action path '" + actionPath + "' using " + actionConfig.actionClass.getSimpleName());
      }

      // set character encoding
      if (!characterEncodingSet && madvocConfig.isApplyCharacterEncoding()) {

        String encoding = madvocConfig.getEncoding();

        if (encoding != null) {
          servletRequest.setCharacterEncoding(encoding);
          servletResponse.setCharacterEncoding(encoding);
        }

        characterEncodingSet = true;
      }

      // create action object
      Object action = createAction(actionConfig.actionClass);

      // create action request
      ActionRequest previousRequest = actionRequest;
      actionRequest = createActionRequest(actionPath, actionConfig, action, servletRequest, servletResponse);
      actionRequest.setPreviousActionRequest(previousRequest);

      // invoke and render
      if (actionConfig.isAsync()) {
View Full Code Here


      ActionConfig actionConfig,
      Object action,
      HttpServletRequest servletRequest,
      HttpServletResponse servletResponse) {

    return new ActionRequest(this, actionPath, actionConfig, action, servletRequest, servletResponse);
  }
View Full Code Here

    HttpServletRequest servletRequest = actionRequest.getHttpServletRequest();

    String moveId = servletRequest.getParameter(attributeMoveId);
    if (moveId != null) {
      HttpSession session = servletRequest.getSession();
      ActionRequest sourceRequest = (ActionRequest) session.getAttribute(moveId);
      session.removeAttribute(moveId);
      if (sourceRequest != null) {
        outjectAfterMove(sourceRequest);
      }
    }
View Full Code Here

   * Returns <code>null</code> if action path is consumed and has been invoked by this controller; otherwise
   * the action path string is returned (it might be different than original one, provided in arguments).
   * On first invoke, initializes the action configuration before further proceeding.
   */
  public String invoke(String actionPath, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception {
    ActionRequest actionRequest = null;

    boolean characterEncodingSet = false;

    while (actionPath != null) {
      if (log.isDebugEnabled()) {
        log.debug("Action path: " + actionPath);
      }

      // build action path
      String httpMethod = servletRequest.getMethod().toUpperCase();

      actionPath = actionPathRewriter.rewrite(servletRequest, actionPath, httpMethod);

      // resolve action configuration
      ActionConfig actionConfig = actionsManager.lookup(actionPath, httpMethod);
      if (actionConfig == null) {
        return actionPath;
      }
      if (log.isDebugEnabled()) {
        log.debug("Invoking action path '" + actionPath + "' using " + actionConfig.actionClass.getSimpleName());
      }

      // set character encoding
      if (!characterEncodingSet && madvocConfig.isApplyCharacterEncoding()) {

        String encoding = madvocConfig.getEncoding();

        if (encoding != null) {
          servletRequest.setCharacterEncoding(encoding);
          servletResponse.setCharacterEncoding(encoding);
        }

        characterEncodingSet = true;
      }

      // create action object
      Object action = createAction(actionConfig.actionClass);

      // create action request
      ActionRequest previousRequest = actionRequest;
      actionRequest = createActionRequest(actionPath, actionConfig, action, servletRequest, servletResponse);
      actionRequest.setPreviousActionRequest(previousRequest);

      // invoke and render
      if (actionConfig.isAsync()) {
View Full Code Here

      ActionConfig actionConfig,
      Object action,
      HttpServletRequest servletRequest,
      HttpServletResponse servletResponse) {

    return new ActionRequest(this, actionPath, actionConfig, action, servletRequest, servletResponse);
  }
View Full Code Here

    HttpServletRequest servletRequest = actionRequest.getHttpServletRequest();

    String moveId = servletRequest.getParameter(attributeMoveId);
    if (moveId != null) {
      HttpSession session = servletRequest.getSession();
      ActionRequest sourceRequest = (ActionRequest) session.getAttribute(moveId);
      session.removeAttribute(moveId);
      if (sourceRequest != null) {
        outjectAfterMove(sourceRequest);
      }
    }
View Full Code Here

    };

    ResultMapper resultMapper = webapp.getComponent(ResultMapper.class);
    BeanUtil.setDeclaredProperty(sdr, "resultMapper", resultMapper);

    ActionRequest actionRequest = createActionRequest("/hello.world.html");
    sdr.render(actionRequest, "ok");

    assertEquals("[" +
        "/hello.world.html.ok.jspf, " +
        "/hello.world.html.ok.jsp, " +
View Full Code Here

        ReflectUtil.findMethod(Action.class, "view"),
        null, null,
        new ActionDef(actionPath, "GET"),
        null, false, null, null);

    return new ActionRequest(madvocController, actionConfig.getActionPath(), actionConfig, action, servletRequest, servletResponse);
  }
View Full Code Here

TOP

Related Classes of jodd.madvoc.ActionRequest

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.