Package de.terrestris.shoguncore.web
Class FileController<E extends File,D extends FileDao<E>,S extends FileService<E,D>>
- java.lang.Object
-
- de.terrestris.shoguncore.web.AbstractWebController<E,D,S>
-
- de.terrestris.shoguncore.web.FileController<E,D,S>
-
- Direct Known Subclasses:
ImageFileController
@Controller @RequestMapping("/file") public class FileController<E extends File,D extends FileDao<E>,S extends FileService<E,D>> extends AbstractWebController<E,D,S>- Author:
- Johannes Weskamm, Daniel Koch
-
-
Field Summary
-
Fields inherited from class de.terrestris.shoguncore.web.AbstractWebController
logger, service
-
-
Constructor Summary
Constructors Modifier Constructor Description FileController()Default constructor, which calls the type-constructorprotectedFileController(Class<E> entityClass)Constructor that sets the concrete entity class for the controller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<?>getFile(Integer id)Gets a file from the database by the given idvoidsetService(S service)We have to useQualifierto define the correct service here.org.springframework.http.ResponseEntity<?>uploadFile(org.springframework.web.multipart.MultipartFile uploadedFile)Persists a file as bytearray in the database-
Methods inherited from class de.terrestris.shoguncore.web.AbstractWebController
getEntityClass, getService
-
-
-
-
Method Detail
-
setService
@Autowired @Qualifier("fileService") public void setService(S service)We have to useQualifierto define the correct service here. Otherwise, spring can not decide which service has to be autowired here as there are multiple candidates.- Specified by:
setServicein classAbstractWebController<E extends File,D extends FileDao<E>,S extends FileService<E,D>>- Parameters:
service- the service to set
-
uploadFile
@RequestMapping(value="/upload.action", method=POST) public org.springframework.http.ResponseEntity<?> uploadFile(@RequestParam("file") org.springframework.web.multipart.MultipartFile uploadedFile)Persists a file as bytearray in the database- Parameters:
uploadedFile-
-
getFile
@RequestMapping(value="/get.action", method=GET) public org.springframework.http.ResponseEntity<?> getFile(@RequestParam Integer id)Gets a file from the database by the given id
-
-