@Test public void normalRequestDoesNothing() throws Exception { MultipartDecoder decoder = newMock(MultipartDecoder.class); HttpServletRequest request = mockHttpServletRequest(); HttpServletResponse response = mockHttpServletResponse(); HttpServletRequestHandler handler = newMock(HttpServletRequestHandler.class); MultipartServletRequestFilter filter = new MultipartServletRequestFilter(decoder); expect(request.getMethod()).andReturn("get"); expect(handler.service(request, response)).andReturn(true); replay(); boolean isHandled = filter.service(request, response, handler); assertTrue(isHandled); verify(); }
@Override public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler) throws IOException { HttpServletRequest newRequest = ServletFileUpload.isMultipartContent(request) ? decoder.decode( request) : request; return handler.service(newRequest, response); }
MultipartServletRequestFilter implements HttpServletRequestFilter { @Override public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler) throws IOException { HttpServletRequest newRequest = ServletFileUpload.isMultipartContent(request) ? decoder.decode( request) : request; return handler.service(newRequest, response); } }
MultipartServletRequestFilter implements HttpServletRequestFilter { @Override public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler) throws IOException { HttpServletRequest newRequest = ServletFileUpload.isMultipartContent(request) ? decoder.decode( request) : request; return handler.service(newRequest, response); } MultipartServletRequestFilter(MultipartDecoder multipartDecoder); }
MultipartServletRequestFilter implements HttpServletRequestFilter { @Override public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler) throws IOException { HttpServletRequest newRequest = ServletFileUpload.isMultipartContent(request) ? decoder.decode( request) : request; return handler.service(newRequest, response); } MultipartServletRequestFilter(MultipartDecoder multipartDecoder); @Override boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler); }
MultipartServletRequestFilter implements HttpServletRequestFilter { @Override public boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler) throws IOException { HttpServletRequest newRequest = ServletFileUpload.isMultipartContent(request) ? decoder.decode( request) : request; return handler.service(newRequest, response); } MultipartServletRequestFilter(MultipartDecoder multipartDecoder); @Override boolean service(HttpServletRequest request, HttpServletResponse response, HttpServletRequestHandler handler);  }