我有一个(struts 2)动作,它被称为重定向到一个jsp。我正在尝试使用 HttpClient 将此 jsp 保存为 html。除了一件事之外,这很好用,服务器jsessionid=RandomText
会在 html 中存在另一个动作的地方追加。
如何从最终的 html 中删除 jsessionid ?
来自呈现的 html 的示例:
<a href='/wah/destinationSEO.action;jsessionid=123ASDGA123?idDestination=22'>
这就是我将 jsp 保存到 html 的方式:
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet getRequest = new HttpGet("http://127.0.0.1:8080/wah/destinationSEO.action?idDestination=8");
HttpResponse response = httpClient.execute(getRequest);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : "
+ response.getStatusLine().getStatusCode());
}
httpClient.getConnectionManager().shutdown();
String content = CharStreams.toString(new InputStreamReader(response.getEntity().getContent()));
String path="D:/wahSVN/trunk/src/main/webapp/seo.html";
File html = new File(path);
html.createNewFile();
Files.append(content, html, Charsets.UTF_8);