【发布时间】:2013-12-20 00:33:27
【问题描述】:
我有以下属性需要映射到 Spring 中的 post 参数。有我可以使用的属性吗?它接受 application/x-www-form-urlencoded 用于基于字符串的有效负载,multipart/form-data 用于二进制有效负载。其他属性映射良好,没有下划线。
String deliveryAttemptId;
映射到 post 参数
DELIVERY-ATTEMPT-ID
控制器
@Controller
@RequestMapping("/notifications")
public class NotificationController {
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
public void grade(EventNotificationRequest request, HttpServletResponse response) throws Exception {
}
型号
public class EventNotificationRequest {
String deliveryAttemptId;
【问题讨论】:
-
请说明此端点是 Web 服务端点还是表单处理端点。方法因答案而异。
-
弹簧的MVC控制器
-
我得到的那部分(即,有一个 Spring Web MVC 控制器处理请求)。我的问题是您是否有提交数据的 HTML 表单,或者它是否是 Web 服务客户端。
-
任何一个都可以进行 POST,application/x-www-form-urlencoded 用于基于字符串的有效负载,multipart/form-data 用于二进制有效负载
-
有没有办法像我在这里发布的那样映射它,stackoverflow.com/questions/20646634/…
标签: java spring spring-mvc