public void setMaxLifetime(String maxLifetime) { if (StringUtils.isNumeric(maxLifetime)) { SessionManager.maxLifetime = Long.valueOf(maxLifetime); } else { SessionManager.maxLifetime = PropertyConverter.convertStringToTimeMillis(maxLifetime); } log.debug("Max lifetime set to {} ms", SessionManager.maxLifetime); }
/** * Quick time converter to keep our timestamps compatible with PHP's time() (seconds) * * @return time in seconds */ public static Integer getCurrentTimeSeconds() { return convertMillisToSeconds(System.currentTimeMillis()); }
/** * Generates a custom name containing numbers and an underscore ex. 282818_00023. The name contains current seconds and a random number component. * * @return custom name */ public static String generateCustomName() { Random random = new Random(); StringBuilder sb = new StringBuilder(); sb.append(PropertyConverter.getCurrentTimeSeconds()); sb.append('_'); int i = random.nextInt(99999); if (i < 10) { sb.append("0000"); } else if (i < 100) { sb.append("000"); } else if (i < 1000) { sb.append("00"); } else if (i < 10000) { sb.append('0'); } sb.append(i); return sb.toString(); }
/** * Quick time converter to keep our timestamps compatible with PHP's time() (seconds) * * @return time in seconds */ public static Integer getCurrentTimeSeconds() { return convertMillisToSeconds(System.currentTimeMillis()); }
/** * Generates a custom name containing numbers and an underscore ex. 282818_00023. The name contains current seconds and a random number component. * * @return custom name */ public static String generateCustomName() { Random random = new Random(); StringBuilder sb = new StringBuilder(); sb.append(PropertyConverter.getCurrentTimeSeconds()); sb.append('_'); int i = random.nextInt(99999); if (i < 10) { sb.append("0000"); } else if (i < 100) { sb.append("000"); } else if (i < 1000) { sb.append("00"); } else if (i < 10000) { sb.append('0'); } sb.append(i); return sb.toString(); }