// Path: mvc/Servlet30HelloWorld/src/main/java/com/sample/utils/ServletConstants.java
// public class ServletConstants {
// 
//     private ServletConstants() {
//         // Don't init
//     }
// 
//     /**
//      * Generate a new session ID
//      *
//      * @return
//      */
//     public static String getNewSessionID() {
//         return String.valueOf(Math.random()).replace('.', '\0');
//     }
// 
// }


import com.sample.utils.ServletConstants;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
package com.sample.servlets;



/**
 * A startup servlet that will have its init method
 * called as soon as the container attempts to load the application
 * <p>
 * The purpose of this servlet is to add a few params to the
 * application context
 *
 * @author saifasif
 */
@WebServlet(loadOnStartup = 1, value = "/startup")
public class StartupServlet extends HttpServlet {

    private static final long serialVersionUID = 114128950806179598L;
    private static final Logger log = Logger.getLogger(StartupServlet.class);

    @Override
    public void init() throws ServletException {
        log.info("Initiating startup servlet");
        getServletConfig().getServletContext().setAttribute("applicationName", "Test-App");
        getServletConfig().getServletContext().setAttribute("applicationVersion", "1.0.0");
// Path: mvc/Servlet30HelloWorld/src/main/java/com/sample/utils/ServletConstants.java
// public class ServletConstants {
// 
//     private ServletConstants() {
//         // Don't init
//     }
// 
//     /**
//      * Generate a new session ID
//      *
//      * @return
//      */
//     public static String getNewSessionID() {
//         return String.valueOf(Math.random()).replace('.', '\0');
//     }
// 
// }


// Path: mvc/Servlet30HelloWorld/src/main/java/com/sample/servlets/StartupServlet.java
import com.sample.utils.ServletConstants;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;

package com.sample.servlets;



/**
 * A startup servlet that will have its init method
 * called as soon as the container attempts to load the application
 * <p>
 * The purpose of this servlet is to add a few params to the
 * application context
 *
 * @author saifasif
 */
@WebServlet(loadOnStartup = 1, value = "/startup")
public class StartupServlet extends HttpServlet {

    private static final long serialVersionUID = 114128950806179598L;
    private static final Logger log = Logger.getLogger(StartupServlet.class);

    @Override
    public void init() throws ServletException {
        log.info("Initiating startup servlet");
        getServletConfig().getServletContext().setAttribute("applicationName", "Test-App");
        getServletConfig().getServletContext().setAttribute("applicationVersion", "1.0.0");
        getServletConfig().getServletContext().setAttribute("sessionID", ServletConstants.getNewSessionID());