Ejemplo n.º 1
0
  @Override
  public String getJspPage() {
    try {
      // get data list
      DataList dataList = getDataList();

      if (dataList != null) {
        // overide datalist result to use userview result
        DataListActionResult ac = dataList.getActionResult();
        if (ac != null) {
          if (ac.getMessage() != null && !ac.getMessage().isEmpty()) {
            setAlertMessage(ac.getMessage());
          }
          if (ac.getType() != null
              && DataListActionResult.TYPE_REDIRECT.equals(ac.getType())
              && ac.getUrl() != null
              && !ac.getUrl().isEmpty()) {
            if ("REFERER".equals(ac.getUrl())) {
              HttpServletRequest request = WorkflowUtil.getHttpServletRequest();
              if (request != null && request.getHeader("Referer") != null) {
                setRedirectUrl(request.getHeader("Referer"));
              } else {
                setRedirectUrl("REFERER");
              }
            } else {
              setRedirectUrl(ac.getUrl());
            }
          }
        }

        // set data list
        setProperty("dataList", dataList);
      } else {
        setProperty("error", "Data List \"" + getPropertyString("datalistId") + "\" not exist.");
      }
    } catch (Exception ex) {
      StringWriter out = new StringWriter();
      ex.printStackTrace(new PrintWriter(out));
      String message = ex.toString();
      message += "\r\n<pre class=\"stacktrace\">" + out.getBuffer() + "</pre>";
      setProperty("error", message);
    }
    return "userview/plugin/datalist.jsp";
  }
Ejemplo n.º 2
0
 /**
  * Convenience method to retrieve the current request context path
  *
  * @return
  */
 public static String getRequestContextPath() {
   HttpServletRequest request = WorkflowUtil.getHttpServletRequest();
   String url = (request != null) ? request.getContextPath() : "";
   return url;
 }