1 16 17 package org.springframework.mock.web; 18 19 import javax.servlet.FilterChain ; 20 import javax.servlet.ServletRequest ; 21 import javax.servlet.ServletResponse ; 22 23 import org.springframework.util.Assert; 24 25 36 public class MockFilterChain implements FilterChain { 37 38 private ServletRequest request; 39 40 private ServletResponse response; 41 42 43 46 public void doFilter(ServletRequest request, ServletResponse response) { 47 Assert.notNull(request, "Request must not be null"); 48 Assert.notNull(response, "Response must not be null"); 49 if (this.request != null) { 50 throw new IllegalStateException ("This FilterChain has already been called!"); 51 } 52 this.request = request; 53 this.response = response; 54 } 55 56 59 public ServletRequest getRequest() { 60 return this.request; 61 } 62 63 66 public ServletResponse getResponse() { 67 return this.response; 68 } 69 70 } 71 | Popular Tags |