@RequestMapping(value = "/hash", method = RequestMethod.GET)
 public ResponseEntity<ShortURL> hash(
     @RequestParam(value = "hash") String hash, HttpServletRequest request) {
   logger.info("Requested shortURL from hash " + hash);
   ShortURL shortURL = null;
   if (hash != null && !hash.equals("")) {
     shortURL = shortURLRepositoryExtended.findByKey(hash);
   }
   if (shortURL != null) {
     return new ResponseEntity<>(shortURL, HttpStatus.CREATED);
   } else {
     return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
   }
 }
  @RequestMapping(value = "/{name:(?!link|home|login|users|advert).*}", method = RequestMethod.GET)
  public ResponseEntity<?> redirectTo(@PathVariable String name, HttpServletRequest request) {
    logger.info("Requested redirection with hash " + name);
    ShortURL l = shortURLRepositoryExtended.findByKey(name);
    if (l != null) {
      createAndSaveClick(extractIP(request), name);

      String conditionalTarget = exprMatching(name, request, l.getTarget());
      if (conditionalTarget != null) l.setTarget(conditionalTarget);

      return createSuccessfulRedirectToResponse(l);
    } else {
      return new ResponseEntity<>(HttpStatus.NOT_FOUND);
    }
  }