Application is developed using Spring MVC, JSP Servlets version 2.4 and uses Siteminder's SSO for authentication.
Problem: After session time out, the file download functionality is not working.
Expected behaviour: If user hit download button after session time elapsed, then the app should redirect to SSO login page and ask user credentials and once authenticated, then show the download dialog box.
Actual behaviour: If user hit download button after session time elapsed, then the app goes to a standstill, and i'll have to edit the url to reload the app(from its home page or the page from which download should happen). Simple reload of the page doesn't open the Download dialog box.
Controller:
@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
}
}