Package org.ocpsoft.rewrite.servlet.spi

Examples of org.ocpsoft.rewrite.servlet.spi.DispatcherTypeProvider


      // AND a forwarded request
      HttpServletRequest request = mock(HttpServletRequest.class);
      when(request.getDispatcherType()).thenReturn(javax.servlet.DispatcherType.FORWARD);

      // WHEN the provider is asked for the DispatcherType
      DispatcherTypeProvider provider = new Servlet3DispatcherTypeProvider();
      DispatcherType dispatcherType = provider.getDispatcherType(request, servletContext);

      // THEN it should return FORWARD
      assertEquals(DispatcherType.FORWARD, dispatcherType);

   }
View Full Code Here


      when(servletContext.getMajorVersion()).thenReturn(2);
      HttpServletRequest request = mock(HttpServletRequest.class);
      when(request.getDispatcherType()).thenThrow(new IllegalStateException("Call not allowed"));

      // WHEN the provider is asked for the DispatcherType
      DispatcherTypeProvider provider = new Servlet3DispatcherTypeProvider();
      DispatcherType dispatcherType = provider.getDispatcherType(request, servletContext);

      // THEN it should return null
      assertNull(dispatcherType);

   }
View Full Code Here

      // GIVEN a request without any attributes set
      HttpServletRequest request = mock(HttpServletRequest.class);

      // WHEN the provider is asked for the DispatcherType
      DispatcherTypeProvider provider = new Servlet25DispatcherTypeProvider();
      DispatcherType dispatcherType = provider.getDispatcherType(request, mock(ServletContext.class));

      // THEN it should return REQUEST
      assertEquals(DispatcherType.REQUEST, dispatcherType);

   }
View Full Code Here

      // GIVEN a request with the INCLUDE attribute set
      HttpServletRequest request = mock(HttpServletRequest.class);
      when(request.getAttribute("javax.servlet.include.request_uri")).thenReturn("/some/url");

      // WHEN the provider is asked for the DispatcherType
      DispatcherTypeProvider provider = new Servlet25DispatcherTypeProvider();
      DispatcherType dispatcherType = provider.getDispatcherType(request, mock(ServletContext.class));

      // THEN it should return INCLUDE
      assertEquals(DispatcherType.INCLUDE, dispatcherType);

   }
View Full Code Here

      // GIVEN a request with the FORWARD attribute set
      HttpServletRequest request = mock(HttpServletRequest.class);
      when(request.getAttribute("javax.servlet.forward.request_uri")).thenReturn("/some/url");

      // WHEN the provider is asked for the DispatcherType
      DispatcherTypeProvider provider = new Servlet25DispatcherTypeProvider();
      DispatcherType dispatcherType = provider.getDispatcherType(request, mock(ServletContext.class));

      // THEN it should return INCLUDE
      assertEquals(DispatcherType.FORWARD, dispatcherType);

   }
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.servlet.spi.DispatcherTypeProvider

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.