protected KeepAlive configureKeepAlive(final Http http) {
   int timeoutInSeconds = 60;
   int maxConnections = 256;
   if (http != null) {
     try {
       timeoutInSeconds = Integer.parseInt(http.getTimeoutSeconds());
     } catch (NumberFormatException ex) {
       //                String msg = _rb.getString("pewebcontainer.invalidKeepAliveTimeout");
       String msg = "pewebcontainer.invalidKeepAliveTimeout";
       msg =
           MessageFormat.format(msg, http.getTimeoutSeconds(), Integer.toString(timeoutInSeconds));
       LOGGER.log(Level.WARNING, msg, ex);
     }
     try {
       maxConnections = Integer.parseInt(http.getMaxConnections());
     } catch (NumberFormatException ex) {
       //                String msg =
       // _rb.getString("pewebcontainer.invalidKeepAliveMaxConnections");
       String msg = "pewebcontainer.invalidKeepAliveMaxConnections";
       msg = MessageFormat.format(msg, http.getMaxConnections(), Integer.toString(maxConnections));
       LOGGER.log(Level.WARNING, msg, ex);
     }
   }
   final KeepAlive keepAlive = new KeepAlive();
   keepAlive.setIdleTimeoutInSeconds(timeoutInSeconds);
   keepAlive.setMaxRequestsCount(maxConnections);
   return keepAlive;
 }
  @SuppressWarnings({"deprecation"})
  protected void configureHttpProtocol(
      final ServiceLocator habitat,
      final NetworkListener networkListener,
      final Http http,
      final FilterChainBuilder filterChainBuilder,
      boolean secure) {
    transactionTimeoutMillis = Long.parseLong(http.getRequestTimeoutSeconds()) * 1000;
    filterChainBuilder.add(
        new IdleTimeoutFilter(
            obtainDelayedExecutor(), Integer.parseInt(http.getTimeoutSeconds()), TimeUnit.SECONDS));
    final org.glassfish.grizzly.http.HttpServerFilter httpServerFilter =
        createHttpServerCodecFilter(http);
    final Set<ContentEncoding> contentEncodings = configureContentEncodings(http);
    for (ContentEncoding contentEncoding : contentEncodings) {
      httpServerFilter.addContentEncoding(contentEncoding);
    }
    //        httpServerFilter.getMonitoringConfig().addProbes(
    //                serverConfig.getMonitoringConfig().getHttpConfig().getProbes());
    filterChainBuilder.add(httpServerFilter);
    final FileCache fileCache = configureHttpFileCache(http.getFileCache());
    fileCache.initialize(obtainDelayedExecutor());
    final FileCacheFilter fileCacheFilter = new FileCacheFilter(fileCache);
    //        fileCache.getMonitoringConfig().addProbes(
    //                serverConfig.getMonitoringConfig().getFileCacheConfig().getProbes());
    filterChainBuilder.add(fileCacheFilter);
    final HttpServerFilter webServerFilter =
        new HttpServerFilter(getHttpServerFilterConfiguration(http), obtainDelayedExecutor());

    final HttpHandler httpHandler = getHttpHandler();
    httpHandler.setAllowEncodedSlash(GrizzlyConfig.toBoolean(http.getEncodedSlashEnabled()));
    webServerFilter.setHttpHandler(httpHandler);
    //        webServerFilter.getMonitoringConfig().addProbes(
    //                serverConfig.getMonitoringConfig().getWebServerConfig().getProbes());
    filterChainBuilder.add(webServerFilter);

    configureSpdySupport(habitat, networkListener, http.getSpdy(), filterChainBuilder, secure);

    // TODO: evaluate comet/websocket support over SPDY.
    configureCometSupport(habitat, networkListener, http, filterChainBuilder);

    configureWebSocketSupport(habitat, networkListener, http, filterChainBuilder);

    configureAjpSupport(habitat, networkListener, http, filterChainBuilder);
  }