Beispiel #1
0
 @RequestMapping(value = "/get/offers", method = RequestMethod.GET)
 public @ResponseBody String getOffers(
     final HttpServletRequest request,
     final HttpServletResponse response,
     @RequestParam("label") String label,
     @RequestParam("pageNo") String pageNo)
     throws KUException {
   log.info("getting offers for :: " + label);
   List<String> labels = new ArrayList<String>();
   if (!StringUtil.isEmptyString(label)) {
     if (label.contains("-")) {
       labels.addAll(Arrays.asList(label.split("-")));
     } else {
       labels.add(label);
     }
   }
   if (!StringUtil.isEmptyString(pageNo)) {
     int endLimit = Integer.parseInt(pageNo) * Constants.OFFER_TO_LOAD;
     int startLimit = endLimit - Constants.OFFER_TO_LOAD;
     String content = offerManager.getOffersContent(labels, startLimit, Constants.OFFER_TO_LOAD);
     return content;
   } else {
     return "";
   }
 }
Beispiel #2
0
  @RequestMapping(value = "/page/{pageNo}", method = RequestMethod.GET)
  public ModelAndView showOffersPage(
      final HttpServletRequest request,
      final HttpServletResponse response,
      @PathVariable("pageNo") String pageNo)
      throws KUException {
    log.info("getting offers for :: page no " + pageNo);
    List<String> labels = new ArrayList<String>();

    // label = label.replaceAll("-", " ");
    Model model = new ExtendedModelMap();
    model.addAttribute("label", "");
    model.addAttribute("pageNo", pageNo);
    model.addAttribute("activeMenu", "offer-link");
    if (!StringUtil.isEmptyString(pageNo)) {
      int endLimit = Integer.parseInt(pageNo) * Constants.OFFER_TO_LOAD;
      int startLimit = endLimit - Constants.OFFER_TO_LOAD;
      model.addAttribute(
          "offers", offerManager.getOffersByLabels(labels, startLimit, Constants.OFFER_TO_LOAD));
    }
    return new ModelAndView("/ku/offers", model.asMap());
  }
Beispiel #3
0
 @RequestMapping(value = "/{label}", method = RequestMethod.GET)
 public ModelAndView showOffers(
     final HttpServletRequest request,
     final HttpServletResponse response,
     @PathVariable("label") String label)
     throws KUException {
   log.info("getting offers for :: " + label);
   List<String> labels = new ArrayList<String>();
   if (!StringUtil.isEmptyString(label)) {
     if (label.contains("-")) {
       labels.addAll(Arrays.asList(label.split("-")));
     } else {
       labels.add(label);
     }
   }
   // label = label.replaceAll("-", " ");
   Model model = new ExtendedModelMap();
   model.addAttribute("label", label);
   model.addAttribute("pageNo", 1);
   model.addAttribute("activeMenu", "offer-link");
   model.addAttribute(
       "offers", offerManager.getOffersByLabels(labels, 0, Constants.OFFER_TO_LOAD));
   Date now = new Date();
   SimpleDateFormat dt1 = new SimpleDateFormat("MMMMM d yyyy");
   String title =
       (label.contains("offer") || label.contains("coupon") || label.contains("deal")
               ? label.replace("-", " ")
               : label.replace("-", " ") + " offers, deals, coupons ")
           + " - "
           + dt1.format(now);
   model.addAttribute("pageTitle", title);
   String keywords = label;
   label = label.replaceAll("-", " ");
   if (!label.contains("offer") && !label.contains("coupon") && !label.contains("deal")) {
     keywords +=
         ", "
             + label
             + " offer, "
             + label
             + " coupon, "
             + label
             + ",  latest "
             + label
             + " offers, best "
             + label
             + " deals, new "
             + label
             + " coupons, today "
             + label
             + " offers";
   } else {
     keywords += ", latest " + label + ", best " + label + ", new " + label + ", today " + label;
   }
   model.addAttribute("metaKeywords", keywords);
   String description =
       " find latest "
           + (label.contains("offer") || label.contains("coupon") || label.contains("deal")
               ? label.replace("-", " ")
               : label.replace("-", " ") + " offers, deals, coupons ")
           + " which is verfied and updated frequently";
   model.addAttribute("metaDescription", description);
   return new ModelAndView("/ku/offers", model.asMap());
 }