Ejemplo n.º 1
0
  private List<Map<String, String>> parseHistoryResponse(String response) {
    if (debug) {
      Debug.logInfo("Raw History : " + response, module);
    }

    // covert to all lowercase and trim off the html header
    String subResponse = response.toLowerCase();
    int firstIndex = subResponse.indexOf("<tr>");
    int lastIndex = subResponse.lastIndexOf("</tr>");
    subResponse = subResponse.substring(firstIndex, lastIndex);

    // clean up the html and replace the delimiters with '|'
    subResponse = StringUtil.replaceString(subResponse, "<td>", "");
    subResponse = StringUtil.replaceString(subResponse, "</td>", "|");

    // test the string to make sure we have fields to parse
    String testResponse = StringUtil.replaceString(subResponse, "<tr>", "");
    testResponse = StringUtil.replaceString(testResponse, "</tr>", "");
    testResponse = StringUtil.replaceString(testResponse, "|", "");
    testResponse = testResponse.trim();
    if (testResponse.length() == 0) {
      if (debug) {
        Debug.logInfo("History did not contain any fields, returning null", module);
      }
      return null;
    }

    // break up the keys from the values
    int valueStart = subResponse.indexOf("</tr>");
    String keys = subResponse.substring(4, valueStart - 1);
    String values = subResponse.substring(valueStart + 9, subResponse.length() - 6);

    // split sets of values up
    values = StringUtil.replaceString(values, "|</tr><tr>", "&");
    List<String> valueList = StringUtil.split(values, "&");

    // create a List of Maps for each set of values
    List<Map<String, String>> valueMap = FastList.newInstance();
    for (int i = 0; i < valueList.size(); i++) {
      valueMap.add(
          StringUtil.createMap(
              StringUtil.split(keys, "|"), StringUtil.split(valueList.get(i), "|")));
    }

    if (debug) {
      Debug.logInfo("History Map : " + valueMap, module);
    }

    return valueMap;
  }
  /**
   * Initializes the rules for this RecurrenceInfo object.
   *
   * @throws RecurrenceRuleException
   */
  public void init() throws RecurrenceRuleException {
    // Check the validity of the rule
    String freq = rule.getString("frequency");

    if (!checkFreq(freq))
      throw new RecurrenceRuleException("Recurrence FREQUENCY is a required parameter.");
    if (rule.getLong("intervalNumber").longValue() < 1)
      throw new RecurrenceRuleException("Recurrence INTERVAL must be a positive integer.");

    // Initialize the byXXX lists
    bySecondList = StringUtil.split(rule.getString("bySecondList"), ",");
    byMinuteList = StringUtil.split(rule.getString("byMinuteList"), ",");
    byHourList = StringUtil.split(rule.getString("byHourList"), ",");
    byDayList = StringUtil.split(rule.getString("byDayList"), ",");
    byMonthDayList = StringUtil.split(rule.getString("byMonthDayList"), ",");
    byYearDayList = StringUtil.split(rule.getString("byYearDayList"), ",");
    byWeekNoList = StringUtil.split(rule.getString("byWeekNoList"), ",");
    byMonthList = StringUtil.split(rule.getString("byMonthList"), ",");
    bySetPosList = StringUtil.split(rule.getString("bySetPosList"), ",");
  }
Ejemplo n.º 3
0
 private boolean isDisableIfEmpty(ModelMenuItem menuItem, Map<String, Object> context) {
   boolean disabled = false;
   String disableIfEmpty = menuItem.getDisableIfEmpty();
   if (UtilValidate.isNotEmpty(disableIfEmpty)) {
     List<String> keys = StringUtil.split(disableIfEmpty, "|");
     for (String key : keys) {
       Object obj = context.get(key);
       if (obj == null) {
         disabled = true;
         break;
       }
     }
   }
   return disabled;
 }
