Exemplo n.º 1
0
 @RequestMapping(value = "{tinyUrl}", method = RequestMethod.GET)
 public ModelAndView redirect(
     @PathVariable("tinyUrl") String tinyUrl, RedirectAttributes redirectAttrs)
     throws ClipAppException {
   String longUrl = null;
   try {
     longUrl = extenderService.extend(tinyUrl);
   } catch (ClipAppException e) {
     redirectAttrs.addFlashAttribute(TINY_URL_PARAM, tinyUrl);
     return new ModelAndView("redirect:/");
   }
   return new ModelAndView("redirect:" + longUrl);
 }
Exemplo n.º 2
0
 @RequestMapping(value = "{tinyUrl}", method = RequestMethod.POST)
 public @ResponseBody String unclip(@PathVariable("tinyUrl") String tinyUrl)
     throws ClipAppException {
   return extenderService.extend(tinyUrl);
 }