Scalatra with HTTPS?

172 views Asked by At

I have a tiny project based on the template from official Scalatra tutorial. I read it's possible to setup jetty to support HTTPS, but I have no idea how to do that.

Is it possible to enable HTTPS support in Scalatra (jetty) without other standalone software (e.g. nginx) wrapping communication? If so, how to do that?

1

There are 1 answers

2
Boris Azanov On

All you need is install java and sbt. Intruction here: http://scalatra.org/getting-started/installation.html and after creating project you will have in build.sbt

libraryDependencies ++= Seq(
  "org.scalatra" %% "scalatra" % ScalatraVersion,
  "org.scalatra" %% "scalatra-scalatest" % ScalatraVersion % "test",
  "ch.qos.logback" % "logback-classic" % "1.2.3" % "runtime",
  "org.eclipse.jetty" % "jetty-webapp" % "9.4.19.v20190610" % "container",
  "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
)

and jetty will be downloaded automatically by sbt. You don't need to install anything else i.e. jetty or nginx. Jetty is a Java web-server library, it can receive and send requests by https. It works on jvm and don't need some addition software.