ex1-1 done
This commit is contained in:
parent
c4c084d819
commit
68e2656f88
|
@ -0,0 +1,13 @@
|
|||
package cn.edu.zjvtit.distributedobjectstorage.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class DemoController {
|
||||
@GetMapping("/hello")
|
||||
public String Hello() {
|
||||
return "hello";
|
||||
}
|
||||
}
|
|
@ -19,11 +19,8 @@ public class ObjectsController {
|
|||
|
||||
@PutMapping("/objects/{filename}")
|
||||
public String putObject(HttpServletRequest request,@PathVariable("filename") String filename) throws IOException {
|
||||
|
||||
File fileToSave = new File("./uploads/" + filename);
|
||||
|
||||
InputStream is =request.getInputStream();
|
||||
|
||||
byte[] bytes = IOUtils.readAllBytes(is);
|
||||
FileCopyUtils.copy(bytes,fileToSave);
|
||||
return (new Result( "success","10000")).toString();
|
||||
|
|
Loading…
Reference in New Issue