Package org.apache.juneau.examples.rest
Class PhotosResource
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.juneau.rest.servlet.RestServlet
org.apache.juneau.rest.servlet.BasicRestServlet
org.apache.juneau.examples.rest.PhotosResource
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,BasicUniversalConfig,DefaultConfig,DefaultHtmlConfig,BasicRestOperations
Sample resource that allows images to be uploaded and retrieved.
See Also:
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddPhoto(int id, BufferedImage image) [HTTP PUT /photos/{id}] PUT request handler.deletePhoto(int id) [HTTP DELETE /photos/{id}] DELETE request handler[HTTP GET /photos] GET request handler for list of all photos.getPhoto(int id) [HTTP GET /photos/{id}] GET request handler for single photo.setPhoto(BufferedImage image) [HTTP POST /photos] POST request handler.Methods inherited from class org.apache.juneau.rest.servlet.BasicRestServlet
error, getFavIcon, getHtdoc, getStats, getSwaggerMethods inherited from class org.apache.juneau.rest.servlet.RestServlet
destroy, doLog, getContext, getPath, getRequest, getResponse, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
PhotosResource
public PhotosResource()
-
-
Method Details
-
addPhoto
[HTTP PUT /photos/{id}] PUT request handler.- Parameters:
id- The photo ID.image- The photo image.- Returns:
- OK.
-
deletePhoto
[HTTP DELETE /photos/{id}] DELETE request handler- Parameters:
id- The photo ID.- Returns:
- OK.
- Throws:
NotFound- If photo not found.
-
getAllPhotos
[HTTP GET /photos] GET request handler for list of all photos.- Returns:
- A list of photo beans.
-
getPhoto
[HTTP GET /photos/{id}] GET request handler for single photo.- Parameters:
id- The photo ID.- Returns:
- The photo image.
- Throws:
NotFound- If photo not found.
-
setPhoto
[HTTP POST /photos] POST request handler.- Parameters:
image- The photo image.- Returns:
- The created photo bean.
-