@Test
public void testGetRequestPathFromUrl() {

    String url = "http://localhost/context/path1";
    assertEquals("/context/path1", Servlets.getRequestPathFromUri(url, ""));
    assertEquals("/path1", Servlets.getRequestPathFromUri(url, "/context"));
    
    url = "http://localhost/context/path1?p=1";
    assertEquals("/context/path1", Servlets.getRequestPathFromUri(url, ""));
    assertEquals("/path1", Servlets.getRequestPathFromUri(url, "/context"));
    
    url = "/context/path1?p=1";
    assertEquals("/context/path1", Servlets.getRequestPathFromUri(url, ""));
    assertEquals("/path1", Servlets.getRequestPathFromUri(url, "/context"));
}