Skip to content

Commit

Permalink
bump scalatra
Browse files Browse the repository at this point in the history
  • Loading branch information
nvdk committed Nov 23, 2021
1 parent 1ccced3 commit a6cdeba
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM hseeberger/scala-sbt:8u171_2.12.6_1.1.5 as builder
FROM mozilla/sbt:8u292_1.5.4 as builder
COPY . /app
WORKDIR /app
RUN sbt assembly

FROM openjdk:12
ENV SPARQL_ENDPOINT=http://database:8890/sparql
COPY --from=builder /app/target/scala-2.12/*assembly*.jar /app/cool-uris.jar
COPY --from=builder /app/target/scala-2.13/*assembly*.jar /app/cool-uris.jar
CMD ["java","-jar","/app/cool-uris.jar"]
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
val ScalatraVersion = "2.5.3"
val ScalatraVersion = "2.8.1"

organization := "eu.vandekeybus"

name := "cool-uris"

version := "0.1.0-SNAPSHOT"

scalaVersion := "2.12.3"
scalaVersion := "2.13.4"

resolvers += Classpaths.typesafeReleases

libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalatest" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.1.5" % "runtime",
"ch.qos.logback" % "logback-classic" % "1.2.3" % "runtime",
"org.slf4j" %"jcl-over-slf4j" % "1.7.16",
"org.eclipse.jetty" % "jetty-webapp" % "9.2.15.v20160210" % "container;compile",
"org.eclipse.jetty" % "jetty-webapp" % "9.4.6.v20170531" % "container;compile",
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided",
"org.eclipse.rdf4j" % "rdf4j-repository-sparql" % "2.2.2",
"org.eclipse.rdf4j" % "rdf4j-queryresultio-sparqljson" % "2.2.2"
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.0.2
sbt.version=1.4.5
2 changes: 2 additions & 0 deletions src/main/scala/ScalatraBootstrap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ class ScalatraBootstrap extends LifeCycle {
val repo = new SPARQLRepository(sparqlEndpoint)
repo.initialize()
context.mount(new WebApi(repo), "/*")
context.setInitParameter("org.scalatra.cors.allowedOrigins", "*")
context.setInitParameter("org.scalatra.cors.allowCredentials", "false")
}
}
2 changes: 1 addition & 1 deletion src/main/scala/eu/vandekeybus/cooluris/WebApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WebApi(repository: Repository) extends ScalatraServlet {
if (uri.isEmpty) {
halt(400, """{ "error": "query parameter uri is required"}""")
}
val result = getRepresentations(uri) getOrElse halt(404, s"""no linked data representation of $uri was found""")
val result = getRepresentations(uri) getOrElse halt(404, s"""{ "error": "no linked data representation of $uri was found"}""")

if (acceptsRDF && stringVal(result, "dataURL").nonEmpty)
halt(303,"", Map("Location" -> stringVal(result, "dataURL")))
Expand Down

0 comments on commit a6cdeba

Please sign in to comment.