protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        response.setContentType("text/html;charset=UTF-8");
        String bookUuid = request.getParameter("bookUuid");
        HttpSession session = request.getSession();
        String email = (String) session.getAttribute("email");
        if(email == null)
        {
            response.sendError(503);
            return;
        }
        try
        {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

            Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost;user=sa;password=nopw");

            Statement st = con.createStatement();
            //CHECK TO SEE IF BOOK IS ACTIVE
            String query = "SELECT Active "
                    + "FROM [HardCover].[dbo].[Book] "
                    + "WHERE BookUuid = '" + bookUuid + "'";
            ResultSet isActive = st.executeQuery(query);
            isActive.next();
            if (!isActive.getBoolean("Active"))
            {
                response.sendError(502);
                return;
            }
            //CHECK TO SEE IF THERE ARE BOOKS AVAILABLE
            query = "SELECT NumCopies "
                    + " FROM [HardCover].[dbo].[Book] "
                    + "WHERE BookUuid = '" + bookUuid + "'";
            ResultSet NumberOfCopies = st.executeQuery(query);
            NumberOfCopies.next();
            if (NumberOfCopies.getInt("NumCopies") <= 0)
            {
                response.sendError(501);
                return;
            }
        } catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
        if (!updateCheckedOutBooks(email, bookUuid))
        {
            response.sendError(500);
            return;
        }
        //decrement number of books. increment timesborrowed.
        fixBookStatistics(bookUuid, request);

    }