Interface URLImage.RequestDecorator

Enclosing class:
URLImage

public static 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 every URLImage from 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.

  • Method Summary

    Modifier and Type
    Method
    Description
    void