Class FileController<E extends File,​D extends FileDao<E>,​S extends FileService<E,​D>>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        FileController()
      Default constructor, which calls the type-constructor
      protected FileController​(java.lang.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​(java.lang.Integer id)
      Gets a file from the database by the given id
      void setService​(S service)
      We have to use Qualifier to 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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileController

        public FileController()
        Default constructor, which calls the type-constructor
      • FileController

        protected FileController​(java.lang.Class<E> entityClass)
        Constructor that sets the concrete entity class for the controller. Subclasses MUST call this constructor.
    • Method Detail

      • setService

        @Autowired
        @Qualifier("fileService")
        public void setService​(S service)
        We have to use Qualifier to define the correct service here. Otherwise, spring can not decide which service has to be autowired here as there are multiple candidates.
        Specified by:
        setService in class AbstractWebController<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
                                                                  java.lang.Integer id)
        Gets a file from the database by the given id