我的 Web 应用程序出现了一些奇怪的行为,我似乎无法弄清楚发生了什么。
问题是,每当控制器响应时间超过一定时间时,由于某种原因它会重试(基于它花费的时间)。第一次尝试是上传文件,但随后注释掉了我的控制器中的所有内容,并且只有:
Thread.currentThread().sleep(60000);
我在日志中注意到,在线程完成之前,某些东西仍在持续发布请求。
我不确定这是否重要,但这是我的表格:
<form action="/w/upload" method="post" enctype="multipart/form-data" >
Select a file: <input type="file" name="videoFileData" />
<input type="submit" value="Upload" />
</form>
我测试了没有附加文件的 POST 并且它工作(控制器只收到 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