Java tutorial
/* Copyright 2009-2014 Igor Polevoy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.javalite.activeweb; import org.springframework.mock.web.MockHttpServletRequest; import javax.servlet.*; import javax.servlet.http.Part; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; /** * @author Igor Polevoy */ public class MockMultipartHttpServletRequestImpl extends MockHttpServletRequest implements AWMockMultipartHttpServletRequest { private List<FormItem> formItems = new ArrayList<FormItem>(); public void addFormItem(FormItem item) { formItems.add(item); } public Iterator<FormItem> getFormItemIterator() { return formItems.iterator(); } @Override public List<FormItem> getFormItems() { return formItems; } // Below are Servlet 3 methods //Note that the @Override annotations are removed for backwards compatibility public Collection<Part> getParts() throws IOException, ServletException { return null; } public Part getPart(String s) throws IOException, ServletException { return null; } public AsyncContext startAsync() throws IllegalStateException { return null; } public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException { return null; } public boolean isAsyncStarted() { return false; } public boolean isAsyncSupported() { return false; } public AsyncContext getAsyncContext() { return null; } public DispatcherType getDispatcherType() { return null; } }