/** * Execute a task and aim the output at all the browser windows open at a * given page in this web application. No further filtering is performed. * To send to a subset of the browser windows viewing a page, see the * {@link #withPageFiltered} method. * @param page The page to send to, excluding protocol/host/port specifiers * but including context path and servlet path. For example to send to * <code>http://example.com:8080/webapp/controller/path/index.html</code>, * you should use "/webapp/controller/path/index.html" or since the default * PageNormalizer understands default pages, this is the same as sending to * browsers viewing "/webapp/controller/path/". * To discover the contextPath at runtime you can use * javax.servlet.ServletContext#getContextPath with servlet 2.5, or before * version 2.5 you can also use {@link ServerContext#getContextPath} or * {@link javax.servlet.http.HttpServletRequest#getContextPath}. * @param task A code block to execute */ public static void withPage(String page, Runnable task) { withPage(getServerContext(), page, task); }