Package org.mortbay.jetty.handler

Examples of org.mortbay.jetty.handler.RequestLogHandler


    contextDeployer.setScanInterval(10);
   
    contexts.setServer(server);
    */

    RequestLogHandler requestLogHandler = new RequestLogHandler();
    handlers.setHandlers(new Handler[]
    {
      contexts, new DefaultHandler(), requestLogHandler
    });
    server.setHandler(handlers);
View Full Code Here


                    server.addConnector(connector);
                }

            } else if ("request-log".equals(props.value)) {

                RequestLogHandler requestLogHandler = new RequestLogHandler();

                NCSARequestLog requestLog = new NCSARequestLog();

                if (props.getProperty("filename") != null) {
                    requestLog.setFilename(props.getProperty("filename").value);
                }

                if (props.getProperty("append") != null) {
                    requestLog.setAppend("true".equalsIgnoreCase(props.getProperty("append").value));
                }

                if (props.getProperty("extended") != null) {
                    requestLog.setExtended("true".equalsIgnoreCase(props.getProperty("extended").value));
                }

                if (props.getProperty("timezone") != null) {
                    requestLog.setLogTimeZone(props.getProperty("timezone").value);
                }

                if (props.getProperty("date-format") != null) {
                    requestLog.setLogDateFormat(props.getProperty("date-format").value);
                }

                if (props.getProperty("retain-days") != null) {
                    int days = 90;
                    try {
                        days = Integer.parseInt(props.getProperty("retain-days").value);
                    } catch (NumberFormatException e) {
                        days = 90;
                    }
                    requestLog.setRetainDays(days);
                }

                requestLogHandler.setRequestLog(requestLog);
                server.addHandler(requestLogHandler);
            }
        }

        return server;
View Full Code Here

        // commenting out; this grabs '/' but we might want to use it ourselves,
        // instead?
        // handlers.addHandler(new DefaultHandler());

        // TODO use properties to set up
        final RequestLogHandler requestLogHandler = new RequestLogHandler();
        handlers.addHandler(requestLogHandler);
        final NCSARequestLog requestLog = new NCSARequestLog("./logs/jetty-yyyy_mm_dd.request.log");
        requestLog.setRetainDays(90);
        requestLog.setAppend(true);
        requestLog.setExtended(false);
        requestLog.setLogTimeZone("GMT");
        requestLogHandler.setRequestLog(requestLog);

        return handlers;
    }
View Full Code Here

    {
        server = new Server(0);
            
        HandlerCollection handlers = new HandlerCollection();
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        RequestLogHandler requestLogHandler = new RequestLogHandler();
        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler(),requestLogHandler});
        server.setHandler(handlers);
       
        test0 = new WebAppContext(contexts,"../../webapps/test","/test0");
        test1 = new WebAppContext(contexts,"../../webapps/test","/test1");
View Full Code Here

        configureHandlers();
    }

    private void configureHandlers()
    {
        RequestLogHandler requestLogHandler = new RequestLogHandler();
        if (requestLog != null)
        {
            requestLogHandler.setRequestLog(requestLog);
        }

        contexts = (ContextHandlerCollection) server
                .getChildHandlerByClass(ContextHandlerCollection.class);
        if (contexts == null)
View Full Code Here

        ssl_b_connector.setTrustPassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        server.addConnector(ssl_b_connector)
       
        HandlerCollection handlers = new HandlerCollection();
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        RequestLogHandler requestLogHandler = new RequestLogHandler();
        handlers.setHandlers(new Handler[]{contexts,new DefaultHandler(),requestLogHandler});
        server.setHandler(handlers);
       
        ContextDeployer deployer0 = new ContextDeployer();
        deployer0.setContexts(contexts);
        deployer0.setConfigurationDir(jetty_home+"/contexts");
        deployer0.setScanInterval(1);
        server.addLifeCycle(deployer0);  
       
        WebAppDeployer deployer1 = new WebAppDeployer();
        deployer1.setContexts(contexts);
        deployer1.setWebAppDir(jetty_home+"/webapps");
        deployer1.setParentLoaderPriority(false);
        deployer1.setExtract(true);
        deployer1.setAllowDuplicates(false);
        deployer1.setDefaultsDescriptor(jetty_home+"/etc/webdefault.xml");
        server.addLifeCycle(deployer1);
         
        HashUserRealm userRealm = new HashUserRealm();
        userRealm.setName("Test Realm");
        userRealm.setConfig(jetty_home+"/etc/realm.properties");
        server.setUserRealms(new UserRealm[]{userRealm});
       
        NCSARequestLog requestLog = new NCSARequestLog(jetty_home+"/logs/jetty-yyyy_mm_dd.log");
        requestLog.setExtended(false);
        requestLogHandler.setRequestLog(requestLog);
       
        server.setStopAtShutdown(true);
        server.setSendServerVersion(true);
       
        server.start();
View Full Code Here

     * @throws Exception
     */
    public void configureHandlers () throws Exception
    {
        this.defaultHandler = new DefaultHandler();
        this.requestLogHandler = new RequestLogHandler();
        if (this.requestLog != null)
            this.requestLogHandler.setRequestLog(this.requestLog);
       
        this.contexts = (ContextHandlerCollection)server.getChildHandlerByClass(ContextHandlerCollection.class);
        if (this.contexts==null)
View Full Code Here

    // Create a new web app in the war directory.
    WebAppContext wac = new WebAppContextWithReload(logger,
        appRootDir.getAbsolutePath(), "/");

    RequestLogHandler logHandler = new RequestLogHandler();
    logHandler.setRequestLog(new JettyRequestLogger(logger, getBaseLogLevel()));
    logHandler.setHandler(wac);
    server.setHandler(logHandler);
    server.start();
    server.setStopAtShutdown(true);

    // Now that we're started, log to the top level logger.
View Full Code Here

    // Create a new web app in the war directory.
    WebAppContext wac = new WebAppContextWithReload(logger,
        appRootDir.getAbsolutePath(), "/");

    RequestLogHandler logHandler = new RequestLogHandler();
    logHandler.setRequestLog(new JettyRequestLogger(logger));
    logHandler.setHandler(wac);
    server.setHandler(logHandler);
    server.start();
    server.setStopAtShutdown(true);

    // Now that we're started, log to the top level logger.
View Full Code Here

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    RequestLog requestLog = HttpRequestLog.getRequestLog(name);

    if (requestLog != null) {
      RequestLogHandler requestLogHandler = new RequestLogHandler();
      requestLogHandler.setRequestLog(requestLog);
      HandlerCollection handlers = new HandlerCollection();
      handlers.setHandlers(new Handler[] {contexts, requestLogHandler});
      webServer.setHandler(handlers);
    } else {
      webServer.setHandler(contexts);
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.handler.RequestLogHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.