Example usage for javax.servlet.http HttpSession getId

List of usage examples for javax.servlet.http HttpSession getId

Introduction

In this page you can find the example usage for javax.servlet.http HttpSession getId.

Prototype

public String getId();

Source Link

Document

Returns a string containing the unique identifier assigned to this session.

Usage

From source file:Controller.ProviderController.java

@RequestMapping(value = "/LoadTopLeftBooking", method = RequestMethod.POST)
public @ResponseBody String loadTopLeftBooking(ModelMap model, HttpSession session,
        @RequestBody final String data) {
    try {//from w  w w.  ja  v  a  2 s  .  c o  m
        String result = providerService.loadTopLeftBooking(data);
        return result;
    } catch (Exception e) {
        String content = "Function: ProviderController - loadTopLeftBooking\n" + "****Error****\n"
                + e.getMessage() + "\n" + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/Package/InsertEditingReason", method = RequestMethod.POST)
public @ResponseBody String insertEditingReason(ModelMap model, HttpSession session,
        @RequestBody final String data) {
    try {//from w  ww.  j  av a  2 s  .  c  o  m
        providerService.insertEditingReason(data);
        return "{\"result\": \"OK\"}";
    } catch (Exception e) {
        String content = "Function: ProviderController - insertEditingReason\n" + "****Error****\n"
                + e.getMessage() + "\n" + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/LoadStatisticsInTripDash", method = RequestMethod.POST)
public @ResponseBody String loadStatisticsInTripDash(ModelMap model, HttpSession session,
        @RequestBody final String data) {
    try {//  w ww.jav  a 2  s  . c o  m
        System.out.println("data" + data);
        return providerService.loadStatisticsInTripDash(data);
    } catch (Exception e) {
        String content = "Function: ProviderController - loadStatisticsInTripDash\n" + "****Error****\n"
                + e.getMessage() + "\n" + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/SaveSetting", method = RequestMethod.POST)
public String saveSetting(HttpServletRequest request) {
    try {//from   ww  w  . ja  v a 2  s .  co  m
        int providerID;
        try {
            providerID = Integer.parseInt(request.getParameter("providerID"));
        } catch (NumberFormatException e) {
            providerID = 0;
        }
        providerService.saveSetting(providerID, request.getParameter("settingJson"));
        if (request.getParameter("language") != null) {
            return "redirect:/Provider/Notification" + "?language=" + request.getParameter("language");
        } else {
            return "redirect:/Provider/Notification";
        }

    } catch (Exception e) {
        HttpSession session = request.getSession();
        String content = "Function: ProviderController - saveSetting\n" + "***Input***\n" + "providerID: "
                + request.getParameter("providerID") + "\n" + "settingJson: "
                + request.getParameter("settingJson") + "\n" + "**********\n" + "****Error****\n"
                + e.getMessage() + "\n" + "**********";
        request.setAttribute("errorID", session.getId());
        request.setAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/Package/Deleting", method = RequestMethod.POST)
public @ResponseBody String deletePackage(ModelMap model, HttpSession session, @RequestBody final String data) {
    try {/*from w w  w . j  a v a2 s .  com*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        providerService.deletePackage(data, account.getId());
        return "{\"result\": \"OK\"}";

    } catch (Exception e) {
        String content = "Function: ProviderController - Deleting\n" + "****Error****\n" + e.getMessage() + "\n"
                + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/Package/Stopping", method = RequestMethod.POST)
public @ResponseBody String stopPackage(ModelMap model, HttpSession session, @RequestBody final String data) {
    try {//from   www. j  a va  2 s  . c  om
        AccountSession account = (AccountSession) session.getAttribute("account");
        providerService.stopPackage(data, account.getId());
        return "{\"result\": \"OK\"}";

    } catch (Exception e) {
        String content = "Function: ProviderController - editPackage\n" + "****Error****\n" + e.getMessage()
                + "\n" + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/Package/Starting", method = RequestMethod.POST)
public @ResponseBody String startPackage(ModelMap model, HttpSession session, @RequestBody final String data) {
    try {/*from www. j  a v a  2 s .c  o  m*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        providerService.startPackage(data, account.getId());
        return "{\"result\": \"OK\"}";

    } catch (Exception e) {
        String content = "Function: ProviderController - editPackage\n" + "****Error****\n" + e.getMessage()
                + "\n" + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/CountPackage", method = RequestMethod.POST)
public @ResponseBody String getNumberOfPackage(ModelMap map, HttpSession session) {
    try {/*from www . ja v  a2  s .  c  om*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        int numberOfpackage = providerService.countNumberOfPackage(account.getId());

        return "{\"result\": " + numberOfpackage + "}";
    } catch (Exception e) {
        String content = "Function: ProviderController - getAllProviderPackages\n" + "****Error****\n"
                + e.getMessage() + "\n" + "**********";
        map.addAttribute("errorID", session.getId());
        map.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}

From source file:edu.umich.ctools.sectionsUtilityTool.SectionsUtilityToolServlet.java

private boolean isCrosslistAllowed(HttpServletRequest request, HttpSession session, String url) {
    boolean isSectionMatch = false;

    //build api call
    String crosslistApiCall = canvasURL + url.substring(0, url.indexOf("/crosslist"));
    M_log.debug("crosslist API call: " + crosslistApiCall);

    String uniqname = null;/*  w w w.  ja  v a  2s  .c  o  m*/
    TcSessionData tc = (TcSessionData) request.getSession().getAttribute(TC_SESSION_DATA);
    if (tc != null) {
        uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID);
    }

    logApiCall(uniqname, url, request);
    HttpUriRequest clientRequest = null;

    clientRequest = new HttpGet(crosslistApiCall);

    HttpResponse canvasResponse = processApiCall(clientRequest);
    BufferedReader rd = null;
    try {
        rd = new BufferedReader(new InputStreamReader(canvasResponse.getEntity().getContent()));
    } catch (IOException e) {
        M_log.error("Canvas API call did not complete successfully", e);
    } catch (NullPointerException e) {
        M_log.error("Canvas API call did not complete successfully", e);
    }

    String line = "";
    StringBuilder sb = new StringBuilder();

    try {
        while ((line = rd.readLine()) != null) {
            sb.append(line);
        }
    } catch (IOException e) {
        M_log.error("Canvas API call did not complete successfully", e);
    }
    M_log.debug("RESPONSE TO isCrosslistAllowed: " + sb.toString());

    String sisSectionId = null;
    try {
        JSONObject crosslistSectionResponse = new JSONObject(sb.toString());
        sisSectionId = crosslistSectionResponse.getString("sis_section_id");
    } catch (JSONException e) {
        M_log.error("JSONException found attempting to process sectionsCallResponse");
        return false;
    }
    M_log.debug("SIS SECTION ID: " + sisSectionId);

    M_log.debug("session id: " + session.getId());
    ArrayList<String> courses = (ArrayList<String>) session.getAttribute(M_PATH_DATA);
    if (M_log.isDebugEnabled()) {
        if (courses != null) {
            for (String section : courses) {
                M_log.debug("CrossSection: " + section);
            }
        }
    }

    if (courses.contains(sisSectionId)) {
        M_log.info("SECTION MATCH FOUND - CROSSLIST CALL ALLOWED");
        isSectionMatch = true;
    } else {
        M_log.info("API CALL REJECTED DUE TO CROSSLIST MISMATCH");
        isSectionMatch = false;
    }

    return isSectionMatch;
}

From source file:Controller.ProviderController.java

@RequestMapping(value = "/Package/DeletingTempPackage", method = RequestMethod.POST)
public @ResponseBody String deleteTemporaryPackage(ModelMap model, HttpSession session,
        @RequestBody final String data) {
    try {/*from   www  . ja v a 2  s  .  c o m*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        providerService.deleteTemporaryPackage(data, account.getId());
        return "{\"result\": \"OK\"}";

    } catch (Exception e) {
        String content = "Function: ProviderController - DeletingTempPackage\n" + "****Error****\n"
                + e.getMessage() + "\n" + "**********";
        model.addAttribute("errorID", session.getId());
        model.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}