Package org.silverpeas.components.gallery.web

## Class GalleryResource

- java.lang.Object
- - org.silverpeas.core.web.rs.RESTWebService
  - - org.silverpeas.components.gallery.web.GalleryResource

- All Implemented Interfaces:
    `org.silverpeas.core.web.rs.ProtectedWebResource`, `org.silverpeas.core.web.rs.WebAuthenticationValidation`, `org.silverpeas.core.web.rs.WebAuthorizationValidation`, `org.silverpeas.core.web.SilverpeasWebResource`

      @WebService
      @Path("gallery/{componentInstanceId}")
      @Authorized
      public class GalleryResource
      extends org.silverpeas.core.web.rs.RESTWebService

  A REST Web resource giving gallery data.
  Author:
    Yohann Chastagnier

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.silverpeas.core.web.rs.RESTWebService

      `org.silverpeas.core.web.rs.RESTWebService.WebProcess<R extends Object>, org.silverpeas.core.web.rs.RESTWebService.WebTreatment<R extends Object>`

  - ### Field Summary

    - ### Fields inherited from class org.silverpeas.core.web.rs.RESTWebService

      `RESPONSE_HEADER_ARRAYSIZE`

    - ### Fields inherited from interface org.silverpeas.core.web.SilverpeasWebResource

      `BASE_PATH`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GalleryResource()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `AlbumEntity` | `getAlbum​(String albumId, MediaSort sort)` | Gets the JSON representation of an album.
    `String` | `getComponentId()` |
    `AbstractMediaEntity` | `getPhoto​(String albumId, String photoId)` | Gets the JSON representation of a photo.
    `javax.ws.rs.core.Response` | `getPhotoContent​(String photoId, String size, MediaResolution mediaResolution)` | Gets the content of a photo.
    `protected String` | `getResourceBasePath()` |
    `AbstractMediaEntity` | `getSound​(String albumId, String soundId)` | Gets the JSON representation of a sound.
    `javax.ws.rs.core.Response` | `getSoundContent​(String soundId)` | Gets the content of a sound.
    `org.jboss.resteasy.plugins.providers.html.View` | `getSoundEmbed​(String soundId)` | Gets the embed content of a sound.
    `AbstractMediaEntity` | `getStreaming​(String albumId, String streamingId)` | Gets the JSON representation of a streaming.
    `javax.ws.rs.core.Response` | `getStreamingProviderDataFromStreamingId​(String streamingId)` | Gets the provider data of a streaming from its url.
    `AbstractMediaEntity` | `getVideo​(String albumId, String videoId)` | Gets the JSON representation of a video.
    `javax.ws.rs.core.Response` | `getVideoContent​(String videoId)` | Gets the content of a video.
    `org.jboss.resteasy.plugins.providers.html.View` | `getVideoEmbed​(String videoId)` | Gets the embed centent of a video.
    `javax.ws.rs.core.Response` | `getVideoThumbnail​(String videoId, String size, String thumbnailId)` | Get the video thumbnail.

    - ### Methods inherited from class org.silverpeas.core.web.rs.RESTWebService

      `createWebResourceUri, fromPage, getBundle, getBundleLocation, getHighestUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getSilverpeasContext, getUri, getUser, getUserPreferences, getUserRoles, identifiedBy, identifiedBy, initContext, initWebResourceUri, isUserDefined, process`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.silverpeas.core.web.rs.ProtectedWebResource

      `validateUserAuthorization`

    - ### Methods inherited from interface org.silverpeas.core.web.rs.WebAuthenticationValidation

      `validateUserAuthentication`

