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


Java RequestLog类代码示例

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


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

示例1: testAppenderDefined

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
@Test
public void testAppenderDefined() {
  HttpRequestLogAppender requestLogAppender = new HttpRequestLogAppender();
  requestLogAppender.setName("testrequestlog");
  Logger.getLogger("http.requests.test").addAppender(requestLogAppender);
  RequestLog requestLog = HttpRequestLog.getRequestLog("test");
  Logger.getLogger("http.requests.test").removeAppender(requestLogAppender);
  assertNotNull("RequestLog should not be null", requestLog);
  assertEquals("Class mismatch", NCSARequestLog.class, requestLog.getClass());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:11,代码来源:TestHttpRequestLog.java

示例2: ServerProxyImpl

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
/**
 * Default constructor. Creates a new Jetty server with a standard connector
 * listening on a given port.
 * 
 * @param userRealmsList
 * 
 * @param port default connector port number.
 * @param maxIdleTime default connector maximum idle time of for each
 *            connection.
 */
public ServerProxyImpl(List connectors, List userRealmsList, RequestLog requestLog,
        File jettyXml)
{
    server = new Server();
    server.setStopAtShutdown(true);

    this.connectors = connectors;
    this.userRealms = userRealmsList;
    this.requestLog = requestLog;
    this.jettyXml = jettyXml;
    configure();
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:23,代码来源:ServerProxyImpl.java

示例3: getRequestLog

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
@Internal
public RequestLog getRequestLog() {
    return requestLog;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:AbstractJettyRunTask.java

示例4: setRequestLog

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
public void setRequestLog(RequestLog requestLog) {
    this.requestLog = requestLog;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:AbstractJettyRunTask.java

示例5: setRequestLog

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
public void setRequestLog(Object requestLog) {
    this.requestLog = (RequestLog) requestLog;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:Jetty6PluginServer.java

示例6: getRequestLog

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
public static RequestLog getRequestLog(String name) {

    String lookup = serverToComponent.get(name);
    if (lookup != null) {
      name = lookup;
    }
    String loggerName = "http.requests." + name;
    String appenderName = name + "requestlog";
    Log logger = LogFactory.getLog(loggerName);

    boolean isLog4JLogger;;
    try {
      isLog4JLogger = logger instanceof Log4JLogger;
    } catch (NoClassDefFoundError err) {
      // In some dependent projects, log4j may not even be on the classpath at
      // runtime, in which case the above instanceof check will throw
      // NoClassDefFoundError.
      LOG.debug("Could not load Log4JLogger class", err);
      isLog4JLogger = false;
    }
    if (isLog4JLogger) {
      Log4JLogger httpLog4JLog = (Log4JLogger)logger;
      Logger httpLogger = httpLog4JLog.getLogger();
      Appender appender = null;

      try {
        appender = httpLogger.getAppender(appenderName);
      } catch (LogConfigurationException e) {
        LOG.warn("Http request log for " + loggerName
            + " could not be created");
        throw e;
      }

      if (appender == null) {
        LOG.info("Http request log for " + loggerName
            + " is not defined");
        return null;
      }

      if (appender instanceof HttpRequestLogAppender) {
        HttpRequestLogAppender requestLogAppender
          = (HttpRequestLogAppender)appender;
        NCSARequestLog requestLog = new NCSARequestLog();
        requestLog.setFilename(requestLogAppender.getFilename());
        requestLog.setRetainDays(requestLogAppender.getRetainDays());
        return requestLog;
      }
      else {
        LOG.warn("Jetty request log for " + loggerName
            + " was of the wrong class");
        return null;
      }
    }
    else {
      LOG.warn("Jetty request log can only be enabled using Log4j");
      return null;
    }
  }
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:59,代码来源:HttpRequestLog.java

示例7: testAppenderUndefined

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
@Test
public void testAppenderUndefined() {
  RequestLog requestLog = HttpRequestLog.getRequestLog("test");
  assertNull("RequestLog should be null", requestLog);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:6,代码来源:TestHttpRequestLog.java

示例8: getRequestLog

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
public static RequestLog getRequestLog(String name) {

    String lookup = serverToComponent.get(name);
    if (lookup != null) {
      name = lookup;
    }
    String loggerName = "http.requests." + name;
    String appenderName = name + "requestlog";
    Log logger = LogFactory.getLog(loggerName);

    if (logger instanceof Log4JLogger) {
      Log4JLogger httpLog4JLog = (Log4JLogger)logger;
      Logger httpLogger = httpLog4JLog.getLogger();
      Appender appender = null;

      try {
        appender = httpLogger.getAppender(appenderName);
      } catch (LogConfigurationException e) {
        LOG.warn("Http request log for " + loggerName
            + " could not be created");
        throw e;
      }

      if (appender == null) {
        LOG.info("Http request log for " + loggerName
            + " is not defined");
        return null;
      }

      if (appender instanceof HttpRequestLogAppender) {
        HttpRequestLogAppender requestLogAppender
          = (HttpRequestLogAppender)appender;
        NCSARequestLog requestLog = new NCSARequestLog();
        requestLog.setFilename(requestLogAppender.getFilename());
        requestLog.setRetainDays(requestLogAppender.getRetainDays());
        return requestLog;
      } else {
        LOG.warn("Jetty request log for " + loggerName
            + " was of the wrong class");
        return null;
      }
    }
    else {
      LOG.warn("Jetty request log can only be enabled using Log4j");
      return null;
    }
  }
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:48,代码来源:HttpRequestLog.java

示例9: initializeWebServer

import org.mortbay.jetty.RequestLog; //导入依赖的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

示例10: initializeWebServer

import org.mortbay.jetty.RequestLog; //导入依赖的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

示例11: getRequestLog

import org.mortbay.jetty.RequestLog; //导入依赖的package包/类
public RequestLog getRequestLog() {
    return requestLog;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:4,代码来源:AbstractJettyRunTask.java

示例12: initializeWebServer

import org.mortbay.jetty.RequestLog; //导入依赖的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

示例13: initializeWebServer

import org.mortbay.jetty.RequestLog; //导入依赖的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


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