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 = "/Package/Applyv2/{packageID}", method = RequestMethod.GET)
public String applyTempPackageToPreviewv2(@PathVariable int packageID, ModelMap model, HttpSession session) {
    try {//www  . ja  v a2  s .c  om
        if (!providerService.applyTempPackageToPreviewv2(packageID)) {
            return "{\"result\": \"error\"}";
        }
        return "provider/apply";
    } catch (Exception e) {
        String content = "Function: ProviderController - applyTempPackageToPreviewv2\n" + "***Input***\n"
                + "packageID: " + packageID + "\n" + "**********\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", method = RequestMethod.GET)
public String getAllProviderPackages(ModelMap map, HttpSession session) {
    try {//from  w w  w  . jav  a 2s.co  m
        AccountSession account = (AccountSession) session.getAttribute("account");
        map.addAttribute("packages", providerService.getPackagesOfProvider(account.getId()));
        map.addAttribute("page", "providerPackage");
        return "provider/providerPackage";
    } 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:Controller.ProviderController.java

@RequestMapping(value = "/ResourceManagement", method = RequestMethod.GET)
public String toResourceManagement(HttpServletRequest request, HttpSession session) {
    try {/*  w  ww .j av  a2  s. c om*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        int providerID = account.getId();
        request.setAttribute("resourceManagementData", providerService.getResourceManagementData(providerID));
        return "provider/resourceManagement";
    } catch (Exception e) {
        String content = "Function: ProviderController - toResourceManagement\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 = "/CertificateManagement", method = RequestMethod.GET)
public String getAllProviderCertificates(ModelMap map, HttpSession session) {
    try {// www  .  j  a  v a  2s.c  o  m
        AccountSession account = (AccountSession) session.getAttribute("account");
        map.addAttribute("certificates", providerService.getCertificatesOfProvider(account.getId()));
        map.addAttribute("page", "providerCertificate");
        return "provider/providerCertificate";
    } catch (Exception e) {
        String content = "Function: ProviderController - getAllProviderCertificates\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:Controller.ProviderController.java

@RequestMapping(value = "/Package/CheckExistBooking", method = RequestMethod.POST)
public @ResponseBody String checkBooking(ModelMap model, HttpSession session, @RequestBody final String data) {
    try {/*from  w ww  . ja  v a  2 s  .c om*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        if (!providerService.checkExistBooking(data, account.getId())) {
            return "{\"result\": \"OK\"}";
        } else {
            return "{\"result\": \"False\"}";
        }

    } 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 = "/PassportManagement")
public String accountInfo2(ModelMap map, HttpSession session) {
    try {/*w w  w  .  j a v  a  2  s .c o m*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        ProviderDTO result = providerService.getAccountInfo(account.getId());
        Gson gson = new Gson();
        map.addAttribute("AccountInfo", gson.toJson(result));
        map.addAttribute("page", "Info");
        return "provider/providerPassport";
    } catch (Exception e) {
        String content = "Function: ProviderController - accountInfo\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:Controller.ProviderController.java

@RequestMapping(value = "/UpdateCertificateInformation", method = RequestMethod.POST)
public String updateCertificateInformation(HttpServletRequest request, HttpSession session) {
    try {//from   w w w  .j a v a 2 s .c om
        providerService.updateCertificateInformation(request, session);
        if (request.getParameter("language") != null) {
            return "redirect:/Provider/CertificateManagement" + "?language=" + request.getParameter("language");
        } else {
            return "redirect:/Provider/CertificateManagement";
        }

    } catch (Exception e) {
        String content = "Function: ProviderController - updateCertificateInformation\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 = "/BookingManagement")
public String bookingManagement(HttpSession session, ModelMap map) {
    try {/*from  w  ww.ja  va  2  s. co  m*/
        AccountSession account = (AccountSession) session.getAttribute("account");
        int providerID = account.getId();
        map.addAttribute("bookingsOverview", providerService.getBookings(0, providerID));
        map.addAttribute("packages", providerService.getAllPackageOfProviderWithName(providerID));
        return "provider/bookingManagement";
    } catch (Exception e) {
        String content = "Function: ProviderController - bookingManagement\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:Controller.ProviderController.java

@RequestMapping(value = "/Package/ApplyPackageEditing", method = RequestMethod.POST)
public String applyPackageEditing(HttpServletRequest request, HttpSession session, ModelMap model) {
    try {//  w ww. jav  a2 s  . c o  m
        AccountSession account = (AccountSession) session.getAttribute("account");
        int providerID = account.getId();
        String packageIDStr = request.getParameter("packageID");
        int packageID = Integer.parseInt(packageIDStr);

        providerService.applyPackageEditing(packageID, providerID);
        return "provider/apply";
    } catch (Exception e) {
        String content = "Function: ProviderController - ApplyPackageEditing\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 = "/Booking")
public String booking(HttpSession session, ModelMap map) {
    try {// w w w  . j av a 2s  .com
        AccountSession account = (AccountSession) session.getAttribute("account");
        List<PackageDTO> listPackage = providerService.getPackageForStatictis(account.getId());
        Gson gson = new Gson();
        map.addAttribute("listPackage", gson.toJson(listPackage));
        map.addAttribute("page", "providerBookings");
        return "provider/booking";
    } catch (Exception e) {
        String content = "Function: ProviderController - booking\n" + "****Error****\n" + e.getMessage() + "\n"
                + "**********";
        map.addAttribute("errorID", session.getId());
        map.addAttribute("errorTime", errorService.logBugWithAccount(content, session, e));
        return "forward:/Common/Error";
    }
}