<commit_before>package play.core.server.servlet30

import javax.servlet._
import javax.servlet.annotation._
import javax.servlet.http._
import java.io._
import java.util.concurrent.atomic._
import java.util.Arrays

import play.api._
import play.api.mvc._
import play.api.http._
import play.api.http.HeaderNames._
import play.api.libs.iteratee._
import play.api.libs.iteratee.Input._
import play.api.libs.concurrent._
import play.core._
import play.core.server.servlet._
import server.Server

import scala.collection.JavaConverters._

@WebServlet(name = "Play", urlPatterns = Array { "/" }, asyncSupported = true)
@WebListener
class Play2Servlet extends play.core.server.servlet.Play2Servlet[Tuple2[AsyncContext, AsyncListener]] with Helpers {

  protected override def onBeginService(request: HttpServletRequest, response: HttpServletResponse): Tuple2[AsyncContext, AsyncListener] = {
    val asyncListener = new AsyncListener(request.toString)
    val asyncContext = request.startAsync
    asyncContext.setTimeout(-1);

    (asyncContext, asyncListener);
  }

  protected override def onFinishService(execContext: Tuple2[AsyncContext, AsyncListener]) = {
    // Nothing to do
  }

  protected override def onHttpResponseComplete(execContext: Tuple2[AsyncContext, AsyncListener]) = {
    execContext._1.complete
  }

  protected override def getHttpParameters(request: HttpServletRequest): Map[String, Seq[String]] = {<commit_msg>Use configuration to configure async timeout<commit_after>package play.core.server.servlet30

import javax.servlet._
import javax.servlet.annotation._
import javax.servlet.http._
import java.io._
import java.util.concurrent.atomic._
import java.util.Arrays

import play.api._
import play.api.mvc._
import play.api.http._
import play.api.http.HeaderNames._
import play.api.libs.iteratee._
import play.api.libs.iteratee.Input._
import play.api.libs.concurrent._
import play.core._
import play.core.server.servlet._
import server.Server

import scala.collection.JavaConverters._

object Play2Servlet {
  val asyncTimeout = play.core.server.servlet.Play2Servlet.configuration.getInt("servlet30.asynctimeout").getOrElse(-1)
}

@WebServlet(name = "Play", urlPatterns = Array { "/" }, asyncSupported = true)
@WebListener
class Play2Servlet extends play.core.server.servlet.Play2Servlet[Tuple2[AsyncContext, AsyncListener]] with Helpers {

  protected override def onBeginService(request: HttpServletRequest, response: HttpServletResponse): Tuple2[AsyncContext, AsyncListener] = {
    val asyncListener = new AsyncListener(request.toString)
    val asyncContext = request.startAsync
    asyncContext.setTimeout(play.core.server.servlet30.Play2Servlet.asyncTimeout);

    (asyncContext, asyncListener);
  }

  protected override def onFinishService(execContext: Tuple2[AsyncContext, AsyncListener]) = {
    // Nothing to do
  }

  protected override def onHttpResponseComplete(execContext: Tuple2[AsyncContext, AsyncListener]) = {
    execContext._1.complete
  }

  protected override def getHttpParameters(request: HttpServletRequest): Map[String, Seq[String]] = {
{'fraction_non_alphanumeric': 0.09980557355800389, 'fraction_numerical': 0.008749189889825017, 'mean_word_length': 5.404564315352697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5450820', 'n_tokens_mistral': 893, 'n_tokens_neox': 868, 'n_words': 194}