Class FileServlet

java.lang.Object
io.github.qubitpi.athena.web.endpoints.FileServlet

@Singleton @Immutable @ThreadSafe @Path("/file") public class FileServlet extends Object
Endpoint for POSTing files.
  • Constructor Details

    • FileServlet

      @Inject public FileServlet(@NotNull @NotNull FileStore fileStore, @NotNull @NotNull MetaStore metaStore)
      DI constructor.
      Parameters:
      fileStore - A client connecting file data and persistence storage
      metaStore - A client connecting file metadata and persistence storage
      Throws:
      NullPointerException - if any argument is null
  • Method Details

    • uploadFile

      @POST @NotNull @Path("/upload") @Produces("application/json") @Consumes("multipart/form-data") public @NotNull jakarta.ws.rs.core.Response uploadFile(@NotNull @NotNull InputStream fileContent, @NotNull @NotNull org.glassfish.jersey.media.multipart.FormDataContentDisposition fileMetaData)
      Persists a file to object storage.
      Parameters:
      fileContent - The file content
      fileMetaData - The file metadata
      Returns:
      a Json object indicating whether the request is successful or not
      Throws:
      NullPointerException - if any argument is null
    • downloadFile

      @GET @NotNull @Path("/download") @Produces("application/octet-stream") public @NotNull jakarta.ws.rs.core.Response downloadFile(@QueryParam("fileId") String fileId)
      Retrieves a file from object storage.
      Parameters:
      fileId - The ID of the file previously uploaded.
      Returns:
      a file to be downloaded
      Throws:
      NullPointerException - if fileId is null