Package org.dspace.app.rest
Class CollectionLogoController
- java.lang.Object
-
- org.dspace.app.rest.CollectionLogoController
-
@RestController @RequestMapping("/api/core/collections/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}/logo") public class CollectionLogoController extends ObjectThis RestController takes care of the creation and deletion of Collection's nested objects This class will typically receive the UUID of a Collection and it'll perform logic on its nested objects
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringREGEX_REQUESTMAPPING_IDENTIFIER_AS_UUIDRegular expression in the request mapping to accept UUID as identifierprotected Utilsutils
-
Constructor Summary
Constructors Constructor Description CollectionLogoController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>createLogo(javax.servlet.http.HttpServletRequest request, UUID uuid, org.springframework.web.multipart.MultipartFile uploadfile)This method will add a logo to the collection.
-
-
-
Field Detail
-
REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID
protected static final String REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID
Regular expression in the request mapping to accept UUID as identifier- See Also:
- Constant Field Values
-
utils
@Autowired protected Utils utils
-
-
Method Detail
-
createLogo
@PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'WRITE\')") @RequestMapping(method=POST, headers="content-type=multipart/form-data") public org.springframework.http.ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> createLogo(javax.servlet.http.HttpServletRequest request, @PathVariable UUID uuid, @RequestParam(value="file",required=false) org.springframework.web.multipart.MultipartFile uploadfile) throws SQLException, IOException, org.dspace.authorize.AuthorizeExceptionThis method will add a logo to the collection. curl -X POST http:///api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/logo' \ -XPOST -H 'Content-Type: multipart/form-data' \ -H 'Authorization: Bearer eyJhbGciOiJI...' \ -F "file=@Downloads/test.png" Example: curl -X POST http://<dspace.server.url>/api/core/collections/1c11f3f1-ba1f-4f36-908a-3f1ea9a557eb/logo' \ -XPOST -H 'Content-Type: multipart/form-data' \ -H 'Authorization: Bearer eyJhbGciOiJI...' \ -F "file=@Downloads/test.png"- Parameters:
request- The StandardMultipartHttpServletRequest that will contain the logo in its bodyuuid- The UUID of the collection- Returns:
- The created bitstream
- Throws:
SQLException- If something goes wrongIOException- If something goes wrongorg.dspace.authorize.AuthorizeException- If the user doesn't have the correct rights
-
-