ex1-1 done

This commit is contained in:
Xudong 2022-04-24 22:55:06 +08:00
parent c4c084d819
commit 68e2656f88
2 changed files with 13 additions and 3 deletions

View File

@ -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";
}
}

View File

@ -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();