当前位置: 首页>>代码示例>>Java>>正文


Java RequestLogHandler类代码示例

本文整理汇总了Java中org.mortbay.jetty.handler.RequestLogHandler的典型用法代码示例。如果您正苦于以下问题:Java RequestLogHandler类的具体用法?Java RequestLogHandler怎么用?Java RequestLogHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RequestLogHandler类属于org.mortbay.jetty.handler包,在下文中一共展示了RequestLogHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureHandlers

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
/**
 * Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
 * if we hit the root and the webapp's context isn't at root.
 */
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) {
        this.contexts = new ContextHandlerCollection();
        this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        if (this.handlers == null) {
            this.handlers = new HandlerCollection();
            this.server.setHandler(handlers);
            this.handlers.setHandlers(new Handler[]{this.contexts, this.defaultHandler, this.requestLogHandler});
        } else {
            this.handlers.addHandler(this.contexts);
        }
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:Jetty6PluginServer.java

示例2: createRequestLogHandler

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
protected RequestLogHandler createRequestLogHandler(){
    boolean showRequestLog = Boolean.getBoolean("requestLog");
    if(!showRequestLog){
        return null;
    }

    NCSARequestLog requestLog = new NCSARequestLog();
    requestLog.setLogDateFormat(null);

    RequestLogHandler logHandler = new RequestLogHandler();
    logHandler.setRequestLog(requestLog);

    return logHandler;
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:15,代码来源:AbstractServerMojo.java

示例3: initializeWebServer

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
private void initializeWebServer(String name, String hostName,
    Configuration conf, String[] pathSpecs)
    throws IOException {

  Preconditions.checkNotNull(webAppContext);

  int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
  // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
  // default value (currently 250).
  QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
      : new QueuedThreadPool(maxThreads);
  threadPool.setDaemon(true);
  webServer.setThreadPool(threadPool);

  SessionManager sm = webAppContext.getSessionHandler().getSessionManager();
  if (sm instanceof AbstractSessionManager) {
    AbstractSessionManager asm = (AbstractSessionManager)sm;
    asm.setHttpOnly(true);
    asm.setSecureCookies(true);
  }

  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);
  }

  final String appDir = getWebAppsPath(name);

  webServer.addHandler(webAppContext);

  addDefaultApps(contexts, appDir, conf);

  addGlobalFilter("safety", QuotingInputFilter.class.getName(), null);
  final FilterInitializer[] initializers = getFilterInitializers(conf);
  if (initializers != null) {
    conf = new Configuration(conf);
    conf.set(BIND_ADDRESS, hostName);
    for (FilterInitializer c : initializers) {
      c.initFilter(this, conf);
    }
  }

  addDefaultServlets();

  if (pathSpecs != null) {
    for (String path : pathSpecs) {
      LOG.info("adding path spec: " + path);
      addFilterPathMapping(path, webAppContext);
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:60,代码来源:HttpServer2.java

示例4: initializeWebServer

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
private void initializeWebServer(String name, String hostName,
    Configuration conf, String[] pathSpecs)
    throws FileNotFoundException, IOException {

  Preconditions.checkNotNull(webAppContext);

  int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
  // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
  // default value (currently 250).
  QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
      : new QueuedThreadPool(maxThreads);
  threadPool.setDaemon(true);
  webServer.setThreadPool(threadPool);

  SessionManager sm = webAppContext.getSessionHandler().getSessionManager();
  if (sm instanceof AbstractSessionManager) {
    AbstractSessionManager asm = (AbstractSessionManager)sm;
    asm.setHttpOnly(true);
    asm.setSecureCookies(true);
  }

  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);
  }

  final String appDir = getWebAppsPath(name);

  webServer.addHandler(webAppContext);

  addDefaultApps(contexts, appDir, conf);

  addGlobalFilter("safety", QuotingInputFilter.class.getName(), null);
  final FilterInitializer[] initializers = getFilterInitializers(conf);
  if (initializers != null) {
    conf = new Configuration(conf);
    conf.set(BIND_ADDRESS, hostName);
    for (FilterInitializer c : initializers) {
      c.initFilter(this, conf);
    }
  }

  addDefaultServlets();

  if (pathSpecs != null) {
    for (String path : pathSpecs) {
      LOG.info("adding path spec: " + path);
      addFilterPathMapping(path, webAppContext);
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:60,代码来源:HttpServer2.java

示例5: initializeWebServer

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
private void initializeWebServer(String name, String hostName,
    Configuration conf, String[] pathSpecs)
    throws FileNotFoundException, IOException {

  Preconditions.checkNotNull(webAppContext);

  int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
  // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
  // default value (currently 250).
  QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
      : new QueuedThreadPool(maxThreads);
  threadPool.setDaemon(true);
  webServer.setThreadPool(threadPool);

  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[] { requestLogHandler, contexts });
    webServer.setHandler(handlers);
  } else {
    webServer.setHandler(contexts);
  }

  final String appDir = getWebAppsPath(name);

  webServer.addHandler(webAppContext);

  addDefaultApps(contexts, appDir, conf);

  addGlobalFilter("safety", QuotingInputFilter.class.getName(), null);
  final FilterInitializer[] initializers = getFilterInitializers(conf);
  if (initializers != null) {
    conf = new Configuration(conf);
    conf.set(BIND_ADDRESS, hostName);
    for (FilterInitializer c : initializers) {
      c.initFilter(this, conf);
    }
  }

  addDefaultServlets();

  if (pathSpecs != null) {
    for (String path : pathSpecs) {
      LOG.info("adding path spec: " + path);
      addFilterPathMapping(path, webAppContext);
    }
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:53,代码来源:HttpServer.java

示例6: initializeWebServer

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
private void initializeWebServer(String name, String hostName,
    Configuration conf, String[] pathSpecs)
    throws IOException {

  Preconditions.checkNotNull(webAppContext);

  int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
  // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
  // default value (currently 250).
  QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
      : new QueuedThreadPool(maxThreads);
  threadPool.setDaemon(true);
  webServer.setThreadPool(threadPool);

  SessionManager sm = webAppContext.getSessionHandler().getSessionManager();
  if (sm instanceof AbstractSessionManager) {
    AbstractSessionManager asm = (AbstractSessionManager)sm;
    asm.setHttpOnly(true);
    asm.setSecureCookies(true);
  }

  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);
  }

  final String appDir = getWebAppsPath(name);

  webServer.addHandler(webAppContext);

  addDefaultApps(contexts, appDir, conf);

  Map<String, String> xFrameParams = new HashMap<>();
  xFrameParams.put(X_FRAME_ENABLED,
      String.valueOf(this.xFrameOptionIsEnabled));
  xFrameParams.put(X_FRAME_VALUE,  this.xFrameOption.toString());
  addGlobalFilter("safety", QuotingInputFilter.class.getName(), xFrameParams);
  final FilterInitializer[] initializers = getFilterInitializers(conf);
  if (initializers != null) {
    conf = new Configuration(conf);
    conf.set(BIND_ADDRESS, hostName);
    for (FilterInitializer c : initializers) {
      c.initFilter(this, conf);
    }
  }

  addDefaultServlets();

  if (pathSpecs != null) {
    for (String path : pathSpecs) {
      LOG.info("adding path spec: " + path);
      addFilterPathMapping(path, webAppContext);
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:64,代码来源:HttpServer2.java

示例7: initializeWebServer

import org.mortbay.jetty.handler.RequestLogHandler; //导入依赖的package包/类
private void initializeWebServer(String name, String hostName,
    Configuration conf, String[] pathSpecs)
    throws FileNotFoundException, IOException {

  Preconditions.checkNotNull(webAppContext);

  int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
  // If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
  // default value (currently 250).
  QueuedThreadPool threadPool = maxThreads == -1 ? new QueuedThreadPool()
      : new QueuedThreadPool(maxThreads);
  threadPool.setDaemon(true);
  webServer.setThreadPool(threadPool);

  SessionManager sm = webAppContext.getSessionHandler().getSessionManager();
  if (sm instanceof AbstractSessionManager) {
    AbstractSessionManager asm = (AbstractSessionManager)sm;
    asm.setHttpOnly(true);
    asm.setSecureCookies(true);
  }

  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[] { requestLogHandler, contexts });
    webServer.setHandler(handlers);
  } else {
    webServer.setHandler(contexts);
  }

  final String appDir = getWebAppsPath(name);

  webServer.addHandler(webAppContext);

  addDefaultApps(contexts, appDir, conf);

  addGlobalFilter("safety", QuotingInputFilter.class.getName(), null);
  final FilterInitializer[] initializers = getFilterInitializers(conf);
  if (initializers != null) {
    conf = new Configuration(conf);
    conf.set(BIND_ADDRESS, hostName);
    for (FilterInitializer c : initializers) {
      c.initFilter(this, conf);
    }
  }

  addDefaultServlets();

  if (pathSpecs != null) {
    for (String path : pathSpecs) {
      LOG.info("adding path spec: " + path);
      addFilterPathMapping(path, webAppContext);
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:60,代码来源:HttpServer2.java


注:本文中的org.mortbay.jetty.handler.RequestLogHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。