java.lang.Object
com.cloudbees.jenkins.plugins.bitbucket.avatars.AvatarCache
All Implemented Interfaces:
ExtensionPoint, Action, ModelObject, RootAction, UnprotectedRootAction

@Extension public class AvatarCache extends Object implements UnprotectedRootAction
An avatar cache that will serve URLs that have been recently registered through buildUrl(String, String).
Since:
2.2.0
  • Constructor Details

    • AvatarCache

      public AvatarCache()
      Constructor.
  • Method Details

    • buildUrl

      public static String buildUrl(@NonNull String url, @NonNull String size)
      Builds the URL for the cached avatar image of the required size.
      Parameters:
      url - the URL of the source avatar image.
      size - the size of the image.
      Returns:
      the URL of the cached image.
      Throws:
      IllegalStateException - if called outside of a request handling thread.
    • buildUrl

      public static String buildUrl(@NonNull AvatarCacheSource source, @NonNull String size)
      Builds the URL for the cached avatar image of the required size.
      Parameters:
      source - source avatar image definition.
      size - the size of the image.
      Returns:
      the URL of the cached image.
      Throws:
      IllegalStateException - if called outside of a request handling thread.
    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • doDynamic

      public org.kohsuke.stapler.HttpResponse doDynamic(org.kohsuke.stapler.StaplerRequest req, @QueryParameter String requestedSize)
      Serves the cached image.
      Parameters:
      req - the request.
      requestedSize - the requested size (defaults to 48x48 if unspecified).
      Returns:
      the response.