cognos退出,可以使用浏览器访问:
http://server/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/logoff.xts&h_CAM_action=logoff但是我想在java代码中,退出cognos,将这个链接作为参数,结果无法退出。
可能是cognos的cookie所致?
但是却无法在代码中获得?
下面是我写的退出代码:
HttpClient httpClient = new HttpClient();
GetMethod getMethod = new GetMethod("
http://server/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/logoff.xts&h_CAM_action=logoff
");
try {
int statusCode = httpClient.executeMethod(getMethod);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + getMethod.getStatusLine());
}
// 读取内容
byte[] responseBody = getMethod.getResponseBody();
// 处理内容
String html = new String(responseBody);
System.out.println(html);
} catch (Exception e) {
System.err.println("页面无法访问");
}
getMethod.releaseConnection();
http://server/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/logoff.xts&h_CAM_action=logoff但是我想在java代码中,退出cognos,将这个链接作为参数,结果无法退出。
可能是cognos的cookie所致?
但是却无法在代码中获得?
下面是我写的退出代码:
HttpClient httpClient = new HttpClient();
GetMethod getMethod = new GetMethod("
http://server/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/logoff.xts&h_CAM_action=logoff
");
try {
int statusCode = httpClient.executeMethod(getMethod);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + getMethod.getStatusLine());
}
// 读取内容
byte[] responseBody = getMethod.getResponseBody();
// 处理内容
String html = new String(responseBody);
System.out.println(html);
} catch (Exception e) {
System.err.println("页面无法访问");
}
getMethod.releaseConnection();
解决方案 »
- 今日在平安进行笔试,拿一道题目出来分享
- equals ==
- 文本框等 getText()传来的的字符串 换行符 是'\n'吗?
- 怎样让一个java程序不被关闭?
- 怎么总是出现以捕捉到异常 java.io.FileNotFoundException }catch(FileNotFoundException e){?????????????
- 寻一本电子书候捷译《Java编程思想》(第二版)
- 为什么我的线程这么慢?
- 把一字符串转换为十六进制表示后,怎么还原为字符串?(具体程序)
- int 赋值问题.立即结
- 一个没有解决的问题
- 一个swing 问题有点麻烦谁能帮一下
- 最大化或者最小化,窗口中的内容才出现
采用在浏览器的工具栏清楚cookie后,也是无效的。
这种cgi登录方式的退出问题,不好办
如何获得这是值,并在客户端设置呢?
,如果使用java代码的话,应该将cookie和session的去掉?
问题是如何做呢?