From d9bb839b38793bcfea17f1ff6fd44b77920b2a5d Mon Sep 17 00:00:00 2001 From: Kirill Yankov Date: Mon, 26 Sep 2022 11:52:44 +0200 Subject: [PATCH] possibly fixes #27 --- src/main/scala/org/dbpedia/databus/JettyHelpers.scala | 5 +++++ src/main/scala/org/dbpedia/databus/JettyLauncher.scala | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/scala/org/dbpedia/databus/JettyHelpers.scala b/src/main/scala/org/dbpedia/databus/JettyHelpers.scala index 44851da..0df77d3 100644 --- a/src/main/scala/org/dbpedia/databus/JettyHelpers.scala +++ b/src/main/scala/org/dbpedia/databus/JettyHelpers.scala @@ -10,13 +10,18 @@ import org.eclipse.jetty.server.{HandlerContainer, Request} import org.eclipse.jetty.server.handler.{ContextHandler, ResourceHandler} import org.eclipse.jetty.servlet.{ServletContextHandler, ServletHandler} +import scala.concurrent.duration._ + object JettyHelpers { + val DefaultTimeout = 1 hour + def proxyContext(parent: HandlerContainer, virtUri: String, contextPath: String) = { val proxyContext = new ServletContextHandler(parent, contextPath, ServletContextHandler.SESSIONS) val handler = new ServletHandler val holder = handler.addServletWithMapping(classOf[ProxyServlet.Transparent], "/*") holder.setInitParameter("proxyTo", s"$virtUri") + holder.setInitParameter("idleTimeout", DefaultTimeout.toMillis.toString) proxyContext.setServletHandler(handler) proxyContext.setAllowNullPathInfo(true) proxyContext diff --git a/src/main/scala/org/dbpedia/databus/JettyLauncher.scala b/src/main/scala/org/dbpedia/databus/JettyLauncher.scala index 0a5a403..b6f7ab4 100644 --- a/src/main/scala/org/dbpedia/databus/JettyLauncher.scala +++ b/src/main/scala/org/dbpedia/databus/JettyLauncher.scala @@ -3,7 +3,7 @@ package org.dbpedia.databus // remember this package in the sbt project definiti import java.net.URL import java.nio.file.{Files, Paths} -import org.eclipse.jetty.server.{Handler, NCSARequestLog, Server} +import org.eclipse.jetty.server.{Handler, NCSARequestLog, Server, ServerConnector} import org.eclipse.jetty.servlet.DefaultServlet import org.eclipse.jetty.webapp.WebAppContext import org.scalatra.servlet.ScalatraListener @@ -66,7 +66,10 @@ object JettyLauncher { // this is my entry object as specified in sbt project de requestLog.setLogLatency(true) requestLog.setRetainDays(90) server.setRequestLog(requestLog) - + server.getConnectors.foreach(_ match { + case sc : ServerConnector => sc.setIdleTimeout(JettyHelpers.DefaultTimeout.toMillis) + case _ => + }) server.start log.info( s"""The service has been started.