Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface RequestAuthorizer.Proactive
ExtendsRequestAuthorizer
Known subtypesOidcRequestAuthorizer
An authorizer that can tell, before a request is sent, that its credential is about to stop working, and renew it first.
Without this a credential is renewed only after the service has refused it, which
costs one refused request for every credential that expires. An authorizer that
implements this is asked when a request is queued – on the event dispatch thread,
before the request reaches a network thread – and may hold the request until a new
credential is ready. The request is then queued as usual and
RequestAuthorizer.getAuthorization(ConnectionRequest) answers with the new one. A
401 is still handled as RequestAuthorizer describes; this only makes it rare.
Nothing waits on a thread for it: the request is simply not in the queue yet. Code that waits for the request waits a little longer, and sees one answer.
Methods
public abstract AsyncResource<Boolean> prepareAuthorization(ConnectionRequest request) | Called when a request this authorizer covers is queued, on the event dispatch thread. |
Inherited nested types
Inherited fields
Inherited methods
Method details
prepareAuthorization
public abstract AsyncResource<Boolean> prepareAuthorization(ConnectionRequest request)Called when a request this authorizer covers is queued, on the event dispatch thread. Answer from memory and do not block: start the renewal and return.
Several requests can be queued while one renewal runs. An implementation should renew once and hold them all on the same resource.
Parameters
requestConnectionRequest- the request being queued
Returns
RequestAuthorizer.getAuthorization(ConnectionRequest) answers
then