I want to implement a restful service using spring mvc, front-end is pure javascript.
The restful service is submitting a basic form including an image. Can I use Java Image type for the DTO? Something like this:
@Controller
public class PersonController {
@RequestMapping(value = "xxx/yyy", method = RequestMethod.POST)
public void submitForm(@RequestBody PersonDto personDto) {
String name = personDto.getName();
int age = personDto.getAge();
Image image = personDto.getImage();
service.save(xxxx);
}
}
@XmlRootElement
public class PersonDto {
private String name;
private int age;
....
private Image image;
}
Could I just do something like above without using MultipartFile to upload an image? I am not sure when the request coming, the actual image can be converted to a Java Image type automatically by Spring MVC?
Aucun commentaire:
Enregistrer un commentaire