Skip to content

Commit

Permalink
possibly fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
manonthegithub committed Nov 16, 2023
1 parent 98b0daf commit e880126
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/main/scala/org/dbpedia/databus/JettyHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/main/scala/org/dbpedia/databus/JettyLauncher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit e880126

Please sign in to comment.