use of javax.servlet.http.HttpSession in project OpenAttestation by OpenAttestation.
the class WLMDataController method logOutUser.
public ModelAndView logOutUser(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.logOutUser >>");
ModelAndView responseView = new ModelAndView("Login");
try {
HttpSession session = req.getSession(false);
if (session != null) {
session.invalidate();
}
//res.sendRedirect(req.getContextPath()+"/login.htm");
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
}
log.info("WLMDataController.logOutUser <<");
return responseView;
}
use of javax.servlet.http.HttpSession in project OpenAttestation by OpenAttestation.
the class WLMDataController method getPartitionListOfAllMle.
/**
* Method to get a Map View for all MLE data from REST Services according to there page no.
* Return data is used in pagination.
*
* @param req object of HttpServletRequest
* @return
* @throws WLMPortalException
*/
private Map<Integer, List<MLEDataVO>> getPartitionListOfAllMle(HttpServletRequest req) throws WLMPortalException {
Map<Integer, List<MLEDataVO>> map = new HashMap<Integer, List<MLEDataVO>>();
//Get List of all MLE.
List<MLEDataVO> dataVOs = mleClientService.getAllMLE(getWhitelistService(req));
int no_row_per_page = WLMPConfig.getConfiguration().getInt("mtwilson.wlmp.pagingSize");
//Divide List of all MLE into a subList based on the value of host per page.
List<List<MLEDataVO>> list = Lists.partition(dataVOs, no_row_per_page);
//Creating a Map view of MLE list based on the Page No.
int i = 1;
for (List<MLEDataVO> listForMap : list) {
map.put(i, listForMap);
i++;
}
//setting map into session attribute;
HttpSession session = req.getSession();
session.setAttribute("MleList", map);
return map;
}
use of javax.servlet.http.HttpSession in project OpenAttestation by OpenAttestation.
the class WLMDataController method getViewOSForPageNo.
@SuppressWarnings("unchecked")
public ModelAndView getViewOSForPageNo(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getViewOSForPageNo >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
HttpSession session = req.getSession();
Map<Integer, List<MLEDataVO>> map = (Map<Integer, List<MLEDataVO>>) session.getAttribute("OSList");
responseView.addObject("OSDataVo", map.get(Integer.parseInt(req.getParameter("pageNo"))));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("OSDataVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("WLMDataController.getViewOSForPageNo <<");
return responseView;
}
use of javax.servlet.http.HttpSession in project druid by alibaba.
the class AbstractWebStatImpl method getSessionId.
public String getSessionId(HttpServletRequest httpRequest) {
String sessionId = null;
HttpSession session = httpRequest.getSession(createSession);
if (session != null) {
sessionId = session.getId();
}
return sessionId;
}
use of javax.servlet.http.HttpSession in project dubbo by alibaba.
the class ServicePrivilegeCheckValve method invokeCheckServicePrivilege.
private void invokeCheckServicePrivilege(User user) {
TurbineRunData rundata = getTurbineRunData(request);
HttpSession session = request.getSession();
@SuppressWarnings("unchecked") Map<String, String[]> requestMapping = request.getParameterMap();
//记录上次操作到请求中
String returnURL = "";
if (session.getAttribute("returnURL") == null) {
returnURL = request.getContextPath();
} else {
returnURL = (String) session.getAttribute("returnURL");
}
if (requestMapping.get("service").length > 0) {
String service = ((String[]) requestMapping.get("service"))[0];
String method = "index";
if (requestMapping.get("_method").length > 0) {
method = requestMapping.get("_method")[0];
}
boolean exclude = "index".equals(method) || "show".equals(method);
if (!exclude) {
if (user != null && !user.hasServicePrivilege(service)) {
request.setAttribute("returnURL", returnURL);
redirectToNoRight(rundata);
}
}
}
String type = requestMapping.get("_type").length == 0 ? null : requestMapping.get("_type")[0];
if (!"noServicePrivilege".equals(type)) {
session.setAttribute("returnURL", request.getRequestURI());
}
return;
}
Aggregations