Questions tagged [scalatra]

Scalatra is a tiny Scala web framework, inspired by Sinatra.

Scalatra is a microframework written in Scala. It is a port of the Sinatra framework written in Ruby. Scalatra can be expanded into a minimal but full-featured model-view-controller web framework.

Website: http://scalatra.org/

Source: https://github.com/scalatra/scalatra

309 questions
3
votes
2 answers

Prevent Scalatra from escaping text in html page

I have a template like the following: val outMsg = s"${outMap.mkString("

\n")}" if (returnMode.equalsIgnoreCase("HTML")) { response.setContentType("text/html") displayPage("Keywords Query Results:", //

Query:…

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
3
votes
1 answer

How to reset a mock invocation counter using Scalatra, Specs2, Mockito

I never expected that I will need to ask a question on this site because everything is already answered normally but with Scalatra... I haven't find a lot of information so here it is: I'm not experienced with all that so maybe I'm missing something…
Yormi
  • 479
  • 1
  • 5
  • 14
3
votes
2 answers

sbt (building Scalatra) immediately fails with <2GB of RAM

I set up a DigitalOcean "droplet"/server and provided it with 512mb of RAM. upon trying to run the ./sbt script I instantly get this failure: Using /root/.sbt/0.13.0 as sbt dir, -sbt-dir to override. OpenJDK 64-Bit Server VM warning: INFO:…
Sami Jaber
  • 51
  • 3
3
votes
2 answers

java.lang.NoClassDefFoundError: org/eclipse/jetty/plus/webapp/PlusConfiguration

I was following the tutorial from the Scalatra docs, installed the Consript and Giter8 and initialized the project using g8 as described. However when I cannot start the Jetty container using container:start as I am getting following…
Karel Horak
  • 1,022
  • 1
  • 8
  • 19
3
votes
0 answers

How to set up wro4j for sbt with the latest versions of sbt and plugins on windows?

I have downloaded this example and made some changes to resolve errors. Particularly, I have changed sbt.version to 0.13.5 in the build.properties file, and changed both scalatra-sbt and xsbt-wro4j-pluginversions to 0.3.5 in the…
Odomontois
  • 15,918
  • 2
  • 36
  • 71
3
votes
1 answer

json4s removing keys with value None

I've been working to return JSON from a Scalatra application using the implicit conversions described in the docs. I've noticed that keys with empty Options (ie, None) are stripped from the resulting JSON (as opposed to being null, which seems like…
Nick Mitchinson
  • 5,452
  • 1
  • 25
  • 31
3
votes
1 answer

Salat: How to debug stack trace to know what field in case class is causing exception

I am using Salat in my Scala / Scalatra project to serialize MongoDB objects. This is a general question in that I am trying to pull a complex MongoDB object from my database that embeds different hashes and arrays of its own that I have created…
randombits
  • 47,058
  • 76
  • 251
  • 433
3
votes
1 answer

Add local dependency jar in SBT-Scalatra project

I am working on a sample scalatra webapp. I have created one more service jar which contains dao and service layer. I want to add this dependency in Scalatra-SBT project. How can i achieve this? I bundled my service jar using command : SBT package…
Rajeev
  • 4,762
  • 8
  • 41
  • 63
3
votes
1 answer

Why is Scalatra warning me about log4j

I am attempting to get some type of logging working in Scalatra. I simply followed the instructions here http://www.scalatra.org/2.2/guides/monitoring/logging.html. When I run container:start after launching with sbt, I see the following in my…
randombits
  • 47,058
  • 76
  • 251
  • 433
3
votes
0 answers

Scalatra: Generate reverse route from another Servlet

Use-case I'm writing a simple REST api to evaluate Scalatra for my needs. I have two controllers (servlets?), mounted to /items/* and /categories/* in ScalatraBootstrap. I want a GET request to /items/1 to return something like this: { "name":…
abesto
  • 2,331
  • 16
  • 28
3
votes
1 answer

Producing json in a Scala app using json4s

I am attempting to produce JSON in a Scala app using json4s. Fairly straight forward, Here's some sample value I put together to test it in my Scalatra app: import org.json4s._ import org.json4s.JsonDSL._ object JsonStub { val getPeople = …
randombits
  • 47,058
  • 76
  • 251
  • 433
3
votes
2 answers

How to interpret SBT error messages

Doing some work in scalatra, and when running ./sbt, I'm seeing this error message: [trace] Stack trace suppressed: run last compile:sources for the full output. [error] (compile:sources) org.fusesource.scalate.InvalidSyntaxException: `val' expected…
Alex Spangher
  • 977
  • 2
  • 13
  • 22
3
votes
2 answers

Tilde in Scala found in Scalatra example code

Just ran into this sample code learning about Commands in Scalatra: protected def handle: Handler = { case c: CreateTodoCommand => add(newTodo(~c.name.value)) } In this particular case, what exactly is the relevance of ~ in…
randombits
  • 47,058
  • 76
  • 251
  • 433
3
votes
1 answer

Generating Json string using Json4S from a list containing Some and None values

I am using Scalatra, which in turn uses Json4S to generate Json string. I receive ["A","B"] for List(Some("A"),None,Some("B")) I would like to receive ["A",undefined,"B"] How can this be fixed ?
Ali Salehi
  • 6,899
  • 11
  • 49
  • 75
3
votes
2 answers

Scala web frameworks' security

I am choosing a Scala web framework. Among frameworks I am considering are Play, Scalatra and Lift. In the project I am preparing for, security is important. However, web security is a blurry subject for me, and I would like my framework to handle…
Dominykas Mostauskis
  • 7,797
  • 3
  • 48
  • 67