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
4
votes
2 answers

Jade interpolation within javascript

(Note, this is the Scalate Jade, if that makes a difference) I have the following route: get("/fruit") { contentType = "text/html" jade("fruity", "fruit" -> "apple") } And this fruity.jade template: -@ val fruit: String p Alerting…
Synesso
  • 37,610
  • 35
  • 136
  • 207
4
votes
2 answers

Scalatra test restful JSON object

I'm writing test for some JSON restful API using Scalatra, a snippet looks like following class MyScalatraServletTests extends ScalatraSuite with FunSuite { test("An valid request should return 200") { get ("/rest/json/accc/B1Q4K3/1") { …
Wudong
  • 2,320
  • 2
  • 32
  • 46
4
votes
4 answers

Error while posting data from angular js form

I have an angularJS form which posts data to a scalatra servlet. When the form gets submitted I can't get any form params in my scalatra servlet. Below is my code AngularJS $scope.createUser = function() { …
prassee
  • 3,651
  • 6
  • 30
  • 49
3
votes
1 answer

Getting Session Value from ScalatraTest-ScalaTest

I am currently writing a number of Scalatra tests using the ScalaTest framework and the ScalatraSuite class. test("when i try to go to the base url it shold redirect me "){ get("/") { status should be(302) } } The next step…
James Hughes
  • 6,194
  • 4
  • 31
  • 44
3
votes
1 answer

How to create executable single jar which include webapp resources by sbt-assembly with scalatra

I'm making webapp using scalatra framework via sbt & xsbt-web-plugin. I want to package all resources(templates, css, js) into a single jar. In sbt with sbt-assembly plugin, assembly command makes single jar which includes all of project's…
pokutuna
  • 71
  • 5
3
votes
0 answers

Scalate templates in Scalatra with WAR deployed in Jetty throw ResourceNotFoundException

When attempting to send email using scalate templates, resource not found exceptions are thrown (see below). Initially I thought it was a path issue, as in dev environment on sbt it works file, but deploying the WAR to jetty causes these…
Kareem
  • 844
  • 2
  • 8
  • 15
3
votes
2 answers

How to pass multiParams in scalatra

If I want to read a single parameter in a get request in scalatra I can do it as follows: get("mypath/:id") { val id = params("id") ... } According to the scalatra documentation I can also use multiParams to get a sequence of parameters: val ids =…
user79074
  • 4,937
  • 5
  • 29
  • 57
3
votes
1 answer

Download failed. Obtain the jar manually and place it at ./.lib/0.12.2/sbt-launch.jar

I'm trying to run ./sbt file it throw an error Detected sbt version 0.12.2 Starting sbt: invoke with -help for other options Downloading sbt launcher 0.12.2: From …
KARTHIKEYAN.A
  • 18,210
  • 6
  • 124
  • 133
3
votes
0 answers

How to store extra fields that I don't care about in a Map when deserializing?

This is what I want to do: Jackson deserialize extra fields as map, but I haven't gotten it to work. This is the class I want to deserialize: class MyClass( @JsonProperty val name: String, @JsonProperty val age: Int, …
L42
  • 3,052
  • 4
  • 28
  • 49
3
votes
0 answers

Stream data in Scalatra response from Akka actor

I have a Scalatra application where the ScalatraServlet will take care of decoding the response, performing authentication etc., and then send the task to an actor for processing, think: // class has FutureSupport get("/status/:id") { val id =…
tgpfeiffer
  • 1,698
  • 2
  • 18
  • 22
3
votes
1 answer

Getting unresolved dependencies on sbt compile

Below is the build.sbt file in my scalatra project. When most of the dependencies are getting resolved, build is failing because of commons-codec and jetty plugin: import AssemblyKeys._ // put this at the top of the file import…
Gayatri Mahesh
  • 327
  • 1
  • 3
  • 12
3
votes
1 answer

JSONWebTokens in Scalatra

So I'm trying to secure my web application by using JWT in Scalatra. At the moment I'm using Scentry with both User-Password and RememberMe strategies and my intention is to swap the cookie-based authentication in RememberMe strategy with JWT…
Hellzzar
  • 185
  • 1
  • 9
3
votes
0 answers

How to set connection timeout in Scalatra and Jetty?

I am using Scalatra 2.4 with Jetty 9.2.10 and I am unable to set the connection timeout to 60 seconds. I have tried both by adding the following to the web.xml 60 and by using…
Roberto A.
  • 372
  • 2
  • 13
3
votes
2 answers

How to keep sbt running (as a daemon process) after executing a command

I want to launch scalatra server from sbt. How do I do that? The following does launch scalatra: sbt "container:start" But it exits immediately: [info] starting server ... [success] Total time: 2 s, completed Sep 12, 2015 2:39:32 PM > [info]…
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
3
votes
2 answers

How to get sbt-assembly merge right?

In our Scala/Scalatra project, we have this merge policy for the plugin sbt-assembly: assemblyMergeStrategy in assembly := { case x => val oldStrategy = (assemblyMergeStrategy in assembly).value oldStrategy(x) } [error] 11 errors were…
Chiron
  • 20,081
  • 17
  • 81
  • 133