Skip to content

Commit fc76957

Browse files
committed
Tested Join.withInboundCorrection()
1 parent 96369f9 commit fc76957

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎impl-servlet/src/test/java/com/ocpsoft/rewrite/servlet/config/JoinConfigurationProvider.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ public void performHttp(final HttpServletRewrite event, final EvaluationContext
7575
}
7676
})
7777

78-
.add(Join.path("/{p1}/{p2}").to("/list.xhtml").withInboundCorrection());
78+
.add(Join.path("/{p1}/{p2}").to("/list.xhtml").withInboundCorrection())
79+
80+
.defineRule()
81+
.when(Path.matches("/list.xhtml"))
82+
.perform(SendStatus.code(204));
7983

8084
return config;
8185
}

‎impl-servlet/src/test/java/com/ocpsoft/rewrite/servlet/config/JoinConfigurationTest.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ public void testUrlMappingConfiguration()
5858
Assert.assertEquals(action.getContextPath() + "/p/rewrite", action.getResponseHeaderValues("Encoded-URL").get(0));
5959
}
6060

61+
@Test
62+
public void testUrlMappingConfigurationWithoutInboundCorrection()
63+
{
64+
HttpAction<HttpGet> action = get("/viewProject.xhtml");
65+
Assert.assertEquals(404, action.getResponse().getStatusLine().getStatusCode());
66+
67+
Assert.assertEquals("/viewProject.xhtml", action.getCurrentContextRelativeURL());
68+
}
69+
6170
@Test
6271
public void testUrlMappingConfigurationWithInboundCorrection()
6372
{
6473
HttpAction<HttpGet> action = get("/list.xhtml?p1=foo&p2=bar");
65-
Assert.assertEquals(404, action.getResponse().getStatusLine().getStatusCode());
74+
Assert.assertEquals(204, action.getResponse().getStatusLine().getStatusCode());
6675

6776
Assert.assertEquals("/foo/bar", action.getCurrentContextRelativeURL());
6877
}

0 commit comments

Comments
 (0)