Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 2.03 KB

README_core.md

File metadata and controls

45 lines (33 loc) · 2.03 KB

gateleen-core

Storage

Resource expiration

Using the X-Expire-After request header, the expiration of a resource can be defined.

Creating resources

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

Consuming resources

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.

CORS Handling

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

Logging

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);