应用程序是使用Spring MVC,JSP Servlets 2.4版开发的,并使用Siteminder的SSO进行身份验证。
问题: 会话超时后,文件下载功能无效。
预期行为 如果用户在会话时间结束后点击下载按钮,则应用程序应重定向到SSO登录页面并询问用户凭据,并在进行身份验证后显示下载对话框。
实际行为 如果用户在会话时间过后点击下载按钮,那么应用程序将停止运行,我将不得不编辑该网址以重新加载应用程序(从其主页或应从中进行下载的页面)。简单地重新加载页面不会打开“下载”对话框。
控制器:
@RequestMapping(value ="/DownloadReport.spr", method = RequestMethod.GET)
public String populateList(
HttpServletRequest request,
ModelMap model)
{
httpSession = request.getSession();
//get data to be populated into List is added to httpSession object.
return "viewName" ;
}
@SuppressWarnings("unchecked")
@RequestMapping(value="/ReportDownload.spr", method = {RequestMethod.GET } )
public void downlodReport(
HttpServletResponse response,
HttpServletRequest request,
@ModelAttribute (value="DataList") ArrayList<ClassObj> dataList,
ModelMap model
)
{
FileTO fileTO = new FileTO ();
httpSession = request.getSession();
dataList = (ArrayList<ClassObj>) httpSession.getAttribute("ReportList") ;
if( dataList!= null ){
if(dataList.isEmpty())
{
//show no data msg.
}
else{
try
{
if( dataList.size() > 0 )
{
//call method to handle downloading data from java objects
fileTO.excelFormat(request.getSession(), request, response, dataList);
model.addAttribute("dataList", dataList);
}
}catch(Exception e) {
//handle exception
}
} // end of else
}
else{
System.out.println(" dataList is null , since session expired");
// after session expires control reaches here
}
}
答案 0 :(得分:0)
SiteMinder会话到期后,任何请求都不会到达受保护的应用程序。所有请求(包括AJAX)都将导致在应用程序前运行的SiteMinder代理进行302重定向。
这里出现两种典型问题: