当前位置: 代码迷 >> Web前端 >> sso模拟登陆在tomcat下正常,在websphere下却不正常
  详细解决方案

sso模拟登陆在tomcat下正常,在websphere下却不正常

热度:97   发布时间:2012-11-04 10:42:41.0
sso模拟登陆在tomcat上正常,在websphere上却不正常
我采用的是httpclient的方式模拟登陆,然后再获取sessionid,再redirect到相应的页面,代码:
HttpClient client = new HttpClient();
		
PostMethod method = new PostMethod("url");
		
method.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
		
method.setRequestHeader("Cookie", "JSESSIONID=" + sSesId);
method.setRequestBody(param);
try{
      int statusCode = client.executeMethod(method);

   } catch (Exception e) {
	e.printStackTrace();
   } finally {
	method.releaseConnection();
   }


在tomcat下正常没有问题,但是在websphere下我跟踪到
sessionid是和登陆时一个sessionid,但是当session.getAttribute()时却为null,不知为什么??
1 楼 sotier 2008-07-21  
朋友,我和你遇到了同样的问题,你的问题解决了吗?


2 楼 sotier 2008-07-22  
为什么从 JavaEye 提了问题总是没人回答呢,是因为问题太简单了吗?
3 楼 liberydn 2008-08-27  
把你的sessionid前面增加上0000试试看。
4 楼 littlecong 2009-02-18  
可以改用url rewrite试试看
  相关解决方案