use of javax.servlet.http.HttpSession in project MSEC by Tencent.
the class ReleaseStepsGO method doStep5.
private ReleaseStepsGOResponse doStep5(ReleasePlan request) {
ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
//把计划保存到session里
HttpSession session = getHttpRequest().getSession();
ReleasePlan plan = (ReleasePlan) session.getAttribute("plan");
if (plan == null) {
response.setMessage("can NOT find the session, it maybe timeout.");
response.setStatus(100);
return response;
}
//System.out.println("plan id in session:"+plan.getPlan_id());
if (request.getSharedobject_tag() == null || request.getSharedobject_tag().length() < 1) {
response.setMessage("idl tag is empty!");
response.setStatus(100);
return response;
}
plan.setSharedobject_tag(request.getSharedobject_tag());
plan.setMemo(request.getMemo());
//跳过第三步:选择IDL文件版本,所以在这里设置一下
plan.setIdl_tag("");
//check if saved
ReleasePlan plan2 = (ReleasePlan) session.getAttribute("plan");
//System.out.println("so tag:"+plan2.getSharedobject_tag());
// Commit Plan
String commitResult = CommitPlan(plan2);
if (commitResult == null || !commitResult.equals("success")) {
response.setMessage("commit failed:" + (commitResult == null ? "" : commitResult));
response.setStatus(100);
return response;
}
response.setPlanDetail(plan2);
response.setMessage("success");
response.setStatus(0);
return response;
}
use of javax.servlet.http.HttpSession in project MSEC by Tencent.
the class ReleaseStepsGO method doStep3.
private ReleaseStepsGOResponse doStep3(ReleasePlan request) {
ReleaseStepsGOResponse response = new ReleaseStepsGOResponse();
//把计划保存到session里
HttpSession session = getHttpRequest().getSession();
ReleasePlan plan = (ReleasePlan) session.getAttribute("plan");
if (plan == null) {
response.setMessage("can NOT find the session, it maybe timeout.");
response.setStatus(100);
return response;
}
//System.out.println("plan id in session:" + plan.getPlan_id());
if (request.getIdl_tag() == null || request.getIdl_tag().length() < 1) {
response.setMessage("idl tag is empty!");
response.setStatus(100);
return response;
}
plan.setIdl_tag(request.getIdl_tag());
//check if saved
ReleasePlan plan2 = (ReleasePlan) session.getAttribute("plan");
//System.out.println("idl tag:" + plan2.getIdl_tag());
response.setMessage("success");
response.setStatus(0);
return response;
}
use of javax.servlet.http.HttpSession in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getAttestationService.
/**
* This method will return a AttestationService/ApiClient Object from a Session.
* This object is stored into Session at time of user login.
* Check CheckLoginController.java for more Clarification.
*
* @param req
* @return
* @return AttestationService
* @throws DemoPortalException
*/
@SuppressWarnings("unchecked")
private <T> T getAttestationService(HttpServletRequest req, Class<T> type) throws DemoPortalException {
//getting already created session object by passing false while calling into getSession();
HttpSession session = req.getSession(false);
T service = null;
if (session != null) {
try {
//getting ApiClient Object from Session and downcast that object to Type T.
service = (T) session.getAttribute("apiClientObject");
} catch (Exception e) {
log.error("Error while creating ApiCliennt Object. " + e.getMessage());
throw new DemoPortalException("Error while creating ApiCliennt Object. " + e.getMessage(), e);
}
}
return service;
}
use of javax.servlet.http.HttpSession in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getTrustedCertificates.
/**
* This method will return a X509Certificate Object from a Request Session.
* This object is stored into Session at time of user login.
* Check CheckLoginController.java for more Clarification.
*
* @param req
* @return
* @throws DemoPortalException
*/
private X509Certificate[] getTrustedCertificates(HttpServletRequest req) throws DemoPortalException {
HttpSession session = req.getSession(false);
X509Certificate[] trustedCertificate;
if (session != null) {
try {
//getting Object from Session and downcast that object to X509Certificate.
trustedCertificate = (X509Certificate[]) session.getAttribute("trustedCertificates");
} catch (Exception e) {
log.error("Error while creating ApiCliennt Object. " + e.getMessage());
throw new DemoPortalException("Error while creating ApiCliennt Object. " + e.getMessage(), e);
}
} else {
return null;
}
return trustedCertificate;
}
use of javax.servlet.http.HttpSession in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getHostForViewForPage.
/**
* Method to get Host list to for View Host Page for given page no.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getHostForViewForPage(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getHostForViewForPage >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
int selectedPage = Integer.parseInt(req.getParameter("pageNo"));
HttpSession session = req.getSession();
@SuppressWarnings("unchecked") Map<Integer, List<HostDetailsEntityVO>> mapOfData = (Map<Integer, List<HostDetailsEntityVO>>) session.getAttribute("HostVoList");
responseView.addObject("hostVo", mapOfData.get(selectedPage));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("hostVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getHostForViewForPage<<<");
return responseView;
}
Aggregations