public class GravatarServiceImpl extends Object implements GravatarService
This class is thread-safe, Gravatar objects can be shared.
Currently this service is set to only allow images for general audiences and the Default image is hardcoded.
DEFAULT_GRAVATAR_URL
Constructor and Description |
---|
GravatarServiceImpl(AdministrationConfigurationPersister administrationConfigurationPersister,
AdministrationConfigurationAccessor administrationConfigurationAccessor) |
Modifier and Type | Method and Description |
---|---|
byte[] |
download(String email,
int size)
Downloads the gravatar for the given URL using Java
URL and returns a byte array containing the gravatar
jpg, returns null if no gravatar was found. |
String |
getDefaultGravatarUrl(int size)
Returns the url for the default gravatar.
|
String |
getGravatarServerUrl() |
String |
getGravatarUrl(String email)
Returns A gravatar for the given emails with the default size of 25 pixels.
|
String |
getGravatarUrl(String email,
int size) |
boolean |
isGravatarSupportEnabled() |
void |
setGravatarSupported(boolean enabled,
String newUrl)
Updates whether or not gravatars are enabled for this Bamboo instance
|
public GravatarServiceImpl(AdministrationConfigurationPersister administrationConfigurationPersister, AdministrationConfigurationAccessor administrationConfigurationAccessor)
@Nullable public String getGravatarUrl(@Nullable String email, int size)
getGravatarUrl
in interface GravatarService
email
- to get gravatar url forsize
- Specify a gravatar size between 1 and 512 pixels.@Nullable public String getGravatarUrl(@Nullable String email)
getGravatarUrl
in interface GravatarService
email
- to get gravatar url for@Nullable public String getDefaultGravatarUrl(int size)
getDefaultGravatarUrl
in interface GravatarService
size
- a gravatar size between 1 and 512 pixels.public byte[] download(String email, int size) throws GravatarDownloadException
URL
and returns a byte array containing the gravatar
jpg, returns null if no gravatar was found.email
- to get gravatar forsize
- a gravatar size between 1 and 512 pixels.GravatarDownloadException
- if something goes wrong...public void setGravatarSupported(boolean enabled, @NotNull String newUrl)
setGravatarSupported
in interface GravatarService
enabled
- whether its enabled or notnewUrl
- the URL of the Gravatar server the user wants to usepublic boolean isGravatarSupportEnabled()
isGravatarSupportEnabled
in interface GravatarService
@NotNull public String getGravatarServerUrl()
getGravatarServerUrl
in interface GravatarService
Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.