mirror of
https://github.com/sismics/docs.git
synced 2024-07-06 00:10:44 +02:00
28 lines
660 B
Java
28 lines
660 B
Java
package com.sismics.util;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Locale;
|
|
|
|
/**
|
|
* HTTP request utilities.
|
|
*
|
|
* @author jtremeaux
|
|
*/
|
|
public class HttpUtil {
|
|
/**
|
|
* Format of the expires header.
|
|
*/
|
|
private static final SimpleDateFormat EXPIRES_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
|
|
|
|
/**
|
|
* Build an Expires HTTP header.
|
|
*
|
|
* @param futureTime Expire interval
|
|
* @return Formatted header value
|
|
*/
|
|
public static String buildExpiresHeader(long futureTime) {
|
|
return EXPIRES_FORMAT.format(new Date().getTime() + futureTime);
|
|
}
|
|
}
|