为什么Spring MVC会自动重试POST请求?

时间:2013-06-18 23:45:51

标签: java spring spring-mvc post

我的网络应用程序出现了一些奇怪的行为,我似乎无法弄清楚发生了什么。

问题在于,无论何时控制器需要超过一定的时间来响应,由于某种原因它会重试(基于它花了多长时间)。第一次尝试是使用文件上传,但随后在我的控制器中注释掉所有内容并且只有:

Thread.currentThread().sleep(60000);

我在日志中注意到,在线程完成之前,某些内容仍在持续POST请求。

我不确定这是否重要,但这是我的表格:

<form action="/w/upload" method="post" enctype="multipart/form-data" >
    Select a file: <input type="file" name="videoFileData" />
    <input type="submit" value="Upload" />
</form>

我测试了没有附加NO文件的POSTing并且它有效(控制器只收到1个请求),但是在请求中上传了一个文件,控制器收到了两个请求。

我错过了某种配置吗?

日志:

02:18:22.570::o.s.w.s.DispatcherServlet::DEBUG::DispatcherServlet with name 'DispatcherServlet' processing POST request for [/w/upload]
02:18:22.621::o.s.w.m.c.CommonsMultipartResolver::DEBUG::Found multipart file [videoFileData] of size 3773872 bytes with original filename [VID_20130505_184912.mp4], stored at [/Users/gumatias/Work/code/ownits/ownits/ownits-skate-uploader/target/work/upload_78f4071c_b8dc_4923_a723_ae9c9d7eaf82_00000003.tmp]
02:18:22.624::o.s.w.s.m.m.a.RequestMappingHandlerMapping::DEBUG::Looking up handler method for path /upload
02:18:22.624::o.s.w.s.m.m.a.RequestMappingHandlerMapping::DEBUG::Returning handler method [public org.springframework.web.servlet.ModelAndView com.ownits.uploader.web.controller.UploadController.handleRequest(com.ownits.uploader.web.form.UploadForm) throws java.lang.Exception]
02:18:22.624::o.s.b.f.s.DefaultListableBeanFactory::DEBUG::Returning cached instance of singleton bean 'uploadController'
02:18:22.635::c.o.u.w.c.UploadController::INFO ::Uploading video...
02:18:52.572::o.s.w.s.DispatcherServlet::DEBUG::DispatcherServlet with name 'DispatcherServlet' processing POST request for [/w/upload]
02:18:52.602::o.s.w.m.c.CommonsMultipartResolver::DEBUG::Found multipart file [videoFileData] of size 3773872 bytes with original filename [VID_20130505_184912.mp4], stored at [/Users/gumatias/Work/code/ownits/ownits/ownits-skate-uploader/target/work/upload_78f4071c_b8dc_4923_a723_ae9c9d7eaf82_00000007.tmp]
02:18:52.602::o.s.w.s.m.m.a.RequestMappingHandlerMapping::DEBUG::Looking up handler method for path /upload
02:18:52.602::o.s.w.s.m.m.a.RequestMappingHandlerMapping::DEBUG::Returning handler method [public org.springframework.web.servlet.ModelAndView com.ownits.uploader.web.controller.UploadController.handleRequest(com.ownits.uploader.web.form.UploadForm) throws java.lang.Exception]
02:18:52.602::o.s.b.f.s.DefaultListableBeanFactory::DEBUG::Returning cached instance of singleton bean 'uploadController'
02:18:52.603::c.o.u.w.c.UploadController::INFO ::Uploading video...
02:19:22.637::c.o.u.w.c.UploadController::INFO ::Done uploading video
02:19:22.637::o.s.w.s.DispatcherServlet::DEBUG::Rendering view [org.springframework.web.servlet.view.JstlView: name 'upload'; URL [/WEB-INF/views/master/upload.jsp]] in DispatcherServlet with name 'DispatcherServlet'
02:19:22.637::o.s.w.s.v.JstlView::DEBUG::Added model object 'org.springframework.validation.BindingResult.uploadForm' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view with name 'upload'
02:19:22.637::o.s.w.s.v.JstlView::DEBUG::Added model object 'uploadForm' of type [com.ownits.uploader.web.form.UploadForm] to request in view with name 'upload'
02:19:22.637::o.s.w.s.v.JstlView::DEBUG::Forwarding to resource [/WEB-INF/views/master/upload.jsp] in InternalResourceView 'upload'
02:19:22.638::o.a.t.i.BasicTilesContainer::DEBUG::Render request recieved for definition 'upload'
02:19:22.639::o.s.w.m.c.CommonsMultipartResolver::DEBUG::Cleaning up multipart file [videoFileData] with original filename [VID_20130505_184912.mp4], stored at [/Users/gumatias/Work/code/ownits/ownits/ownits-skate-uploader/target/work/upload_78f4071c_b8dc_4923_a723_ae9c9d7eaf82_00000003.tmp]
02:19:22.639::o.s.w.s.DispatcherServlet::DEBUG::Successfully completed request
02:19:52.603::c.o.u.w.c.UploadController::INFO ::Done uploading video
02:19:52.604::o.s.w.s.DispatcherServlet::DEBUG::Rendering view [org.springframework.web.servlet.view.JstlView: name 'upload'; URL [/WEB-INF/views/master/upload.jsp]] in DispatcherServlet with name 'DispatcherServlet'
02:19:52.604::o.s.w.s.v.JstlView::DEBUG::Added model object 'org.springframework.validation.BindingResult.uploadForm' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view with name 'upload'
02:19:52.604::o.s.w.s.v.JstlView::DEBUG::Added model object 'uploadForm' of type [com.ownits.uploader.web.form.UploadForm] to request in view with name 'upload'
02:19:52.604::o.s.w.s.v.JstlView::DEBUG::Forwarding to resource [/WEB-INF/views/master/upload.jsp] in InternalResourceView 'upload'
02:19:52.604::o.a.t.i.BasicTilesContainer::DEBUG::Render request recieved for definition 'upload'
02:19:52.605::o.s.w.m.c.CommonsMultipartResolver::DEBUG::Cleaning up multipart file [videoFileData] with original filename [VID_20130505_184912.mp4], stored at [/Users/gumatias/Work/code/ownits/ownits/ownits-skate-uploader/target/work/upload_78f4071c_b8dc_4923_a723_ae9c9d7eaf82_00000007.tmp]
02:19:52.605::o.s.w.s.DispatcherServlet::DEBUG::Successfully completed request

1 个答案:

答案 0 :(得分:1)

好的,所以人们都知道。这是一个Jetty问题,可能是一个bug。切换到Tomcat解决了它。