protected String getExcelPath(String fileName) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String realPath = RequestUtils.getRealPath(request);
return realPath+"/WEB-INF/views/template/" + fileName + ExportExcelUtil.EXTENSION_XLSX;
}
public static String getRealPath(HttpServletRequest servletRequest){
String realPath = servletRequest.getSession().getServletContext().getRealPath("/");
if (realPath == null) {
try {
// 支持Weblogic
realPath = servletRequest.getSession().getServletContext().getResource("/").getPath();
} catch (MalformedURLException e) {
realPath= "";
}
}
return realPath;
}
