1 24 package org.riotfamily.common.web.filter; 25 26 import java.text.SimpleDateFormat ; 27 import java.util.Date ; 28 29 import org.springframework.beans.factory.InitializingBean; 30 31 39 public class ResourceStamper implements InitializingBean { 40 41 public static final String DFAULT_TIME_PATTERN = "ddHHmm"; 42 43 private String timePattern = DFAULT_TIME_PATTERN; 44 45 private String time; 46 47 public void setTimePattern(String timePattern) { 48 this.timePattern = timePattern; 49 } 50 51 public void afterPropertiesSet() throws Exception { 52 SimpleDateFormat df = new SimpleDateFormat (timePattern); 53 time = "?" + df.format(new Date ()); 54 } 55 56 public String stamp(String url) { 57 if (url.indexOf('?') == -1) { 58 url += time; 59 } 60 return url; 61 } 62 63 } 64 | Popular Tags |