/******************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2013,2014 by Peter Pilgrim, Addiscombe, Surrey, XeNoNiQUe UK * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU GPL v3.0 * which accompanies this distribution, and is available at: * http://www.gnu.org/licenses/gpl-3.0.txt * * Developers: * Peter Pilgrim -- design, development and implementation * -- Blog: http://www.xenonique.co.uk/blog/ * -- Twitter: @peter_pilgrim * * Contributors: * *******************************************************************************/ package je7hb.websocket.basic; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date; /** * The type FakeServlet * * @author Peter Pilgrim */ @WebServlet("/fake") public class FakeServlet extends HttpServlet { @Inject @ApplicationScoped private ChatRoom chatRoom; @Override public void init(ServletConfig config) throws ServletException { super.init(config); System.out.printf("%s.init() called with chatRoom=%s\n", getClass().getSimpleName(), chatRoom); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/plain"); resp.getWriter().printf("Date: %s Servlet %s with chatRoom=%s\n", new Date(), getClass(), chatRoom ); } }