public class MailAttachmentsManagerImpl extends Object implements MailAttachmentsManager
CID_PREFIX| Modifier and Type | Method and Description |
|---|---|
String |
addAttachmentAndReturnCid(MailAttachment mailAttachment)
Adds an attachment to the mail attachments manager's collection of attachments.
|
Iterable<javax.mail.BodyPart> |
buildAttachmentsBodyParts()
Builds bodyPart for each image (including avatars) added to this manager
|
protected String |
getAbsoluteUrl(String path) |
int |
getAttachmentsCount()
Returns the number of attachments added to this manager
|
String |
getAvatarUrl(ApplicationUser user)
Returns a link to access user avatar in email message.
|
String |
getAvatarUrl(Avatar avatar,
Avatar.Size size,
String avatarOwnerDescription)
Returns a link to access
Avatar (icon for project or some other entity in Jira) in email message. |
String |
getAvatarUrl(String username)
Returns a link to access user avatar in email message.
|
String |
getAvatarUrl(TemplateUser templateUser)
Returns a link to access user avatar in email message.
|
String |
getExternalImageUrl(String path)
If the path is a relative url tries to add the image specified as an attachment.
|
String |
getImageUrl(String path)
Tries to inline image specified by path and add it to email attachments or add JWT token
|
String |
getIssueTypeIconUrl(IssueType issueType) |
boolean |
hasSecuredImage()
Needed to attach/or not
Use only after
MailAttachmentsManager.inlineImages(String) as it will count found images in rendered html. |
String |
inlineImages(String html) |
String |
processImages(String html)
- Looks for
|
String |
removeBaseUrl(String url)
Tries to remove the baseUrl (eg: http://example.com/jira) or the basePath (/jira) from an URL, and return the
result.
|
static MailAttachmentsManagerImpl |
withJwtTokens(AvatarService avatarService,
AvatarTranscoder avatarTranscoder,
UserManager userManager,
AvatarManager avatarManager,
ApplicationProperties applicationProperties,
ImageAttachmentJwtTokenService imageAttachmentJwtTokenService,
ImageAttachmentAltAttributeService imageAttachmentAltAttributeService,
String recipientUserName)
Created this way it will try to add JWT tokens to secured image paths.
|
static MailAttachmentsManagerImpl |
withoutJwtTokens(AvatarService avatarService,
AvatarTranscoder avatarTranscoder,
UserManager userManager,
AvatarManager avatarManager,
ApplicationProperties applicationProperties,
ImageAttachmentJwtTokenService imageAttachmentJwtTokenService,
ImageAttachmentAltAttributeService imageAttachmentAltAttributeService)
Created this way it won't try to add JWT tokens to secured image paths.
|
public static MailAttachmentsManagerImpl withoutJwtTokens(AvatarService avatarService, AvatarTranscoder avatarTranscoder, UserManager userManager, AvatarManager avatarManager, ApplicationProperties applicationProperties, ImageAttachmentJwtTokenService imageAttachmentJwtTokenService, ImageAttachmentAltAttributeService imageAttachmentAltAttributeService)
public static MailAttachmentsManagerImpl withJwtTokens(AvatarService avatarService, AvatarTranscoder avatarTranscoder, UserManager userManager, AvatarManager avatarManager, ApplicationProperties applicationProperties, ImageAttachmentJwtTokenService imageAttachmentJwtTokenService, ImageAttachmentAltAttributeService imageAttachmentAltAttributeService, String recipientUserName)
public String getAvatarUrl(String username)
MailAttachmentsManagergetAvatarUrl in interface MailAttachmentsManagerpublic String getAvatarUrl(TemplateUser templateUser)
MailAttachmentsManagergetAvatarUrl in interface MailAttachmentsManagerpublic String getAvatarUrl(ApplicationUser user)
MailAttachmentsManagergetAvatarUrl in interface MailAttachmentsManagerpublic String getAvatarUrl(@Nonnull Avatar avatar, @Nonnull Avatar.Size size, String avatarOwnerDescription)
MailAttachmentsManagerAvatar (icon for project or some other entity in Jira) in email message.getAvatarUrl in interface MailAttachmentsManageravatar - Avatar to display in emailsize - avatar sizeavatarOwnerDescription - Description of avatarpublic String addAttachmentAndReturnCid(MailAttachment mailAttachment)
MailAttachmentsManageraddAttachmentAndReturnCid in interface MailAttachmentsManagerpublic String getImageUrl(String path)
MailAttachmentsManagergetImageUrl in interface MailAttachmentsManagerpublic String processImages(String html)
MailAttachmentsManager
- Looks for tags and tries to inline image if it's an internal resource.
Otherwise adds JWT token for every /secure/* image or leaves unchanged for other paths.
- Counts how many images there are that start with /secure/* so MailAttachmentsManager.hasSecuredImage() can calculate the result needed to construct email footer
- Adds default 'alt' attribute which is an attachment file name in case img has none
processImages in interface MailAttachmentsManagerhtml - HTML to change.public String inlineImages(String html)
inlineImages in interface MailAttachmentsManagerpublic boolean hasSecuredImage()
MailAttachmentsManagerMailAttachmentsManager.inlineImages(String) as it will count found images in rendered html.hasSecuredImage in interface MailAttachmentsManagerpublic String removeBaseUrl(String url)
MailAttachmentsManager
removeBaseUrl in interface MailAttachmentsManagerurl - the url to remove the baseUrl frompublic String getExternalImageUrl(String path)
MailAttachmentsManagergetExternalImageUrl in interface MailAttachmentsManagerpublic int getAttachmentsCount()
MailAttachmentsManagergetAttachmentsCount in interface MailAttachmentsManagerpublic Iterable<javax.mail.BodyPart> buildAttachmentsBodyParts()
MailAttachmentsManagerbuildAttachmentsBodyParts in interface MailAttachmentsManagerCopyright © 2002-2021 Atlassian. All Rights Reserved.