docs/docs-core/src/main/java/com/sismics/util/HttpUtil.java

28 lines
660 B
Java
Raw Normal View History

2013-07-27 18:33:20 +02:00
package com.sismics.util;
2017-11-23 15:32:20 +01:00
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
2013-07-27 18:33:20 +02:00
/**
* HTTP request utilities.
*
* @author jtremeaux
*/
public class HttpUtil {
/**
2017-11-23 15:32:20 +01:00
* Format of the expires header.
2013-07-27 18:33:20 +02:00
*/
2017-11-23 15:32:20 +01:00
private static final SimpleDateFormat EXPIRES_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
2013-07-27 18:33:20 +02:00
/**
2017-11-23 15:32:20 +01:00
* Build an Expires HTTP header.
*
* @param futureTime Expire interval
* @return Formatted header value
2013-07-27 18:33:20 +02:00
*/
2017-11-23 15:32:20 +01:00
public static String buildExpiresHeader(long futureTime) {
return EXPIRES_FORMAT.format(new Date().getTime() + futureTime);
2013-07-27 18:33:20 +02:00
}
}