Refactor context lookup in url-for to work in both jetty and immutant