/**
   * This sets the return path for a ResourceAction by appending the type and resource id to the
   * forward url.
   *
   * @param request The current controller's request.
   * @param mapping The current controller's mapping that contains the input.
   * @throws ParameterNotFoundException if the type or id are not found
   * @throws ServletException If there is not input defined for this form
   */
  @Override
  protected void setReturnPath(HttpServletRequest request, ActionMapping mapping, Map params)
      throws Exception {
    this.fetchReturnPathParams(request, params);
    String returnPath = ActionUtils.findReturnPath(mapping, params);
    if (log.isTraceEnabled()) {
      log.trace("setting return path: " + returnPath);
    }

    SessionUtils.setReturnPath(request.getSession(), returnPath);
  }
  /** This method sets the current location for the nav map */
  protected void setNavMapLocation(
      HttpServletRequest request, ActionMapping mapping, String currLoc) throws Exception {
    Map<String, String> params = new HashMap<String, String>();

    // sets the returnPath to match the mode we're in.
    String mode = request.getParameter(ParamConstants.MODE_PARAM);
    params.put(ParamConstants.MODE_PARAM, mode);

    String newUrl = ActionUtils.changeUrl(currLoc, params);

    request.setAttribute(AttrConstants.CURR_RES_LOCATION_MODE, mode);
    request.setAttribute(AttrConstants.CURR_RES_LOCATION_TYPE, currLoc);
    request.setAttribute(AttrConstants.CURR_RES_LOCATION_TAG, newUrl);
  }
Esempio n. 3
0
  /**
   * This sets the return path for a ResourceAction by appending the type and resource id to the
   * forward url.
   *
   * @param request The current controller's request.
   * @param mapping The current controller's mapping that contains the input.
   * @exception ParameterNotFoundException if the type or id are not found
   * @exception ServletException If there is not input defined for this form
   */
  @Override
  protected void setReturnPath(HttpServletRequest request, ActionMapping mapping) throws Exception {
    HashMap parms = new HashMap();

    int resourceId = RequestUtils.getResourceId(request);
    parms.put(Constants.RESOURCE_ID_PARAM, resourceId);

    try {
      parms.put(
          Constants.ALERT_DEFINITION_PARAM,
          RequestUtils.getIntParameter(request, Constants.ALERT_DEFINITION_PARAM));
      parms.put(Constants.CHILD_RESOURCE_TYPE_ID_PARAM, WebUtility.getChildResourceTypeId(request));
    } catch (ParameterNotFoundException pnfe) {
      // that's ok!
      log.trace("couldn't find parameter: " + pnfe.getMessage());
    }

    // sets the returnPath to match the mode we're in.
    String mode = request.getParameter(Constants.MODE_PARAM);
    parms.put(Constants.MODE_PARAM, mode);

    String returnPath = ActionUtils.findReturnPath(mapping, parms);
    SessionUtils.setReturnPath(request.getSession(), returnPath);
  }