Class UserProfileAvatarResource
java.lang.Object
com.atlassian.bamboo.plugins.rest.resource.UserProfileAvatarResource
@Path("avatar/user")
@Consumes("*/*")
@Produces("*/*")
@Singleton
public class UserProfileAvatarResource
extends Object
-
Field Summary
-
Constructor Summary
ConstructorDescriptionUserProfileAvatarResource
(BambooUserManager userManager, AvatarService avatarService, HigherOrderAvatarProvider higherOrderAvatarProvider, RestAuthenticationContext restAuthenticationContext) -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
javax.ws.rs.core.Response
retrieveAvatar
(String userName, int size, javax.servlet.http.HttpServletRequest request) protected javax.ws.rs.core.Response
streamAvatar
(CacheableAvatarSupplier supplier, javax.servlet.http.HttpServletRequest request) Streams the providedavatar
, automatically handling "If-Modified-Since" and "Last-Modified" headers to encourage browsers to cache avatars.javax.ws.rs.core.Response
uploadAvatar
(com.atlassian.plugins.rest.api.multipart.FilePart file)
-
Field Details
-
LAST_MODIFIED_DATE_FORMAT
-
-
Constructor Details
-
UserProfileAvatarResource
@Inject public UserProfileAvatarResource(BambooUserManager userManager, AvatarService avatarService, HigherOrderAvatarProvider higherOrderAvatarProvider, RestAuthenticationContext restAuthenticationContext)
-
-
Method Details
-
retrieveAvatar
@GET @Path("{userName}/avatar.png") public javax.ws.rs.core.Response retrieveAvatar(@PathParam("userName") String userName, @QueryParam("s") @DefaultValue("256") int size, @Context javax.servlet.http.HttpServletRequest request) -
uploadAvatar
@PUT @Path("avatar.png") @Consumes("multipart/form-data") public javax.ws.rs.core.Response uploadAvatar(com.atlassian.plugins.rest.api.multipart.FilePart file) -
deleteAvatar
@DELETE @Path("avatar.png") public javax.ws.rs.core.Response deleteAvatar() -
streamAvatar
protected javax.ws.rs.core.Response streamAvatar(CacheableAvatarSupplier supplier, javax.servlet.http.HttpServletRequest request) Streams the providedavatar
, automatically handling "If-Modified-Since" and "Last-Modified" headers to encourage browsers to cache avatars.- Parameters:
supplier
- a supplier providing access to the avatar data to streamrequest
- the HTTP request to retrieve the avatar- Throws:
IOException
- if the avatar cannot be read from the provided supplier, or written to the provided response
-