Reading from other URLs

If you need to read HTML pages generated by other web applications and return them to JavaScript, you can quite simply.

Just include the following method in some Java class that is exported using DWR:

public String getInclude() throws ServletException, IOException
{
    return WebContextFactory.get().forwardToString("/forward.jsp");
}

Obviously you should replace "/forward.jsp" with the URL that you wish to forward to. The URL will need to start with a slash since this is just calling HttpRequest.forward() under the covers.

You can use this method to customize the page before you pass it on if you wish.