public final class ExpiryCheckHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
EXPIRE_AFTER_HEADER |
static String |
QUEUE_EXPIRE_AFTER_HEADER |
static String |
SERVER_TIMESTAMP_HEADER |
| Modifier and Type | Method and Description |
|---|---|
static org.joda.time.DateTime |
getExpirationTime(int expireAfter)
Returns the expiration time, based on the current time (now)
in addition with the expireAfter value.
|
static Optional<String> |
getExpirationTimeAsString(int expireAfter) |
static Integer |
getExpireAfter(io.vertx.core.MultiMap headers)
Extracts the value of the "X-Expire-After" header.
|
static Optional<Integer> |
getExpireAfterConcerningCaseOfCorruptHeaderAndInfinite(io.vertx.core.MultiMap headers)
Delegates to
getExpireValue(String)
This is extended version of getExpireAfter(MultiMap) but also
returning -1 for infinite. |
static Integer |
getQueueExpireAfter(io.vertx.core.MultiMap headers)
Extracts the value of the "x-queue-expire-after" header.
|
static boolean |
isExpired(io.vertx.core.MultiMap headers,
Long timestamp)
Checks the expiration based on the given headers and a timstamp in milliseconds.
|
static org.joda.time.DateTime |
parseDateTime(String datetime)
Parses the given string to a DateTime object.
|
static String |
printDateTime(org.joda.time.DateTime datetime)
Prints the given datetime as a string.
|
static void |
setExpireAfter(io.vertx.core.http.HttpServerRequest request,
int expireAfter)
Sets an "X-Expire-After" header.
|
static void |
setQueueExpireAfter(io.vertx.core.MultiMap headers,
int queueExpireAfter)
Sets an "x-queue-expire-after" header.
|
static void |
updateServerTimestampHeader(HttpRequest request)
Checks if a "X-Server-Timestamp" header is set or not.
|
static void |
updateServerTimestampHeader(io.vertx.core.MultiMap headers)
Checks if a "X-Server-Timestamp" header is set or not.
|
public static final String SERVER_TIMESTAMP_HEADER
public static final String EXPIRE_AFTER_HEADER
public static final String QUEUE_EXPIRE_AFTER_HEADER
public static void updateServerTimestampHeader(HttpRequest request)
request - requestpublic static void updateServerTimestampHeader(io.vertx.core.MultiMap headers)
headers - headerspublic static Integer getExpireAfter(io.vertx.core.MultiMap headers)
headers - headerspublic static Optional<Integer> getExpireAfterConcerningCaseOfCorruptHeaderAndInfinite(io.vertx.core.MultiMap headers)
getExpireValue(String)
This is extended version of getExpireAfter(MultiMap) but also
returning -1 for infinite.headers - Headers to fetch value from.The parsed expire-after value.
Returns empty in case getExpireValue(String) returned null.
public static Integer getQueueExpireAfter(io.vertx.core.MultiMap headers)
headers - headerspublic static boolean isExpired(io.vertx.core.MultiMap headers,
Long timestamp)
headers - headerspublic static org.joda.time.DateTime getExpirationTime(int expireAfter)
expireAfter - - in secondspublic static Optional<String> getExpirationTimeAsString(int expireAfter)
public static org.joda.time.DateTime parseDateTime(String datetime)
datetime - datetime as stringpublic static String printDateTime(org.joda.time.DateTime datetime)
datetime - datetimepublic static void setExpireAfter(io.vertx.core.http.HttpServerRequest request,
int expireAfter)
request - requestexpireAfter - expireAfterpublic static void setQueueExpireAfter(io.vertx.core.MultiMap headers,
int queueExpireAfter)
headers - headersqueueExpireAfter - queueExpireAfterCopyright © 2016–2021. All rights reserved.