org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler Java Examples

The following examples show how to use org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CSRFHandlerInterceptor.java    From light-task-scheduler with Apache License 2.0 6 votes vote down vote up
@Override
public boolean preHandle(HttpServletRequest request,
                         HttpServletResponse response, Object handler) throws Exception {

    if (handler instanceof DefaultServletHttpRequestHandler) {
        return true;
    }

    if (request.getMethod().equalsIgnoreCase("GET")) {
        return true;
    } else {
        String sessionToken = CSRFTokenManager.getToken(request.getSession());
        String requestToken = CSRFTokenManager.getToken(request);
        // 检查 csrf token是否正确
        if (sessionToken.equals(requestToken)) {
            return true;
        } else {
            response.sendError(HttpServletResponse.SC_FORBIDDEN, "Bad or missing CSRF value");
            return false;
        }
    }
}
 
Example #2
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandler() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example #3
Source File: MvcNamespaceTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example #4
Source File: DefaultServletHandlerConfigurerTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void enable() throws Exception {
	configurer.enable();
	SimpleUrlHandlerMapping getHandlerMapping = getHandlerMapping();
	SimpleUrlHandlerMapping handlerMapping = getHandlerMapping;
	DefaultServletHttpRequestHandler handler = (DefaultServletHttpRequestHandler) handlerMapping.getUrlMap().get("/**");

	assertNotNull(handler);
	assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());

	handler.handleRequest(new MockHttpServletRequest(), response);

	String expected = "default";
	assertEquals("The ServletContext was not called with the default servlet name", expected, servletContext.url);
	assertEquals("The request was not forwarded", expected, response.getForwardedUrl());
}
 
Example #5
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml", 6);

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example #6
Source File: MvcNamespaceTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testDefaultServletHandler() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet.xml", 6);

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example #7
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandler() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example #8
Source File: MvcNamespaceTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void testDefaultServletHandlerWithOptionalAttributes() throws Exception {
	loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml");

	HttpRequestHandlerAdapter adapter = appContext.getBean(HttpRequestHandlerAdapter.class);
	assertNotNull(adapter);

	DefaultServletHttpRequestHandler handler = appContext.getBean(DefaultServletHttpRequestHandler.class);
	assertNotNull(handler);

	SimpleUrlHandlerMapping mapping = appContext.getBean(SimpleUrlHandlerMapping.class);
	assertNotNull(mapping);
	assertEquals(Ordered.LOWEST_PRECEDENCE, mapping.getOrder());

	MockHttpServletRequest request = new MockHttpServletRequest();
	request.setRequestURI("/foo.css");
	request.setMethod("GET");

	HandlerExecutionChain chain = mapping.getHandler(request);
	assertTrue(chain.getHandler() instanceof DefaultServletHttpRequestHandler);

	MockHttpServletResponse response = new MockHttpServletResponse();
	ModelAndView mv = adapter.handle(request, response, chain.getHandler());
	assertNull(mv);
}
 
Example #9
Source File: DefaultServletHandlerConfigurerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void enableWithServletName() throws Exception {
	configurer.enable("defaultServlet");
	SimpleUrlHandlerMapping handlerMapping = configurer.buildHandlerMapping();
	DefaultServletHttpRequestHandler handler = (DefaultServletHttpRequestHandler) handlerMapping.getUrlMap().get("/**");

	assertNotNull(handler);
	assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());

	handler.handleRequest(new MockHttpServletRequest(), response);

	String expected = "defaultServlet";
	assertEquals("The ServletContext was not called with the default servlet name", expected, servletContext.url);
	assertEquals("The request was not forwarded", expected, response.getForwardedUrl());
}
 
