我有像这样的网络服务控制器
public class User {
private String user; // JSON string
private CommonsMultipartFile photo1;
private CommonsMultipartFile photo2;
private CommonsMultipartFile photo3;
private CommonsMultipartFile photo4;
Public user(){}
public User(String user, CommonsMultipartFile photo1, CommonsMultipartFile photo2, CommonsMultipartFile photo3,CommonsMultipartFile photo4) {
this.user = user; this.photo1 = photo1; this.photo2 = photo2;
this.photo3 = photo3; this.photo4 = photo4;}
public String getUser() { return user; }
}
@RequestMapping(value = "/create",method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<String> create(User item) throws Exception {
//remaining code
}
上面的create()方法接受User类型的对象。
在客户端应用程序中,我使用改造
来调用此类Web服务@Multipart
@POST("/create")
void createUser(@Part("user") User user,
@PartMap Map<String,TypedFile> files,
Callback<Customer> callback);
但它没有给我在服务器端的控制器类中找到的defaut构造函数。请检查我在哪里做错了。请解决这个问题。