/** * This method is signing the URI with a policy to expire it. * * @param uri * the URI to sign * * @return the signed URI * @throws URISyntaxException * if the input URI contains syntax errors */ private URI sign(URI uri) throws URISyntaxException { String path = uri.toString(); if (urlSigningService != null && urlSigningService.accepts(path)) { try { String clientIP = null; if (signWithClientIP) { clientIP = securityService.getUserIP(); } path = urlSigningService.sign(path, expireSeconds, null, clientIP); } catch (UrlSigningException e) { logger.debug("Unable to sign url '" + path + "' so not adding a signed query string."); } } return new URI(path); }