@RestController @RequestMapping(value="/api") public class FileResource extends Object
| Constructor and Description |
|---|
FileResource(FileService fileService,
GameService gameService,
UserRepository userRepository) |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<File> |
createFile(@Valid File file)
POST /files : Create a new file.
|
org.springframework.http.ResponseEntity<Void> |
deleteFile(Long id)
DELETE /files/:id : delete the "id" file.
|
org.springframework.http.ResponseEntity<List<File>> |
getAllFiles(org.springframework.data.domain.Pageable pageable)
GET /files : get all the files.
|
org.springframework.http.ResponseEntity<File> |
getFile(Long id)
GET /files/:id : get the "id" file.
|
void |
getMyFile(@Valid @NotNull String type,
@Valid @NotNull Long id,
javax.servlet.http.HttpServletResponse response)
Download a file.
|
org.springframework.http.ResponseEntity<List<File>> |
getMyFiles(@Valid @NotNull String type)
Get all files owned by logged in user, plus all shared files.
|
org.springframework.http.ResponseEntity<File> |
postFile(@Valid @NotNull String type,
Boolean shared,
Boolean overwrite,
@Valid @NotNull org.springframework.web.multipart.MultipartFile part)
Upload a file.
|
org.springframework.http.ResponseEntity<File> |
updateFile(@Valid File file)
PUT /files : Updates an existing file.
|
public FileResource(FileService fileService, GameService gameService, UserRepository userRepository)
@PostMapping(value="/files") @Timed public org.springframework.http.ResponseEntity<File> createFile(@Valid @RequestBody @Valid File file) throws URISyntaxException
file - the file to createURISyntaxException - if the Location URI syntax is incorrect@PutMapping(value="/files") @Timed public org.springframework.http.ResponseEntity<File> updateFile(@Valid @RequestBody @Valid File file) throws URISyntaxException
file - the file to updateURISyntaxException - if the Location URI syntax is incorrect@GetMapping(value="/files") @Timed public org.springframework.http.ResponseEntity<List<File>> getAllFiles(org.springframework.data.domain.Pageable pageable) throws URISyntaxException
pageable - the pagination informationURISyntaxException - if there is an error to generate the pagination HTTP headers@GetMapping(value="/files/{id}")
@Timed
public org.springframework.http.ResponseEntity<File> getFile(@PathVariable
Long id)
id - the id of the file to retrieve@DeleteMapping(value="/files/{id}")
@Timed
public org.springframework.http.ResponseEntity<Void> deleteFile(@PathVariable
Long id)
id - the id of the file to delete@GetMapping(value="/myfiles/{type}/")
@Timed
public org.springframework.http.ResponseEntity<List<File>> getMyFiles(@Valid @NotNull @PathVariable
@Valid @NotNull String type)
throws URISyntaxException
URISyntaxException@GetMapping(value="/myfiles/{type}/{id}")
@Timed
public void getMyFile(@Valid @NotNull @PathVariable
@Valid @NotNull String type,
@Valid @NotNull @PathVariable
@Valid @NotNull Long id,
javax.servlet.http.HttpServletResponse response)
throws IOException
type - id - response - IOException@PostMapping(value="/myfiles/{type}/")
@Timed
public org.springframework.http.ResponseEntity<File> postFile(@Valid @NotNull @PathVariable
@Valid @NotNull String type,
@RequestParam(value="shared")
Boolean shared,
@RequestParam(value="overwrite")
Boolean overwrite,
@Valid @NotNull @RequestParam(value="file")
@Valid @NotNull org.springframework.web.multipart.MultipartFile part)
throws IOException,
URISyntaxException
part - type - shared - org.apache.commons.io.FileExistsExceptionIOExceptionURISyntaxExceptionCopyright © 2019 Power TAC. All rights reserved.