Ejemplo n.º 4
0
  public static String receiveAppletRequest(
      HttpServletRequest request, HttpServletResponse response) {
    Delegator delegator = (Delegator) request.getAttribute("delegator");
    String sessionId = request.getParameter("sessionId");
    String visitId = request.getParameter("visitId");
    sessionId = sessionId.trim();
    visitId = visitId.trim();

    String responseString = "ERROR";

    GenericValue visit = null;
    try {
      visit = delegator.findOne("Visit", false, "visitId", visitId);
    } catch (GenericEntityException e) {
      Debug.logError(e, "Cannot Visit Object", module);
    }

    if (visit.getString("sessionId").equals(sessionId)) {
      String currentPage = request.getParameter("currentPage");
      if (appletSessions.containsKey(sessionId)) {
        Map<String, String> sessionMap = appletSessions.get(sessionId);
        String followers = sessionMap.get("followers");
        List<String> folList = StringUtil.split(followers, ",");
        for (String follower : folList) {
          Map<String, String> folSesMap = UtilMisc.toMap("followPage", currentPage);
          appletSessions.put(follower, folSesMap);
        }
      }
      responseString = "OK";
    }

    try {
      PrintWriter out = response.getWriter();
      response.setContentType("text/plain");
      out.println(responseString);
      out.close();
    } catch (IOException e) {
      Debug.logError(e, "Problems writing servlet output!", module);
    }

    return "success";
  }
