public interface URLImage.RequestDecorator
Decorator hook applied to the ConnectionRequest that loads a
network-backed URLImage. Useful when the image endpoint sits
behind an Authorization: Bearer ... header, when you need to
override the user-agent, set a cookie, or anything else
ConnectionRequest exposes.
Two ways to install one:
Global default:
URLImage.setDefaultRequestDecorator(req -> req.addRequestHeader("Authorization", "Bearer " + token));– applies to everyURLImagefrom then on. This covers the common “all our images are private” case in one app-boot line.Per-image: use the
createToStorage(EncodedImage, String, String, ImageAdapter, RequestDecorator)overload. Per-instance decorators run after the global default, so the per-call decorator can override or augment headers set by the default.
Methods
public abstract void decorate(ConnectionRequest req) |
Method details
decorate
public abstract void decorate(ConnectionRequest req)