If the logger is currently enabled for the FINE message level then the given message is forwarded to all the registered output Handler objects.
@param msg The string message (or a key in the message catalog)
1920212223242526272829
private static final long serialVersionUID = 1L; @Override public String getUsername(String accessToken) { Logger logger = Logger.getLogger(FacebookServiceImpl.class.getName()); logger.fine("Retrieving username for facebook acces token : " + accessToken); String username; try { username = FacebookHelper.getUsername(accessToken); } catch (FacebookOAuthException e) {
3334353637383940414243
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Logger logger = Logger.getLogger(RegisterPlayerServlet.class.getName()); logger.fine("Got request from url : " + req.getRequestURL().toString()); handleRegularRegistration(req,resp); }
4445464748495051525354
private void handleRegularRegistration(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Logger logger = Logger.getLogger(RegisterPlayerServlet.class.getName()); logger.fine("started handling regular registration request"); PrintWriter out = resp.getWriter(); /* Get registration details from the request */ String name = req.getParameter("nickname");;
5455565758596061626364
String name = req.getParameter("nickname");; Long score = Long.parseLong(req.getParameter("score"));; String email = req.getParameter("email"); String password = req.getParameter("password"); logger.fine("request parameters are : name=" + name + " | " + "score=" + score + " | " + "email=" + email + " | " + "password=" + password); /* Validate the form server side */ List<String> errors = FormValidator.validateForm(name, email, password); if (errors.size() == 0) { // no erros, can register
6162636465666768697071
/* Validate the form server side */ List<String> errors = FormValidator.validateForm(name, email, password); if (errors.size() == 0) { // no erros, can register logger.fine("the request has been validated on the server, adding to database"); /* Remove this cookie, it will be replace with the "highscore" cookie */ CookieUtils.eraseCookie(req, resp, "tempScore"); /* Create a regular player */
7879808182838485868788
resp.addCookie(new Cookie("nickname", name)); resp.addCookie(new Cookie("highscore", score + "")); if (email.equals("")) { // A player has not registered for notification, no need to send validation mail logger.fine("added to databse succesfully"); out.println("Congrats, you have registered succesfully"); out.println("<a href='http://stewiemaze.appspot.com'>Return to game</a>"); } else {
8687888990919293949596
out.println("<a href='http://stewiemaze.appspot.com'>Return to game</a>"); } else { try { // A player has registered for notifications, needs to verify the given email logger.fine("added to databse succesfully"); logger.fine("sending an activation email to :" + email); MailUtils.sendValidationMail(email, name); out.println("Please verify your account by reading the message we have just sent you"); out.println("<br>");
8788899091929394959697
} else { try { // A player has registered for notifications, needs to verify the given email logger.fine("added to databse succesfully"); logger.fine("sending an activation email to :" + email); MailUtils.sendValidationMail(email, name); out.println("Please verify your account by reading the message we have just sent you"); out.println("<br>"); out.println("After that, click <a href='http://2.stewiemaze.appspot.com'>Here</a> to return to the game");
106107108109110111112113114115116
} } else { // Errors exist in the form, let the user know and offer to return to the application. the users score is saved in the tmpScore cookie for (String error : errors) { logger.fine("request validation failed on the server"); out.println(error); out.println("<a href='http://stewiemaze.appspot.com'>Return to game</a>"); } }
4243444546474849505152
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Logger logger = Logger.getLogger(RegisterFacebookPlayerServlet.class.getName()); logger.fine("Got request from url : " + req.getRequestURL().toString()); handleFacebookRegistration(req,resp); }