Class UserAvatarResource

java.lang.Object
de.unigoettingen.sub.commons.contentlib.servlet.rest.ContentServerResource
de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource
io.goobi.viewer.api.rest.v1.authentication.UserAvatarResource

@Path("/users/{userId}/avatar") public class UserAvatarResource extends de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource
Author:
florian
  • Nested Class Summary

    Nested classes/interfaces inherited from class de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource

    de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource.ImageStreamingOutput, de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource.PdfStreamingOutput

    Nested classes/interfaces inherited from class de.unigoettingen.sub.commons.contentlib.servlet.rest.ContentServerResource

    de.unigoettingen.sub.commons.contentlib.servlet.rest.ContentServerResource.ResourceStatus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected javax.servlet.http.HttpServletRequest
     
    protected javax.servlet.http.HttpServletResponse
     

    Fields inherited from class de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource

    BACKSLASH_REPLACEMENT, context, IIIF_VERSION, imageURI, PERCENT_REPLACEMENT, QUESTION_MARK_REPLACEMENT, request, REQUEST_ATTRIBUTE_ERROR, resourceURI, response, SLASH_REPLACEMENT

    Fields inherited from class de.unigoettingen.sub.commons.contentlib.servlet.rest.ContentServerResource

    MEDIA_TYPE_APPLICATION_JSONLD, REQUEST_TYPE_IMAGE, REQUEST_TYPE_METSPDF, REQUEST_TYPE_PDF, requestId, requestMap
  • Constructor Summary

    Constructors
    Constructor
    Description
    UserAvatarResource(javax.ws.rs.container.ContainerRequestContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Long userId)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    createResourceURI(javax.servlet.http.HttpServletRequest request, String directory, String filename)
     
    static Path
    getAvatarFilePath(String uploadFilename, Long userId)
     
    static String
     
    static URI
     
    static Optional<Path>
     
    static Path
     
    javax.ws.rs.core.Response
     
    static void
     
    javax.ws.rs.core.Response
    uploadAvatarFile(boolean enabled, String uploadFilename, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail)
     

    Methods inherited from class de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource

    addContentHeader, createImageURI, getCache, getCachedDate, getGif, getImage, getImageURI, getInfoAsJson, getInfoAsXml, getPdf, getPdf, getRequestedWidth, getResourceURI, getURIPrefix, isInCache, redirectToFullImage, redirectToFullImage, setImageURI, setInitializationException, setResourceURI, unescape

    Methods inherited from class de.unigoettingen.sub.commons.contentlib.servlet.rest.ContentServerResource

    checkMemoryOverflow, checkRequestOverflow, finishRequest, getNumCurrentFooterRequests, getNumCurrentImageRequests, getNumCurrentMetsPdfRequests, getNumCurrentRequests, getNumCurrentSinglePdfRequests, getRequestId, getStatus, remainingMemory, startRequest

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • servletRequest

      @Context protected javax.servlet.http.HttpServletRequest servletRequest
    • servletResponse

      @Context protected javax.servlet.http.HttpServletResponse servletResponse
  • Constructor Details

    • UserAvatarResource

      public UserAvatarResource(@Context javax.ws.rs.container.ContainerRequestContext context, @Context javax.servlet.http.HttpServletRequest request, @Context javax.servlet.http.HttpServletResponse response, @PathParam("userId") Long userId) throws javax.ws.rs.WebApplicationException, ViewerConfigurationException
      Throws:
      javax.ws.rs.WebApplicationException
      ViewerConfigurationException
  • Method Details

    • getMediaFileUrl

      public static URI getMediaFileUrl(Long userId) throws javax.ws.rs.WebApplicationException
      Parameters:
      userId -
      Returns:
      URI
      Throws:
      javax.ws.rs.WebApplicationException
    • getUserAvatarFolder

      public static Path getUserAvatarFolder()
    • getUserAvatarFile

      public static Optional<Path> getUserAvatarFile(Long userId) throws IOException
      Parameters:
      userId -
      Returns:
      Optional
      Throws:
      IOException
    • getAvatarFileSuffix

      public static String getAvatarFileSuffix(Long userId) throws IOException
      Throws:
      IOException
    • createResourceURI

      public void createResourceURI(javax.servlet.http.HttpServletRequest request, String directory, String filename) throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
      Overrides:
      createResourceURI in class de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException
    • redirectToCanonicalImageInfo

      @GET @Produces({"application/json","application/ld+json"}) public javax.ws.rs.core.Response redirectToCanonicalImageInfo() throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
      Overrides:
      redirectToCanonicalImageInfo in class de.unigoettingen.sub.commons.contentlib.servlet.rest.ImageResource
      Throws:
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException
    • uploadAvatarFile

      @POST @Consumes("multipart/form-data") @Produces("application/json") public javax.ws.rs.core.Response uploadAvatarFile(@DefaultValue("true") boolean enabled, String uploadFilename, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail)
    • getAvatarFilePath

      public static Path getAvatarFilePath(String uploadFilename, Long userId)
    • removeFromImageCache

      public static void removeFromImageCache(Path file)