public final class ExpiryCheckHandler
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXPIRE_AFTER_HEADER |
static java.lang.String |
QUEUE_EXPIRE_AFTER_HEADER |
static java.lang.String |
SERVER_TIMESTAMP_HEADER |
| Modifier and Type | Method and Description |
|---|---|
static org.joda.time.LocalDateTime |
getActualTime()
Returns the actual datetime.
|
static org.joda.time.LocalDateTime |
getExpirationTime(int expireAfter)
Returns the expiration time, based on the actual time
in addition with the expireAfter value.
|
static org.joda.time.LocalDateTime |
getExpirationTime(java.lang.String serverTimestamp,
int expireAfter)
Returns the expiration time based on the given timestamp
in addition with the expireAfter value.
|
static java.lang.Integer |
getExpireAfter(io.vertx.core.MultiMap headers)
Extracts the value of the "X-Expire-After" header.
|
static java.lang.Integer |
getQueueExpireAfter(io.vertx.core.MultiMap headers)
Extracts the value of the "x-queue-expire-after" header.
|
static boolean |
isExpired(org.swisspush.gateleen.core.http.HttpRequest request)
Checks if the given request has expired or not.
|
static boolean |
isExpired(io.vertx.core.http.HttpServerRequest request)
Checks if the given request has expired or not.
|
static boolean |
isExpired(io.vertx.core.MultiMap headers)
Checks the expiration based on the given headers.
|
static boolean |
isExpired(io.vertx.core.MultiMap headers,
java.lang.Long timestamp)
Checks the expiration based on the given headers and a timstamp in milliseconds.
|
static org.joda.time.LocalDateTime |
parseDateTime(java.lang.String datetime)
Parses the given string to a LocalDateTime object.
|
static java.lang.String |
printDateTime(org.joda.time.LocalDateTime datetime)
Prints the given datetime as a string.
|
static void |
setExpireAfter(org.swisspush.gateleen.core.http.HttpRequest request,
int expireAfter)
Sets an "X-Expire-After" header.
|
static void |
setExpireAfter(io.vertx.core.http.HttpServerRequest request,
int expireAfter)
Sets an "X-Expire-After" header.
|
static void |
setExpireAfter(io.vertx.core.MultiMap headers,
int expireAfter)
Sets an "X-Expire-After" header.
|
static void |
setQueueExpireAfter(org.swisspush.gateleen.core.http.HttpRequest request,
int queueExpireAfter)
Sets an "x-queue-expire-after" header.
|
static void |
setQueueExpireAfter(io.vertx.core.http.HttpServerRequest request,
int queueExpireAfter)
Sets an "x-queue-expire-after" header.
|
static void |
setQueueExpireAfter(io.vertx.core.MultiMap headers,
int queueExpireAfter)
Sets an "x-queue-expire-after" header.
|
static void |
updateServerTimestampHeader(org.swisspush.gateleen.core.http.HttpRequest request)
Checks if a "X-Server-Timestamp" header is set or not.
|
static void |
updateServerTimestampHeader(io.vertx.core.http.HttpServerRequest 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 java.lang.String SERVER_TIMESTAMP_HEADER
public static final java.lang.String EXPIRE_AFTER_HEADER
public static final java.lang.String QUEUE_EXPIRE_AFTER_HEADER
public static void updateServerTimestampHeader(org.swisspush.gateleen.core.http.HttpRequest request)
request - requestpublic static void updateServerTimestampHeader(io.vertx.core.http.HttpServerRequest request)
request - requestpublic static void updateServerTimestampHeader(io.vertx.core.MultiMap headers)
headers - headerspublic static java.lang.Integer getExpireAfter(io.vertx.core.MultiMap headers)
headers - headerspublic static java.lang.Integer getQueueExpireAfter(io.vertx.core.MultiMap headers)
headers - headerspublic static boolean isExpired(org.swisspush.gateleen.core.http.HttpRequest request)
false is returned.request - requestpublic static boolean isExpired(io.vertx.core.http.HttpServerRequest request)
false is returned.request - requestpublic static boolean isExpired(io.vertx.core.MultiMap headers)
false
is returned.headers - headerspublic static boolean isExpired(io.vertx.core.MultiMap headers,
java.lang.Long timestamp)
headers - headerspublic static org.joda.time.LocalDateTime getActualTime()
public static org.joda.time.LocalDateTime getExpirationTime(int expireAfter)
expireAfter - - in secondspublic static org.joda.time.LocalDateTime getExpirationTime(java.lang.String serverTimestamp,
int expireAfter)
serverTimestamp - serverTimestampexpireAfter - - in secondspublic static org.joda.time.LocalDateTime parseDateTime(java.lang.String datetime)
datetime - datetimepublic static java.lang.String printDateTime(org.joda.time.LocalDateTime datetime)
datetime - datetimepublic static void setQueueExpireAfter(org.swisspush.gateleen.core.http.HttpRequest request,
int queueExpireAfter)
request - requestqueueExpireAfter - expireAfterpublic static void setExpireAfter(org.swisspush.gateleen.core.http.HttpRequest request,
int expireAfter)
request - requestexpireAfter - expireAfterpublic static void setQueueExpireAfter(io.vertx.core.http.HttpServerRequest request,
int queueExpireAfter)
request - requestqueueExpireAfter - expireAfterpublic 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 - queueExpireAfterpublic static void setExpireAfter(io.vertx.core.MultiMap headers,
int expireAfter)
headers - headersexpireAfter - expireAfter