Code example for ServletWebRequest

0
	private MockHttpServletRequest servletRequest; 
 
	@Before 
	public void setup() { 
		this.servletRequest = new MockHttpServletRequest(); 
		this.webRequest = new ServletWebRequest(this.servletRequest); 
		this.configurer = new ContentNegotiationConfigurer(this.servletRequest.getServletContext()); 
	} 
 
	@Test 
	public void defaultSettings() throws Exception { 
		ContentNegotiationManager manager = this.configurer.getContentNegotiationManager(); 
 
		this.servletRequest.setRequestURI("/flower.gif"); 
 
		assertEquals("Should be able to resolve file extensions by default", 
				Arrays.asList(MediaType.IMAGE_GIF), manager.resolveMediaTypes(this.webRequest)); 
 
		this.servletRequest.setRequestURI("/flower?format=gif"); 
		this.servletRequest.addParameter("format", "gif");