Example #10
Source File: DefaultServletHandlerConfigurerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void enableWithServletName() throws Exception {
	configurer.enable("defaultServlet");
	SimpleUrlHandlerMapping handlerMapping = getHandlerMapping();
	DefaultServletHttpRequestHandler handler = (DefaultServletHttpRequestHandler) handlerMapping.getUrlMap().get("/**");

	assertNotNull(handler);
	assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());

	handler.handleRequest(new MockHttpServletRequest(), response);

	String expected = "defaultServlet";
	assertEquals("The ServletContext was not called with the default servlet name", expected, servletContext.url);
	assertEquals("The request was not forwarded", expected, response.getForwardedUrl());
}
 
Example #11
Source File: DefaultServletHandlerBeanDefinitionParser.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
	Object source = parserContext.extractSource(element);

	String defaultServletName = element.getAttribute("default-servlet-name");
	RootBeanDefinition defaultServletHandlerDef = new RootBeanDefinition(DefaultServletHttpRequestHandler.class);
	defaultServletHandlerDef.setSource(source);
	defaultServletHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	if (StringUtils.hasText(defaultServletName)) {
		defaultServletHandlerDef.getPropertyValues().add("defaultServletName", defaultServletName);
	}
	String defaultServletHandlerName = parserContext.getReaderContext().generateBeanName(defaultServletHandlerDef);
	parserContext.getRegistry().registerBeanDefinition(defaultServletHandlerName, defaultServletHandlerDef);
	parserContext.registerComponent(new BeanComponentDefinition(defaultServletHandlerDef, defaultServletHandlerName));

	Map<String, String> urlMap = new ManagedMap<String, String>();
	urlMap.put("/**", defaultServletHandlerName);

	RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class);
	handlerMappingDef.setSource(source);
	handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	handlerMappingDef.getPropertyValues().add("urlMap", urlMap);

	String handlerMappingBeanName = parserContext.getReaderContext().generateBeanName(handlerMappingDef);
	parserContext.getRegistry().registerBeanDefinition(handlerMappingBeanName, handlerMappingDef);
	parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingBeanName));

	// Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off"
	MvcNamespaceUtils.registerDefaultComponents(parserContext, source);

	return null;
}
 
Example #12
Source File: DefaultServletHandlerBeanDefinitionParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
	Object source = parserContext.extractSource(element);

	String defaultServletName = element.getAttribute("default-servlet-name");
	RootBeanDefinition defaultServletHandlerDef = new RootBeanDefinition(DefaultServletHttpRequestHandler.class);
	defaultServletHandlerDef.setSource(source);
	defaultServletHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	if (StringUtils.hasText(defaultServletName)) {
		defaultServletHandlerDef.getPropertyValues().add("defaultServletName", defaultServletName);
	}
	String defaultServletHandlerName = parserContext.getReaderContext().generateBeanName(defaultServletHandlerDef);
	parserContext.getRegistry().registerBeanDefinition(defaultServletHandlerName, defaultServletHandlerDef);
	parserContext.registerComponent(new BeanComponentDefinition(defaultServletHandlerDef, defaultServletHandlerName));

	Map<String, String> urlMap = new ManagedMap<String, String>();
	urlMap.put("/**", defaultServletHandlerName);

	RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class);
	handlerMappingDef.setSource(source);
	handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	handlerMappingDef.getPropertyValues().add("urlMap", urlMap);

	String handlerMappingBeanName = parserContext.getReaderContext().generateBeanName(handlerMappingDef);
	parserContext.getRegistry().registerBeanDefinition(handlerMappingBeanName, handlerMappingDef);
	parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingBeanName));

	// Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off"
	MvcNamespaceUtils.registerDefaultComponents(parserContext, source);

	return null;
}
 
Example #13
Source File: DefaultServletHandlerConfigurer.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Enable forwarding to the "default" Servlet identified by the given name.
 * <p>This is useful when the default Servlet cannot be autodetected,
 * for example when it has been manually configured.
 * @see DefaultServletHttpRequestHandler
 */
public void enable(@Nullable String defaultServletName) {
	this.handler = new DefaultServletHttpRequestHandler();
	if (defaultServletName != null) {
		this.handler.setDefaultServletName(defaultServletName);
	}
	this.handler.setServletContext(this.servletContext);
}
 
