Class UserProfileAvatarResource


  • @Singleton
    public class UserProfileAvatarResource
    extends Object
    • Field Detail

      • LAST_MODIFIED_DATE_FORMAT

        public static final SimpleDateFormat LAST_MODIFIED_DATE_FORMAT
    • Method Detail

      • retrieveAvatar

        public javax.ws.rs.core.Response retrieveAvatar​(String userName,
                                                        int size,
                                                        @Context
                                                        com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext,
                                                        @Context
                                                        javax.servlet.http.HttpServletRequest request)
      • uploadAvatar

        public javax.ws.rs.core.Response uploadAvatar​(@Context
                                                      com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext,
                                                      com.atlassian.plugins.rest.common.multipart.FilePart file)
      • deleteAvatar

        public javax.ws.rs.core.Response deleteAvatar​(@Context
                                                      com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
      • streamAvatar

        protected javax.ws.rs.core.Response streamAvatar​(CacheableAvatarSupplier supplier,
                                                         javax.servlet.http.HttpServletRequest request)
        Streams the provided avatar, 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 stream
        request - 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