@Test public void testGetContextUrlWithMapEscaping() throws Exception { RequestContext context = new RequestContext(this.exchange, this.model, this.applicationContext); Map<String, Object> map = new HashMap<>(); map.put("foo", "bar baz"); map.put("spam", "&bucket="); assertEquals("/foo/bar%20baz?spam=%26bucket%3D", context.getContextUrl("{foo}?spam={spam}", map)); }
@Test public void testGetContextUrlWithMap() throws Exception { RequestContext context = new RequestContext(this.exchange, this.model, this.applicationContext); Map<String, Object> map = new HashMap<>(); map.put("foo", "bar"); map.put("spam", "bucket"); assertEquals("/foo/bar?spam=bucket", context.getContextUrl("{foo}?spam={spam}", map)); }
@Test public void testGetContextUrl() throws Exception { RequestContext context = new RequestContext(this.exchange, this.model, this.applicationContext); assertEquals("/foo/bar", context.getContextUrl("bar")); }
@Override public String getContextUrl(final String relativeUrl) { return this.requestContext.getContextUrl(relativeUrl); }
@Override public String getContextUrl(final String relativeUrl, final Map<String, ?> params) { return this.requestContext.getContextUrl(relativeUrl, params); }