- - ### Constructor Detail

    - #### GalleryResource

          public GalleryResource()

  - ### Method Detail

    - #### getAlbum

          @GET
          @Path("albums/{albumId}")
          @Produces("application/json")
          public AlbumEntity getAlbum​(@PathParam("albumId")
                                      String albumId,
                                      @QueryParam("sort")
                                      MediaSort sort)

      Gets the JSON representation of an album. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `albumId` - the identifier of the photo
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked photo.

    - #### getPhoto

          @GET
          @Path("albums/{albumId}/photos/{photoId}")
          @Produces("application/json")
          public AbstractMediaEntity getPhoto​(@PathParam("albumId")
                                              String albumId,
                                              @PathParam("photoId")
                                              String photoId)

      Gets the JSON representation of a photo. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `photoId` - the identifier of the photo
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked photo.

    - #### getVideo

          @GET
          @Path("albums/{albumId}/videos/{videoId}")
          @Produces("application/json")
          public AbstractMediaEntity getVideo​(@PathParam("albumId")
                                              String albumId,
                                              @PathParam("videoId")
                                              String videoId)

      Gets the JSON representation of a video. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `videoId` - the identifier of the video
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked video.

    - #### getSound

          @GET
          @Path("albums/{albumId}/sounds/{soundId}")
          @Produces("application/json")
          public AbstractMediaEntity getSound​(@PathParam("albumId")
                                              String albumId,
                                              @PathParam("soundId")
                                              String soundId)

      Gets the JSON representation of a sound. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `soundId` - the identifier of the sound
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked sound.

    - #### getStreaming

          @GET
          @Path("albums/{albumId}/streamings/{streamingId}")
          @Produces("application/json")
          public AbstractMediaEntity getStreaming​(@PathParam("albumId")
                                                  String albumId,
                                                  @PathParam("streamingId")
                                                  String streamingId)

      Gets the JSON representation of a streaming. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `streamingId` - the identifier of the streaming
      Returns:
        the response to the HTTP GET request with the JSON representation of the asked streaming.

    - #### getPhotoContent

          @GET
          @Path("photos/{photoId}/{size:([0-9]*x[0-9]*/)?}content")
          @Produces("image/*")
          public javax.ws.rs.core.Response getPhotoContent​(@PathParam("photoId")
                                                           String photoId,
                                                           @PathParam("size")
                                                           String size,
                                                           @QueryParam("resolution")
                                                           MediaResolution mediaResolution)

      Gets the content of a photo. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `photoId` - the identifier of the photo
        `size` - not used for the moment
      Returns:
        the response to the HTTP GET request content of the asked photo.

    - #### getVideoContent

          @GET
          @Path("videos/{videoId}/content")
          @Produces("application/octet-stream")
          public javax.ws.rs.core.Response getVideoContent​(@PathParam("videoId")
                                                           String videoId)

      Gets the content of a video. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `videoId` - the identifier of the video
      Returns:
        the response to the HTTP GET request content of the asked video.

    - #### getVideoThumbnail

          @GET
          @Path("videos/{videoId}/thumbnail/{size:([0-9]*x[0-9]*/)?}{thumbnailId}")
          @Produces("application/octet-stream")
          public javax.ws.rs.core.Response getVideoThumbnail​(@PathParam("videoId")
                                                             String videoId,
                                                             @PathParam("size")
                                                             String size,
                                                             @PathParam("thumbnailId")
                                                             String thumbnailId)

      Get the video thumbnail. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `videoId` - the identifier of the video
        `size` - not used for the moment
      Returns:
        the response to the HTTP GET request content of the asked video.

    - #### getSoundContent

          @GET
          @Path("sounds/{soundId}/content")
          @Produces("application/octet-stream")
          public javax.ws.rs.core.Response getSoundContent​(@PathParam("soundId")
                                                           String soundId)

      Gets the content of a sound. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `soundId` - the identifier of the sound
      Returns:
        the response to the HTTP GET request content of the asked sound.

    - #### getStreamingProviderDataFromStreamingId

          @GET
          @Path("streamings/{streamingId}/providerData")
          @Produces("application/json")
          public javax.ws.rs.core.Response getStreamingProviderDataFromStreamingId​(@PathParam("streamingId")
                                                                                   String streamingId)

      Gets the provider data of a streaming from its url. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `streamingId` - the identifier of the streaming
      Returns:
        the response to the HTTP GET request content of the asked streaming.

    - #### getVideoEmbed

          @GET
          @Path("videos/{videoId}/embed")
          public org.jboss.resteasy.plugins.providers.html.View getVideoEmbed​(@PathParam("videoId")
                                                                              String videoId)

      Gets the embed centent of a video. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `videoId` - the identifier of the video
      Returns:
        the response to the HTTP GET request embed centent of the asked video.

    - #### getSoundEmbed

          @GET
          @Path("sounds/{soundId}/embed")
          public org.jboss.resteasy.plugins.providers.html.View getSoundEmbed​(@PathParam("soundId")
                                                                              String soundId)

      Gets the embed content of a sound. If it doesn't exist, a 404 HTTP code is returned. If the user isn't authentified, a 401 HTTP code is returned. If a problem occurs when processing the request, a 503 HTTP code is returned.
      Parameters:
        `soundId` - the identifier of the sound
      Returns:
        the response to the HTTP GET request embed content of the asked sound.

    - #### getComponentId

          public String getComponentId()

    - #### getResourceBasePath

          protected String getResourceBasePath()

      Specified by:
        `getResourceBasePath` in class `org.silverpeas.core.web.rs.RESTWebService`