Example usage for org.springframework.web.servlet HandlerExecutionChain getHandler

List of usage examples for org.springframework.web.servlet HandlerExecutionChain getHandler

Introduction

In this page you can find the example usage for org.springframework.web.servlet HandlerExecutionChain getHandler.

Prototype

public Object getHandler() 

Source Link

Document

Return the handler object to execute.

Usage

From source file:ar.com.zauber.commons.spring.servlet.mvc.support.ZauberBeanNameBasedClassNameHandlerMappingTest.java

/** @throws Exception on error*/
public final void testSimpleName() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/logout/");
    final HandlerExecutionChain hec = hm.getHandler(req);
    assertEquals(((DummyController) hec.getHandler()).getId(), "logout");
}

From source file:ar.com.zauber.commons.spring.servlet.mvc.support.ZauberBeanNameBasedClassNameHandlerMappingTest.java

/** @throws Exception on error*/
public final void testCompound() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/password/change/");
    final HandlerExecutionChain hec = hm.getHandler(req);
    assertEquals(((DummyController) hec.getHandler()).getId(), "changepassword");
}

From source file:ar.com.zauber.commons.spring.servlet.mvc.support.ZauberBeanNameBasedClassNameHandlerMappingTest.java

/** @throws Exception on error*/
public final void testFirstCapitalLetter() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/password/forgot/");
    final HandlerExecutionChain hec = hm.getHandler(req);
    assertEquals(((DummyController) hec.getHandler()).getId(), "forgotpassword");
}

From source file:ar.com.zauber.commons.spring.servlet.mvc.support.ZauberBeanNameBasedClassNameHandlerMappingTest.java

/** @throws Exception on error*/
public final void testControllerWithNoName() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/another/");
    final HandlerExecutionChain hec = hm.getHandler(req);
    assertEquals(((DummyController) hec.getHandler()).getId(), "another");
}

From source file:ar.com.zauber.commons.spring.servlet.mvc.support.ZauberBeanNameBasedClassNameHandlerMappingTest.java

/** @throws Exception on error*/
public final void testActions() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/actions/123/delete");
    final HandlerExecutionChain hec = hm.getHandler(req);
    assertEquals("actions", ((DummyController) hec.getHandler()).getId());

    req = new MockHttpServletRequest("GET", "/actions/123");
    final HandlerExecutionChain hec1 = hm.getHandler(req);
    assertEquals("actions", ((DummyController) hec1.getHandler()).getId());

    req = new MockHttpServletRequest("GET", "/actions/123/cat/321");
    final HandlerExecutionChain hec2 = hm.getHandler(req);
    assertEquals("actions", ((DummyController) hec2.getHandler()).getId());
}

From source file:org.gwtwidgets.server.spring.test.HandlerTest.java

@Test
public void testServiceInvocation() throws Exception {
    logger.info("Testing simple invocation");
    HandlerExecutionChain chain = handler.getHandler(requestService);
    GWTRPCServiceExporter exporter = (GWTRPCServiceExporter) chain.getHandler();
    TestService service = (TestService) exporter.getService();
    assertEquals(service.add(3, -5), -2);
}

From source file:org.gwtwidgets.server.spring.test.HandlerTest.java

@Test
public void testExceptionTranslation() throws Exception {
    logger.info("Testing exception translation for plain service");
    HandlerExecutionChain chain = handler.getHandler(requestService);
    GWTRPCServiceExporter exporter = (GWTRPCServiceExporter) chain.getHandler();
    TestService service = (TestService) exporter.getService();
    try {//from  w ww  . jav  a  2s.  c om
        service.throwDeclaredException();
    } catch (Throwable t) {
        assertTrue(t instanceof CustomException);
    }
}

From source file:org.gwtwidgets.server.spring.test.HandlerTest.java

@Test
public void testExceptionTranslationTx() throws Exception {
    logger.info("Testing exception translation for proxied service");
    HandlerExecutionChain chain = handler.getHandler(requestService);
    GWTRPCServiceExporter exporter = (GWTRPCServiceExporter) chain.getHandler();
    TestService service = (TestService) exporter.getService();
    try {/*  ww  w .j a va 2  s.co m*/
        service.throwDeclaredException();
    } catch (Throwable t) {
        assertTrue(t instanceof CustomException);
    }
}

From source file:ar.com.zauber.commons.spring.servlet.mvc.support.ZauberBeanNameBasedClassNameHandlerMappingTest.java

/** @throws Exception on error*/
public final void testParametrizedView() throws Exception {
    MockHttpServletRequest req = new MockHttpServletRequest("GET", "/oopsss/");
    final HandlerExecutionChain hec = hm.getHandler(req);
    assertNotNull(hec);//from   w ww. ja va  2 s  . c om
    assertEquals(((ParameterizableViewController) hec.getHandler()).getViewName(), "exceptions/http");
}

From source file:org.sarons.spring4me.web.servlet.DispatcherServlet.java

@Override
protected HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {
    HandlerExecutionChain mappedHandler = super.getHandler(request);
    ////  w w w  .ja v  a2  s .c  om
    if (mappedHandler != null && mappedHandler.getHandler() != null) {
        prepareFlashMapForWidget(request, mappedHandler.getHandler());
    }
    //
    return mappedHandler;
}