class ServletContextHelper {

    public ServletContextImpl getResolvedContext(final List<ServletContextImpl> servletContexts, final String path) {
        for (ServletContextImpl servletContext : servletContexts) {
            if (path.startsWith(servletContext.getContextPath())) {
                return servletContext;
            }
        }
        return null;
    }

}