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

How to share a mustache template between Scalate and Javascript?

So I'm using some server-side mustache templates with Scalatra and Scalate, and I'd like to use them in my Javascript code too. Ideally I can load the same templates via some sort of ajax call, but I'm not really sure how to set that up with…
Matthew Rathbone
  • 8,144
  • 7
  • 49
  • 79
2
votes
1 answer

How do I init()/initialize() a Scalatra servlet on startup?

We found when moving from Jetty in development to Tomcat in production that our Swagger documentation stopped working -- no operations would show up in the Swagger docs until after the first call to the servlet providing the operation. After some…
David Moles
  • 48,006
  • 27
  • 136
  • 235
2
votes
2 answers

Serialization of array and map to json in Scala

I am trying to construct json string from array. I am able to get json string format using JsonAST as below : import net.liftweb.json.JsonAST import net.liftweb.json.JsonDSL._ import net.liftweb.json.Printer._ val map = Map("a" -> "b", "c" ->…
Rajeev
  • 4,762
  • 8
  • 41
  • 63
2
votes
1 answer

Scalatra without SBT

I'm trying to get started with Scalatra, but I'm running into major issues with SBT. To put it plainly, I hate it. It's the Scala equivalent of Maven. It tries to take over every single aspect of your project for a few supposed benefits. Plus, it…
GJK
  • 37,023
  • 8
  • 55
  • 74
2
votes
1 answer

Scalatra loading static content from executable jar file

In my build.sbt I have: resourceDirectory in Compile <<= baseDirectory(_ / "src/main/webapp") This is my JettyLauncher.main: def main(args: Array[String]) { val port = if(System.getenv("PORT") != null) System.getenv("PORT").toInt else 8080 …
James Black
  • 41,583
  • 10
  • 86
  • 166
2
votes
1 answer

how is (myActor ? q) async in following scalatra example?

in this post Angular.js with Scalatra it is said that the http call is asynchronous. I see that the call to the actor is done with: myActor ? q however in scalatra home page i see they encapsulate the call with AsyncResult see: get("/"){ new…
Jas
  • 14,493
  • 27
  • 97
  • 148
2
votes
0 answers

"Not Implemented" error when testing a Scalatra route with ScalaTest

I am writing tests for several Scalatra routes. I'm using Scala 2.10.2, Scalatra 2.2.1, and Scalatest 1.9.2; I'm fairly new at using all three of these. I'm also using Eclipse Scala IDE 3.0.1 with the ScalaTest plugin. For my ScalatraBootstrap I…
Zim-Zam O'Pootertoot
  • 17,888
  • 4
  • 41
  • 69
2
votes
1 answer

Scalatra stand-alone deployable cannot create assembly

When I run the "assembly" command as instrcuted by the Scalatra docs (http://www.scalatra.org/2.2/guides/deployment/standalone.html) I get the following error: [trace] Stack trace suppressed: run last *:assembly for the full output. [error]…
user2668128
  • 39,482
  • 8
  • 27
  • 34
2
votes
2 answers

HEAD request in scalatra

I am a scalatra newbie, and maybe my question makes no sense, but here it is: How do I tell if a request in scalatra was a GET or a HEAD request? Basically I have a REST api which uses GET to get an item, and HEAD to test that the item exists. I am…
Will I Am
  • 2,614
  • 3
  • 35
  • 61
2
votes
1 answer

Scala web services

What are my options for frameworks for creating high performance web services using Scala, without too much fat? I am a total newbie at Scala and IntelliJ IDEA, and I'm looking at it for some future development -- for now, I'm in learning mode, and…
Will I Am
  • 2,614
  • 3
  • 35
  • 61
2
votes
0 answers

Set charset when processing xml using Dispatch Databinder 0.10

I'm wrapping an upstream API with a Scalatra application and using Dispatch to make async requests. However, I'm having trouble turning the upstream XML into xml.Elems using Dispatch's built-in XML processing support. I'm trying to do something…
futurechimp
  • 554
  • 4
  • 6
2
votes
1 answer

How to define sub-resources routing in Scalatra

I have REST resources like author and article. There can be multiple Authors and each author can own multiple articles. I know it is possible to model their Scalatra handlers in one servlet like /author/:id/article /author/:id/article/:id etc.…
Michal Ostruszka
  • 2,089
  • 2
  • 20
  • 23
2
votes
2 answers

How does Scalatra send params to the routes?

I'm asking this as a relatively new person to Scala. I've seen examples of how to create 'control constructs' in Scala, but I don't know it well enough to follow the code of Scalatra itself. Can someone please explain how 'params' is passed to the…
Dave Kapp
  • 301
  • 1
  • 7
2
votes
1 answer

Default AkkaSupport Servlet example doesn't work

If I have a servlet taken directly from the example on the Scalatra docs page: package me.myself.andi import _root_.akka.dispatch._ import org.scalatra.akka.AkkaSupport import org.scalatra.ScalatraServlet class MyAppServlet extends ScalatraServlet…
user375566
2
votes
1 answer

Declaring a different compile path for CoffeeScript

I have a Scalatra app that compiles CoffeeScript, using https://github.com/softprops/coffeescripted-sbt, to a default location, target/scala-2.9.1/resource_managed/main/js. I want to put the generated javascripts somewhere available to me publicly,…
user375566