Package org.springframework.web

Examples of org.springframework.web.HttpRequestHandler


    MockServletContext servletContext = new MockServletContext();
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.getBeanFactory().registerSingleton("myHandler", new HttpRequestHandler() {
      public void handleRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        assertSame(request, req);
        assertSame(response, res);
        String exception = request.getParameter("exception");
        if ("ServletException".equals(exception)) {
View Full Code Here


    @Override
    public boolean preHandle(HttpServletRequest request,
                             HttpServletResponse response, Object handler) throws IOException, ServletException {

        if (handler instanceof HttpRequestHandler) {
            HttpRequestHandler resourcehandler = ((HttpRequestHandler) handler);
            resourcehandler.handleRequest(request, response);
            //break interceptor chain
            return false;
        } else {
            LOGGER.warn("handler can not be cast to HttpRequestHandler. It is of class " +
                    handler.getClass().getCanonicalName());
View Full Code Here

    assertThat(hm, Matchers.instanceOf(SimpleUrlHandlerMapping.class));
    SimpleUrlHandlerMapping suhm = (SimpleUrlHandlerMapping) hm;
    assertThat(suhm.getUrlMap().keySet(), Matchers.hasSize(4));
    assertThat(suhm.getUrlMap().values(), Matchers.hasSize(4));

    HttpRequestHandler httpRequestHandler = (HttpRequestHandler) suhm.getUrlMap().get("/foo");
    assertNotNull(httpRequestHandler);
    assertThat(httpRequestHandler, Matchers.instanceOf(WebSocketHttpRequestHandler.class));

    WebSocketHttpRequestHandler wsHttpRequestHandler = (WebSocketHttpRequestHandler) httpRequestHandler;
    HandshakeHandler handshakeHandler = wsHttpRequestHandler.getHandshakeHandler();
View Full Code Here

    SimpleUrlHandlerMapping suhm = (SimpleUrlHandlerMapping) hm;
    assertThat(suhm.getUrlMap().keySet(), Matchers.hasSize(1));
    assertThat(suhm.getUrlMap().values(), Matchers.hasSize(1));
    assertEquals(2, suhm.getOrder());

    HttpRequestHandler httpRequestHandler = (HttpRequestHandler) suhm.getUrlMap().get("/foo/**");
    assertNotNull(httpRequestHandler);
    assertThat(httpRequestHandler, Matchers.instanceOf(SockJsHttpRequestHandler.class));
    SockJsHttpRequestHandler sockJsHttpRequestHandler = (SockJsHttpRequestHandler) httpRequestHandler;
    WebSocketHandler wsHandler = unwrapWebSocketHandler(sockJsHttpRequestHandler.getWebSocketHandler());
    assertNotNull(wsHandler);
View Full Code Here

    MockServletContext servletContext = new MockServletContext();
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.getBeanFactory().registerSingleton("myHandler", new HttpRequestHandler() {
      @Override
      public void handleRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
        assertSame(request, req);
        assertSame(response, res);
        String exception = request.getParameter("exception");
View Full Code Here

TOP

Related Classes of org.springframework.web.HttpRequestHandler

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.