Example #14
Source File: DefaultServletHandlerConfigurerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void enable() throws Exception {
	configurer.enable();
	SimpleUrlHandlerMapping handlerMapping = configurer.buildHandlerMapping();
	DefaultServletHttpRequestHandler handler = (DefaultServletHttpRequestHandler) handlerMapping.getUrlMap().get("/**");

	assertNotNull(handler);
	assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());

	handler.handleRequest(new MockHttpServletRequest(), response);

	String expected = "default";
	assertEquals("The ServletContext was not called with the default servlet name", expected, servletContext.url);
	assertEquals("The request was not forwarded", expected, response.getForwardedUrl());
}
 
Example #15
Source File: DefaultServletHandlerBeanDefinitionParser.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
@Nullable
public BeanDefinition parse(Element element, ParserContext parserContext) {
	Object source = parserContext.extractSource(element);

	String defaultServletName = element.getAttribute("default-servlet-name");
	RootBeanDefinition defaultServletHandlerDef = new RootBeanDefinition(DefaultServletHttpRequestHandler.class);
	defaultServletHandlerDef.setSource(source);
	defaultServletHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	if (StringUtils.hasText(defaultServletName)) {
		defaultServletHandlerDef.getPropertyValues().add("defaultServletName", defaultServletName);
	}
	String defaultServletHandlerName = parserContext.getReaderContext().generateBeanName(defaultServletHandlerDef);
	parserContext.getRegistry().registerBeanDefinition(defaultServletHandlerName, defaultServletHandlerDef);
	parserContext.registerComponent(new BeanComponentDefinition(defaultServletHandlerDef, defaultServletHandlerName));

	Map<String, String> urlMap = new ManagedMap<>();
	urlMap.put("/**", defaultServletHandlerName);

	RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class);
	handlerMappingDef.setSource(source);
	handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	handlerMappingDef.getPropertyValues().add("urlMap", urlMap);

	String handlerMappingBeanName = parserContext.getReaderContext().generateBeanName(handlerMappingDef);
	parserContext.getRegistry().registerBeanDefinition(handlerMappingBeanName, handlerMappingDef);
	parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingBeanName));

	// Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off"
	MvcNamespaceUtils.registerDefaultComponents(parserContext, source);

	return null;
}
 
Example #16
Source File: DefaultServletHandlerConfigurer.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Enable forwarding to the "default" Servlet identified by the given name.
 * <p>This is useful when the default Servlet cannot be autodetected,
 * for example when it has been manually configured.
 * @see DefaultServletHttpRequestHandler
 */
public void enable(@Nullable String defaultServletName) {
	this.handler = new DefaultServletHttpRequestHandler();
	if (defaultServletName != null) {
		this.handler.setDefaultServletName(defaultServletName);
	}
	this.handler.setServletContext(this.servletContext);
}
 
Example #17
Source File: DefaultServletHandlerConfigurerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void enableWithServletName() throws Exception {
	configurer.enable("defaultServlet");
	SimpleUrlHandlerMapping handlerMapping = configurer.buildHandlerMapping();
	DefaultServletHttpRequestHandler handler = (DefaultServletHttpRequestHandler) handlerMapping.getUrlMap().get("/**");

	assertNotNull(handler);
	assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());

	handler.handleRequest(new MockHttpServletRequest(), response);

	String expected = "defaultServlet";
	assertEquals("The ServletContext was not called with the default servlet name", expected, servletContext.url);
	assertEquals("The request was not forwarded", expected, response.getForwardedUrl());
}
 
