Package org.springframework.web.servlet.resource

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


        return viewResolver;
    }

    @Bean
    public DefaultServletHttpRequestHandler createDefaultServletHttpRequestHandler() {
        return new DefaultServletHttpRequestHandler();
    }
View Full Code Here


   * 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);
  }
View Full Code Here

   * 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);
  }
View Full Code Here

   * 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);
  }
View Full Code Here

    loadBeanDefinitions("mvc-config-default-servlet.xml", 5);

    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());
View Full Code Here

    loadBeanDefinitions("mvc-config-default-servlet-optional-attrs.xml", 5);

    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());
View Full Code Here

  @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());
  }
View Full Code Here

  @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());
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.