package examples.servlets; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import weblogic.utils.*; import weblogic.html.*; import weblogic.common.*; import weblogic.event.common.*; /** * This example demonstrates sending an event to the WebLogic Server * containing all of the available header information of a request * to the servlet. It uses an * EventMessage to send information to WebLogic about the hits on * this page; whomever has registered an interest in the event * "HTTPWATCH" receives notification of the event, along with the * collected information. *
* To run this example, compile it and register the servlet with the * initArg "imagefile" set to a local image file on your WebLogic Server * host. Then start WebLogic. At a command-line prompt, start the * WebLogic utility, eventsnoop, and register an interest in the * page-related events with the following command: *
$ java utils.eventsnoop t3://localhost:7001 HTTPWATCH* where t3://localhost:7001 corresponds to the host and port * of your running WebLogic Server. Then access the page. You'll see * the resulting events in the command window. *
* WebLogic also has a builtin service that allows you to register an * interest in HTTP events and have them logged in common log format * to an HTTP log. For more info, read the WebLogic Administrators * Guide document, Setting * up WebLogic as an HTTP server. * * @author Copyright (c) 1996-98 by WebLogic, Inc. All Rights Reserved. * @author Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved. */ public class PageEvent extends HttpServlet { /** * Implements the service method. */ public void service(HttpServletRequest req, HttpServletResponse res) throws IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println("