是否有方便在应用程序中动态呈现某些页面,然后将其内容检索为InputStream
或String
?
例如,最简单的方法是:
// generate url
Link link = linkSource.createPageRenderLink("SomePageLink");
String urlAsString = link.toAbsoluteURI() + "/customParam/" + customParamValue;
// get info stream from url
HttpGet httpGet = new HttpGet(urlAsString);
httpGet.addHeader("cookie", request.getHeader("cookie"));
HttpResponse response = new DefaultHttpClient().execute(httpGet);
InputStream is = response.getEntity().getContent();
...
但似乎必须有一些更简单的方法来存档相同的结果。有什么想法吗?