Class ObjectResource
java.lang.Object
io.goobi.viewer.api.rest.v1.records.media.ObjectResource
JAX-RS resource that serves 3D object files (scene, auxiliary files, and scene-info JSON) for a given record.
Endpoints are bound under the
RECORDS_FILES_3D path and enforce access-condition checks; scene metadata
can also be written back via PUT requests by authenticated admins.- Author:
- Florian Alpers
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionObjectResource(ContainerRequestContext context, HttpServletRequest request, HttpServletResponse response, String pi, String filename) -
Method Summary
Modifier and TypeMethodDescriptiongetInfo(HttpServletRequest request, HttpServletResponse response) getInfo.getObject(HttpServletRequest request, HttpServletResponse response) getObject.getObjectResource(HttpServletRequest request, HttpServletResponse response, String pi, String subfolder, String auxfilename) getObjectResource.getObjectResource(HttpServletRequest request, HttpServletResponse response, String pi, String subfolder1, String subfolder2, String auxfilename) getObjectResource.getObjectResource2(HttpServletRequest request, HttpServletResponse response, String pi, String subfolder, String auxfilename) getObjectResource2.getObjectResource2(HttpServletRequest request, HttpServletResponse response, String pi, String subfolder1, String subfolder2, String auxfilename) getObjectResource2.getScene()
-
Constructor Details
-
ObjectResource
public ObjectResource(@Context ContainerRequestContext context, @Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("pi") String pi, @PathParam("filename") String filename) - Parameters:
context- JAX-RS container request contextrequest- incoming HTTP servlet requestresponse- outgoing HTTP servlet responsepi- persistent identifier of the recordfilename- filename of the 3D object file
-
-
Method Details
-
getInfo
@GET @Path("/info.json") @Produces("application/json") public ObjectInfo getInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) throws PresentationException, IndexUnreachableException getInfo.- Parameters:
request- incoming HTTP request providing the request URLresponse- outgoing HTTP response (unused, injected by JAX-RS)- Returns:
- the ObjectInfo describing the 3D object and its associated resource URIs
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
getScene
-
setScene
-
getObject
@GET @Produces("text/plain") public StreamingOutput getObject(@Context HttpServletRequest request, @Context HttpServletResponse response) throws IOException, PresentationException, IndexUnreachableException getObject.- Parameters:
request- incoming HTTP request (unused, injected by JAX-RS)response- outgoing HTTP response for setting content headers- Returns:
- a StreamingOutput that writes the 3D object file content to the response
- Throws:
IOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getObjectResource
@GET @Path("/{subfolder}/{auxfilename}") @Produces("application/octet-stream") public StreamingOutput getObjectResource(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("pi") String pi, @PathParam("subfolder") String subfolder, @PathParam("auxfilename") String auxfilename) throws IOException, PresentationException, IndexUnreachableException getObjectResource.- Parameters:
request- incoming HTTP request (unused, injected by JAX-RS)response- outgoing HTTP response (unused, injected by JAX-RS)pi- persistent identifier of the recordsubfolder- first-level subfolder under the media directoryauxfilename- filename of the auxiliary resource to serve- Returns:
- a StreamingOutput that writes the auxiliary resource file content (one subfolder level) to the response
- Throws:
IOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getObjectResource2
@GET @Path("/{subfolder}//{auxfilename}") @Produces("application/octet-stream") public StreamingOutput getObjectResource2(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("pi") String pi, @PathParam("subfolder") String subfolder, @PathParam("auxfilename") String auxfilename) throws IOException, PresentationException, IndexUnreachableException getObjectResource2.- Parameters:
request- incoming HTTP request (unused, injected by JAX-RS)response- outgoing HTTP response (unused, injected by JAX-RS)pi- persistent identifier of the recordsubfolder- first-level subfolder under the media directoryauxfilename- filename of the auxiliary resource to serve- Returns:
- a StreamingOutput that writes the auxiliary resource file content (alternate path, one subfolder level) to the response
- Throws:
IOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getObjectResource
@GET @Path("/{subfolder}/{subsubfolder}/{auxfilename}") @Produces("application/octet-stream") public StreamingOutput getObjectResource(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("pi") String pi, @PathParam("subfolder") String subfolder1, @PathParam("subsubfolder") String subfolder2, @PathParam("auxfilename") String auxfilename) throws IOException, PresentationException, IndexUnreachableException getObjectResource.- Parameters:
request- incoming HTTP request (unused, injected by JAX-RS)response- outgoing HTTP response (unused, injected by JAX-RS)pi- persistent identifier of the recordsubfolder1- first-level subfolder under the media directorysubfolder2- second-level subfolder under subfolder1auxfilename- filename of the auxiliary resource to serve- Returns:
- a StreamingOutput that writes the auxiliary resource file content (two subfolder levels) to the response
- Throws:
IOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getObjectResource2
@GET @Path("//{subfolder}/{subsubfolder}/{auxfilename}") @Produces("application/octet-stream") public StreamingOutput getObjectResource2(@Context HttpServletRequest request, @Context HttpServletResponse response, @PathParam("pi") String pi, @PathParam("subfolder") String subfolder1, @PathParam("subsubfolder") String subfolder2, @PathParam("auxfilename") String auxfilename) throws IOException, PresentationException, IndexUnreachableException getObjectResource2.- Parameters:
request- incoming HTTP request (unused, injected by JAX-RS)response- outgoing HTTP response (unused, injected by JAX-RS)pi- persistent identifier of the recordsubfolder1- first-level subfolder under the media directorysubfolder2- second-level subfolder under subfolder1auxfilename- filename of the auxiliary resource to serve- Returns:
- a StreamingOutput that writes the auxiliary resource file content (alternate path, two subfolder levels) to the response
- Throws:
IOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-