Using the X-Expire-After request header, the expiration of a resource can be defined.
To define the expiration of a resource, add the X-Expire-After request header to the PUT request.
X-Expire-After: <seconds>
header value | Description |
---|---|
-1 | The resource never expires |
0 | The resource expires immediately |
> 0 | The resource will expire in the configured amount of seconds |
Information: When no X-Expire-After request header is provided, the resource will never expire
To consume (GET) resources, the client doesn't have to provide any parameters. When a resource is expired, it will no longer be returned and a 404 Not Found error will be returned instead.
To enable the headers for Cross-Origin Resource Sharing (CORS) requests, you have to set the following property:
org.swisspush.gateleen.addcorsheaders=true
See CORSHandler for more information
Besides the logging functionality provided by the logging module, the core module provides a logging utility called RequestLogger.
The RequestLogger can be used to log the payload of requests which are handled by special handlers and therefore will not be forwarded by the forwarder classes where the logging happens.
To use the RequestLogger simply call
RequestLogger.logRequest(vertx.eventBus(), request, status, buffer);
The RequestLogger uses the event bus to send the log entries to the logging module. Therefore, you have to instantiate the RequestLoggingConsumer by calling
RequestLoggingConsumer requestLoggingConsumer = new RequestLoggingConsumer(vertx, loggingResourceManager);