Ejemplo n.º 5
0
  /**
   * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    Delegator delegator = (Delegator) getServletContext().getAttribute("delegator");

    String pathInfo = request.getPathInfo();
    List<String> pathElements = StringUtil.split(pathInfo, "/");

    // look for productId
    String productId = null;
    try {
      String lastPathElement = pathElements.get(pathElements.size() - 1);
      if (lastPathElement.startsWith("p_")
          || delegator.findOne("Product", UtilMisc.toMap("productId", lastPathElement), true)
              != null) {
        if (lastPathElement.startsWith("p_")) {
          productId = lastPathElement.substring(2);
        } else {
          productId = lastPathElement;
        }
        pathElements.remove(pathElements.size() - 1);
      }
    } catch (GenericEntityException e) {
      Debug.logError(
          e,
          "Error looking up product info for ProductUrl with path info ["
              + pathInfo
              + "]: "
              + e.toString(),
          module);
    }

    // get category info going with the IDs that remain
    String categoryId = null;
    if (pathElements.size() == 1) {
      CategoryWorker.setTrail(request, pathElements.get(0), null);
      categoryId = pathElements.get(0);
    } else if (pathElements.size() == 2) {
      CategoryWorker.setTrail(request, pathElements.get(1), pathElements.get(0));
      categoryId = pathElements.get(1);
    } else if (pathElements.size() > 2) {
      List<String> trail = CategoryWorker.getTrail(request);
      if (trail == null) {
        trail = FastList.newInstance();
      }

      if (trail.contains(pathElements.get(0))) {
        // first category is in the trail, so remove it everything after that and fill it in with
        // the list from the pathInfo
        int firstElementIndex = trail.indexOf(pathElements.get(0));
        while (trail.size() > firstElementIndex) {
          trail.remove(firstElementIndex);
        }
        trail.addAll(pathElements);
      } else {
        // first category is NOT in the trail, so clear out the trail and use the pathElements list
        trail.clear();
        trail.addAll(pathElements);
      }
      CategoryWorker.setTrail(request, trail);
      categoryId = pathElements.get(pathElements.size() - 1);
    }
    if (categoryId != null) {
      request.setAttribute("productCategoryId", categoryId);
    }

    String rootCategoryId = null;
    if (pathElements.size() >= 1) {
      rootCategoryId = pathElements.get(0);
    }
    if (rootCategoryId != null) {
      request.setAttribute("rootCategoryId", rootCategoryId);
    }

    if (productId != null) {
      request.setAttribute("product_id", productId);
      request.setAttribute("productId", productId);
    }

    RequestDispatcher rd =
        request.getRequestDispatcher(
            "/"
                + CONTROL_MOUNT_POINT
                + "/"
                + (productId != null ? PRODUCT_REQUEST : CATEGORY_REQUEST));
    rd.forward(request, response);
  }
Ejemplo n.º 6
0
  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {
    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;
    Delegator delegator =
        (Delegator) httpRequest.getSession().getServletContext().getAttribute("delegator");

    // Get ServletContext
    ServletContext servletContext = config.getServletContext();

    ContextFilter.setCharacterEncoding(request);

    // Set request attribute and session
    UrlServletHelper.setRequestAttributes(request, delegator, servletContext);

    // set initial parameters
    String initDefaultLocalesString = config.getInitParameter("defaultLocaleString");
    String initRedirectUrl = config.getInitParameter("redirectUrl");
    defaultLocaleString =
        UtilValidate.isNotEmpty(initDefaultLocalesString) ? initDefaultLocalesString : "";
    redirectUrl = UtilValidate.isNotEmpty(initRedirectUrl) ? initRedirectUrl : "";

    String pathInfo = httpRequest.getServletPath();
    if (UtilValidate.isNotEmpty(pathInfo)) {
      List<String> pathElements = StringUtil.split(pathInfo, "/");
      String alternativeUrl = pathElements.get(0);

      String productId = null;
      String productCategoryId = null;
      String urlContentId = null;
      try {
        // look for productId
        if (alternativeUrl.endsWith("-p")) {
          List<EntityCondition> productContentConds = FastList.newInstance();
          productContentConds.add(
              EntityCondition.makeCondition("productContentTypeId", "ALTERNATIVE_URL"));
          productContentConds.add(EntityUtil.getFilterByDateExpr());
          List<GenericValue> productContentInfos =
              EntityQuery.use(delegator)
                  .from("ProductContentAndInfo")
                  .where(productContentConds)
                  .orderBy("-fromDate")
                  .cache(true)
                  .queryList();
          if (UtilValidate.isNotEmpty(productContentInfos)) {
            for (GenericValue productContentInfo : productContentInfos) {
              String contentId = (String) productContentInfo.get("contentId");
              List<GenericValue> ContentAssocDataResourceViewTos =
                  EntityQuery.use(delegator)
                      .from("ContentAssocDataResourceViewTo")
                      .where(
                          "contentIdStart",
                          contentId,
                          "caContentAssocTypeId",
                          "ALTERNATE_LOCALE",
                          "drDataResourceTypeId",
                          "ELECTRONIC_TEXT")
                      .cache(true)
                      .queryList();
              if (UtilValidate.isNotEmpty(ContentAssocDataResourceViewTos)) {
                for (GenericValue ContentAssocDataResourceViewTo :
                    ContentAssocDataResourceViewTos) {
                  GenericValue ElectronicText =
                      ContentAssocDataResourceViewTo.getRelatedOne("ElectronicText", true);
                  if (UtilValidate.isNotEmpty(ElectronicText)) {
                    String textData = (String) ElectronicText.get("textData");
                    textData = UrlServletHelper.invalidCharacter(textData);
                    if (alternativeUrl.matches(textData + ".+$")) {
                      String productIdStr = null;
                      productIdStr = alternativeUrl.replace(textData + "-", "");
                      productIdStr = productIdStr.replace("-p", "");
                      String checkProductId = (String) productContentInfo.get("productId");
                      if (productIdStr.equalsIgnoreCase(checkProductId)) {
                        productId = checkProductId;
                        break;
                      }
                    }
                  }
                }
              }
              if (UtilValidate.isEmpty(productId)) {
                List<GenericValue> contentDataResourceViews =
                    EntityQuery.use(delegator)
                        .from("ContentDataResourceView")
                        .where("contentId", contentId, "drDataResourceTypeId", "ELECTRONIC_TEXT")
                        .cache(true)
                        .queryList();
                for (GenericValue contentDataResourceView : contentDataResourceViews) {
                  GenericValue ElectronicText =
                      contentDataResourceView.getRelatedOne("ElectronicText", true);
                  if (UtilValidate.isNotEmpty(ElectronicText)) {
                    String textData = (String) ElectronicText.get("textData");
                    if (UtilValidate.isNotEmpty(textData)) {
                      textData = UrlServletHelper.invalidCharacter(textData);
                      if (alternativeUrl.matches(textData + ".+$")) {
                        String productIdStr = null;
                        productIdStr = alternativeUrl.replace(textData + "-", "");
                        productIdStr = productIdStr.replace("-p", "");
                        String checkProductId = (String) productContentInfo.get("productId");
                        if (productIdStr.equalsIgnoreCase(checkProductId)) {
                          productId = checkProductId;
                          break;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }

        // look for productCategoryId
        if (alternativeUrl.endsWith("-c")) {
          List<EntityCondition> productCategoryContentConds = FastList.newInstance();
          productCategoryContentConds.add(
              EntityCondition.makeCondition("prodCatContentTypeId", "ALTERNATIVE_URL"));
          productCategoryContentConds.add(EntityUtil.getFilterByDateExpr());
          List<GenericValue> productCategoryContentInfos =
              EntityQuery.use(delegator)
                  .from("ProductCategoryContentAndInfo")
                  .where(productCategoryContentConds)
                  .orderBy("-fromDate")
                  .cache(true)
                  .queryList();
          if (UtilValidate.isNotEmpty(productCategoryContentInfos)) {
            for (GenericValue productCategoryContentInfo : productCategoryContentInfos) {
              String contentId = (String) productCategoryContentInfo.get("contentId");
              List<GenericValue> ContentAssocDataResourceViewTos =
                  EntityQuery.use(delegator)
                      .from("ContentAssocDataResourceViewTo")
                      .where(
                          "contentIdStart",
                          contentId,
                          "caContentAssocTypeId",
                          "ALTERNATE_LOCALE",
                          "drDataResourceTypeId",
                          "ELECTRONIC_TEXT")
                      .cache(true)
                      .queryList();
              if (UtilValidate.isNotEmpty(ContentAssocDataResourceViewTos)) {
                for (GenericValue ContentAssocDataResourceViewTo :
                    ContentAssocDataResourceViewTos) {
                  GenericValue ElectronicText =
                      ContentAssocDataResourceViewTo.getRelatedOne("ElectronicText", true);
                  if (UtilValidate.isNotEmpty(ElectronicText)) {
                    String textData = (String) ElectronicText.get("textData");
                    if (UtilValidate.isNotEmpty(textData)) {
                      textData = UrlServletHelper.invalidCharacter(textData);
                      if (alternativeUrl.matches(textData + ".+$")) {
                        String productCategoryStr = null;
                        productCategoryStr = alternativeUrl.replace(textData + "-", "");
                        productCategoryStr = productCategoryStr.replace("-c", "");
                        String checkProductCategoryId =
                            (String) productCategoryContentInfo.get("productCategoryId");
                        if (productCategoryStr.equalsIgnoreCase(checkProductCategoryId)) {
                          productCategoryId = checkProductCategoryId;
                          break;
                        }
                      }
                    }
                  }
                }
              }
              if (UtilValidate.isEmpty(productCategoryId)) {
                List<GenericValue> contentDataResourceViews =
                    EntityQuery.use(delegator)
                        .from("ContentDataResourceView")
                        .where("contentId", contentId, "drDataResourceTypeId", "ELECTRONIC_TEXT")
                        .cache(true)
                        .queryList();
                for (GenericValue contentDataResourceView : contentDataResourceViews) {
                  GenericValue ElectronicText =
                      contentDataResourceView.getRelatedOne("ElectronicText", true);
                  if (UtilValidate.isNotEmpty(ElectronicText)) {
                    String textData = (String) ElectronicText.get("textData");
                    if (UtilValidate.isNotEmpty(textData)) {
                      textData = UrlServletHelper.invalidCharacter(textData);
                      if (alternativeUrl.matches(textData + ".+$")) {
                        String productCategoryStr = null;
                        productCategoryStr = alternativeUrl.replace(textData + "-", "");
                        productCategoryStr = productCategoryStr.replace("-c", "");
                        String checkProductCategoryId =
                            (String) productCategoryContentInfo.get("productCategoryId");
                        if (productCategoryStr.equalsIgnoreCase(checkProductCategoryId)) {
                          productCategoryId = checkProductCategoryId;
                          break;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }

      } catch (GenericEntityException e) {
        Debug.logWarning("Cannot look for product and product category", module);
      }

      // generate forward URL
      StringBuilder urlBuilder = new StringBuilder();
      urlBuilder.append("/" + CONTROL_MOUNT_POINT);

      if (UtilValidate.isNotEmpty(productId)) {
        try {
          List<EntityCondition> conds = FastList.newInstance();
          conds.add(EntityCondition.makeCondition("productId", productId));
          conds.add(EntityUtil.getFilterByDateExpr());
          List<GenericValue> productCategoryMembers =
              EntityQuery.use(delegator)
                  .select("productCategoryId")
                  .from("ProductCategoryMember")
                  .where(conds)
                  .orderBy("-fromDate")
                  .cache(true)
                  .queryList();
          if (UtilValidate.isNotEmpty(productCategoryMembers)) {
            GenericValue productCategoryMember = EntityUtil.getFirst(productCategoryMembers);
            productCategoryId = productCategoryMember.getString("productCategoryId");
          }
        } catch (GenericEntityException e) {
          Debug.logError(e, "Cannot find product category for product: " + productId, module);
        }
        urlBuilder.append("/" + PRODUCT_REQUEST);

      } else {
        urlBuilder.append("/" + CATEGORY_REQUEST);
      }

      // generate trail belong to a top category
      String topCategoryId = CategoryWorker.getCatalogTopCategory(httpRequest, null);
      List<GenericValue> trailCategories =
          CategoryWorker.getRelatedCategoriesRet(
              httpRequest, "trailCategories", topCategoryId, false, false, true);
      List<String> trailCategoryIds =
          EntityUtil.getFieldListFromEntityList(trailCategories, "productCategoryId", true);

      // look for productCategoryId from productId
      if (UtilValidate.isNotEmpty(productId)) {
        try {
          List<EntityCondition> rolllupConds = FastList.newInstance();
          rolllupConds.add(EntityCondition.makeCondition("productId", productId));
          rolllupConds.add(EntityUtil.getFilterByDateExpr());
          List<GenericValue> productCategoryMembers =
              EntityQuery.use(delegator)
                  .from("ProductCategoryMember")
                  .where(rolllupConds)
                  .orderBy("-fromDate")
                  .cache(true)
                  .queryList();
          for (GenericValue productCategoryMember : productCategoryMembers) {
            String trailCategoryId = productCategoryMember.getString("productCategoryId");
            if (trailCategoryIds.contains(trailCategoryId)) {
              productCategoryId = trailCategoryId;
              break;
            }
          }
        } catch (GenericEntityException e) {
          Debug.logError(e, "Cannot generate trail from product category", module);
        }
      }

      // generate trail elements from productCategoryId
      if (UtilValidate.isNotEmpty(productCategoryId)) {
        List<String> trailElements = FastList.newInstance();
        trailElements.add(productCategoryId);
        String parentProductCategoryId = productCategoryId;
        while (UtilValidate.isNotEmpty(parentProductCategoryId)) {
          // find product category rollup
          try {
            List<EntityCondition> rolllupConds = FastList.newInstance();
            rolllupConds.add(
                EntityCondition.makeCondition("productCategoryId", parentProductCategoryId));
            rolllupConds.add(EntityUtil.getFilterByDateExpr());
            List<GenericValue> productCategoryRollups =
                EntityQuery.use(delegator)
                    .from("ProductCategoryRollup")
                    .where(rolllupConds)
                    .orderBy("-fromDate")
                    .cache(true)
                    .queryList();
            if (UtilValidate.isNotEmpty(productCategoryRollups)) {
              // add only categories that belong to the top category to trail
              for (GenericValue productCategoryRollup : productCategoryRollups) {
                String trailCategoryId = productCategoryRollup.getString("parentProductCategoryId");
                parentProductCategoryId = trailCategoryId;
                if (trailCategoryIds.contains(trailCategoryId)) {
                  trailElements.add(trailCategoryId);
                  break;
                }
              }
            } else {
              parentProductCategoryId = null;
            }
          } catch (GenericEntityException e) {
            Debug.logError(e, "Cannot generate trail from product category", module);
          }
        }
        Collections.reverse(trailElements);

        List<String> trail = CategoryWorker.getTrail(httpRequest);
        if (trail == null) {
          trail = FastList.newInstance();
        }

        // adjust trail
        String previousCategoryId = null;
        if (trail.size() > 0) {
          previousCategoryId = trail.get(trail.size() - 1);
        }
        trail = CategoryWorker.adjustTrail(trail, productCategoryId, previousCategoryId);

        if (trailElements.size() == 1) {
          CategoryWorker.setTrail(request, trailElements.get(0), null);
        } else if (trailElements.size() == 2) {
          CategoryWorker.setTrail(request, trailElements.get(1), trailElements.get(0));
        } else if (trailElements.size() > 2) {
          if (trail.contains(trailElements.get(0))) {
            // first category is in the trail, so remove it everything after that and fill it in
            // with the list from the pathInfo
            int firstElementIndex = trail.indexOf(trailElements.get(0));
            while (trail.size() > firstElementIndex) {
              trail.remove(firstElementIndex);
            }
            trail.addAll(trailElements);
          } else {
            // first category is NOT in the trail, so clear out the trail and use the trailElements
            // list
            trail.clear();
            trail.addAll(trailElements);
          }
          CategoryWorker.setTrail(request, trail);
        }

        request.setAttribute("productCategoryId", productCategoryId);

        if (productId != null) {
          request.setAttribute("product_id", productId);
          request.setAttribute("productId", productId);
        }
      }

      // Set view query parameters
      UrlServletHelper.setViewQueryParameters(request, urlBuilder);
      if (UtilValidate.isNotEmpty(productId)
          || UtilValidate.isNotEmpty(productCategoryId)
          || UtilValidate.isNotEmpty(urlContentId)) {
        Debug.logInfo("[Filtered request]: " + pathInfo + " (" + urlBuilder + ")", module);
        ContextFilter.setAttributesFromRequestBody(request);
        RequestDispatcher dispatch = request.getRequestDispatcher(urlBuilder.toString());
        dispatch.forward(request, response);
        return;
      }

      // Check path alias
      UrlServletHelper.checkPathAlias(request, httpResponse, delegator, pathInfo);
    }

    // we're done checking; continue on
    chain.doFilter(request, response);
  }
Ejemplo n.º 7
0
  public static void setViewQueryParameters(ServletRequest request, StringBuilder urlBuilder) {
    HttpServletRequest httpRequest = (HttpServletRequest) request;
    if (UtilValidate.isEmpty(httpRequest.getServletPath())) {
      return;
    }
    String pathInfo = httpRequest.getServletPath();
    String viewIndex = null;
    String viewSize = null;
    String viewSort = null;
    String searchString = null;

    int queryStringIndex = pathInfo.indexOf("?");
    if (queryStringIndex >= 0) {
      List<String> queryStringTokens =
          StringUtil.split(pathInfo.substring(queryStringIndex + 1), "&");
      for (String queryStringToken : queryStringTokens) {
        int equalIndex = queryStringToken.indexOf("=");
        String name = queryStringToken.substring(0, equalIndex - 1);
        String value = queryStringToken.substring(equalIndex + 1, queryStringToken.length() - 1);

        if ("viewIndex".equals(name)) {
          viewIndex = value;
        } else if ("viewSize".equals(name)) {
          viewSize = value;
        } else if ("viewSort".equals(name)) {
          viewSort = value;
        } else if ("searchString".equals(name)) {
          searchString = value;
        }
      }
    }

    if (UtilValidate.isNotEmpty(httpRequest.getParameter("viewIndex"))) {
      viewIndex = httpRequest.getParameter("viewIndex");
    }
    if (UtilValidate.isNotEmpty(httpRequest.getParameter("viewSize"))) {
      viewSize = httpRequest.getParameter("viewSize");
    }
    if (UtilValidate.isNotEmpty(httpRequest.getParameter("viewSort"))) {
      viewSort = httpRequest.getParameter("viewSort");
    }
    if (UtilValidate.isNotEmpty(httpRequest.getParameter("searchString"))) {
      searchString = httpRequest.getParameter("searchString");
    }

    // Set query string parameters to url
    if (UtilValidate.isNotEmpty(viewIndex)) {
      urlBuilder.append("/~VIEW_INDEX=" + viewIndex);
      request.setAttribute("VIEW_INDEX", viewIndex);
    }
    if (UtilValidate.isNotEmpty(viewSize)) {
      urlBuilder.append("/~VIEW_SIZE=" + viewSize);
      request.setAttribute("VIEW_SIZE", viewSize);
    }
    if (UtilValidate.isNotEmpty(viewSort)) {
      urlBuilder.append("/~VIEW_SORT=" + viewSort);
      request.setAttribute("VIEW_SORT", viewSort);
    }
    if (UtilValidate.isNotEmpty(searchString)) {
      urlBuilder.append("/~SEARCH_STRING=" + searchString);
      request.setAttribute("SEARCH_STRING", searchString);
    }
  }