Example #18
Source File: DefaultServletHandlerConfigurerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void enable() throws Exception {
	configurer.enable();
	SimpleUrlHandlerMapping handlerMapping = configurer.buildHandlerMapping();
	DefaultServletHttpRequestHandler handler = (DefaultServletHttpRequestHandler) handlerMapping.getUrlMap().get("/**");

	assertNotNull(handler);
	assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());

	handler.handleRequest(new MockHttpServletRequest(), response);

	String expected = "default";
	assertEquals("The ServletContext was not called with the default servlet name", expected, servletContext.url);
	assertEquals("The request was not forwarded", expected, response.getForwardedUrl());
}
 
Example #19
Source File: DefaultServletHandlerBeanDefinitionParser.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
@Nullable
public BeanDefinition parse(Element element, ParserContext parserContext) {
	Object source = parserContext.extractSource(element);

	String defaultServletName = element.getAttribute("default-servlet-name");
	RootBeanDefinition defaultServletHandlerDef = new RootBeanDefinition(DefaultServletHttpRequestHandler.class);
	defaultServletHandlerDef.setSource(source);
	defaultServletHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	if (StringUtils.hasText(defaultServletName)) {
		defaultServletHandlerDef.getPropertyValues().add("defaultServletName", defaultServletName);
	}
	String defaultServletHandlerName = parserContext.getReaderContext().generateBeanName(defaultServletHandlerDef);
	parserContext.getRegistry().registerBeanDefinition(defaultServletHandlerName, defaultServletHandlerDef);
	parserContext.registerComponent(new BeanComponentDefinition(defaultServletHandlerDef, defaultServletHandlerName));

	Map<String, String> urlMap = new ManagedMap<>();
	urlMap.put("/**", defaultServletHandlerName);

	RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.class);
	handlerMappingDef.setSource(source);
	handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	handlerMappingDef.getPropertyValues().add("urlMap", urlMap);

	String handlerMappingBeanName = parserContext.getReaderContext().generateBeanName(handlerMappingDef);
	parserContext.getRegistry().registerBeanDefinition(handlerMappingBeanName, handlerMappingDef);
	parserContext.registerComponent(new BeanComponentDefinition(handlerMappingDef, handlerMappingBeanName));

	// Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off"
	MvcNamespaceUtils.registerDefaultComponents(parserContext, source);

	return null;
}
 
Example #20
Source File: WebAppResourceTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void resourcesViaDefaultServlet() throws Exception {
	this.mockMvc.perform(get("/unknown/resource"))
		.andExpect(handler().handlerType(DefaultServletHttpRequestHandler.class))
		.andExpect(forwardedUrl("default"));
}
 
Example #21
Source File: DefaultServletHandlerConfigurer.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Enable forwarding to the "default" Servlet identified by the given name.
 * This is useful when the default Servlet cannot be auto-detected, for example when it has been manually configured.
 * @see DefaultServletHttpRequestHandler
 */
public void enable(String defaultServletName) {
	handler = new DefaultServletHttpRequestHandler();
	handler.setDefaultServletName(defaultServletName);
	handler.setServletContext(servletContext);
}
 
Example #22
Source File: WebAppResourceTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void resourcesViaDefaultServlet() throws Exception {
	this.mockMvc.perform(get("/unknown/resource"))
		.andExpect(handler().handlerType(DefaultServletHttpRequestHandler.class))
		.andExpect(forwardedUrl("default"));
}
 
Example #23
Source File: WebAppResourceTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void resourcesViaDefaultServlet() throws Exception {
	this.mockMvc.perform(get("/unknown/resource"))
		.andExpect(handler().handlerType(DefaultServletHttpRequestHandler.class))
		.andExpect(forwardedUrl("default"));
}
 
Example #24
Source File: DefaultServletHandlerConfigurer.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Enable forwarding to the "default" Servlet identified by the given name.
 * <p>This is useful when the default Servlet cannot be autodetected,
 * for example when it has been manually configured.
 * @see DefaultServletHttpRequestHandler
 */
public void enable(String defaultServletName) {
	this.handler = new DefaultServletHttpRequestHandler();
	this.handler.setDefaultServletName(defaultServletName);
	this.handler.setServletContext(this.servletContext);
}