Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public interface RateLimitKeyResolver

Says which key a request counts under.

RateLimitKeyResolver tenant = request -> request.getHeader("X-Tenant");

Methods

public abstract String resolve(HttpServer.Request request)The key, or null when the request has none – nobody is signed in, it has no session – and the limit does not apply to it.
public default boolean needsAuthentication()Whether the key is known only once the request has been authenticated.

Method details

resolve

public abstract String resolve(HttpServer.Request request)
The key, or null when the request has none – nobody is signed in, it has no session – and the limit does not apply to it.

needsAuthentication

public default boolean needsAuthentication()
Whether the key is known only once the request has been authenticated. A limit whose key needs that is applied after sign-in; any other is applied first of all, before the request costs anything.