I'm attempting to include an email attachment in form submission. My backend has a tomcat server using jersey to receive RESTful calls.
我正在尝试在表单提交中包含电子邮件附件。我的后端有一个使用jersey的tomcat服务器来接收RESTful调用。
When I try to generate a post with this form (all the styling has been stripped out)
当我尝试使用此表单生成帖子时(所有样式都已被删除)
<form name="composeMailForm" enctype="multipart/form-data" method="POST" action="/myTarget">
<input id="mailTo" type="text" name="to" class="span12" />
<input type="text" name="subject" class="span8" />
<textarea name="body" rows="5" class="span8">-</textarea>
<input type="file" name="file" size=100 />
<button type="submit" >Send</button>
</form>
I get a 405 back.
我回来了405。
My function definition on the backend is
我在后端的函数定义是
@Path("/myTarget")
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response sendMail(
@FormDataParam("to") String recipients,
@FormDataParam("subject") String subject,
@FormDataParam("body") String body,
@FormDataParam("file") File loadedFile,
@FormDataParam("file") FormDataContentDisposition headerDisp,
@CookieParam("USER_COOKIE") String USER_COOKIE){
The biggest problem I can see is that when I watch the session in wire shark it says that the request packet is malformed
我能看到的最大问题是,当我在线鲨中观察会话时,它说请求数据包格式错误
it gives an error of
它给出了一个错误
[Malformed Packet: UASIP]
[格式错误的数据包:UASIP]
[Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
[专家信息(错误/格式错误):格式错误的数据包(发生异常)]
Any thoughts one what's going wrong in the form or the processing would be greatly appreciated.
任何想法在形式或处理中出现的问题将不胜感激。
1 个解决方案
#1
0
An unrelated typo was causing Jersey to fail to map functions properly.
一个无关的错字导致泽西岛无法正确映射功能。
The malformed packets stemmed from the fact that my computer was deferring checksum calculation to the router, so the packets had false checksums, but that was resolved by the time it hit the outside wire.
格式错误的数据包源于我的计算机将校验和计算延迟到路由器的事实,因此数据包具有错误的校验和,但是当它到达外部线路时解决了。
#1
0
An unrelated typo was causing Jersey to fail to map functions properly.
一个无关的错字导致泽西岛无法正确映射功能。
The malformed packets stemmed from the fact that my computer was deferring checksum calculation to the router, so the packets had false checksums, but that was resolved by the time it hit the outside wire.
格式错误的数据包源于我的计算机将校验和计算延迟到路由器的事实,因此数据包具有错误的校验和,但是当它到达外部线路时解决了。