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

Choosing a Scala web framework

I am about to start a project for a web application that should run on a Tomcat server. I have decided to go for Scala - the other alternative where I work being Groovy - essentially for type safety. I am now faced with the task of choosing the…
Andrea
  • 20,253
  • 23
  • 114
  • 183
29
votes
6 answers

How to implement a REST Web Service using Akka?

I intend to implement a pure Akka powered REST based Web API. I am not sure about using spray. I would consider using Scalatra if it is any good. Basically I am interested in using the concurrency benefits of Scala Actor model. I don't want the…
Kamesh Rao Yeduvakula
  • 1,215
  • 2
  • 15
  • 27
22
votes
1 answer

Scala: Replace newline, tab and return sequences from string

I have a string of HTML that I'm copy pasting into a String object that looks something like the following: val s = """

This is a test

This is a test 2

randombits
  • 47,058
  • 76
  • 251
  • 433
15
votes
2 answers

How to get the body of post request in Scalatra?

I have a scalatra servlet: post("/asdf") { ??? } And my clients send xml in post body, so I need to extract raw text from request. How do I do it in scalatra?
Rogach
  • 26,050
  • 21
  • 93
  • 172
15
votes
4 answers

IntelliJ remote debugger connects, but breakpoints are not working

I am trying out the Scala web framework Scalatra. According to the docs here, the steps to enable IntelliJ debugging are: Add the usual JDK options for remote debugging: "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" Create…
Joaquim d'Souza
  • 1,416
  • 2
  • 14
  • 25
13
votes
2 answers

how to catch all the errors in any scalatra action?

I am using scalatra to "export" a MongoDB data to JSon, my actions are very simple, like: get("/") { val title = db.get_collection("main", "api", "title") send_json(title) } I want to send a HTTP error and a text if something go…
user1216071
  • 165
  • 1
  • 4
13
votes
4 answers

Scala: print a stack trace in my Scalatra app

Seems like a fairly straight forward problem, but I'd like to log a stack trace when my top level error handler in Scalatra is triggered. I'm intentionally throwing an exception in one of my methods by doing something as trivial as: throw new…
randombits
  • 47,058
  • 76
  • 251
  • 433
10
votes
3 answers

Changing Scalatra Port

This sounds basic, but its actually cost me a whole day: I want to change to change the port that scalatra runs on, in development. I started with the hello world g8 template, and have been building from there. Here's what I've tried so…
Kire321
  • 111
  • 1
  • 4
9
votes
2 answers

Deserialization of case object in Scala with JSON4S

I have some case classes defined like follows: sealed trait Breed case object Beagle extends Breed case object Mastiff extends Breed case object Yorkie extends Breed case class Dog(name: String, breed: Breed) I also have an endpoint defined with…
user2066880
  • 4,825
  • 9
  • 38
  • 64
9
votes
3 answers

No multipartconfig for servlet error from Jetty using scalatra

I am trying to unit test an upload call but I get this error for the following code: @MultipartConfig(maxFileSize = 3145728) class WebServlet extends ScalatraServlet with FileUploadSupport { override def isSizeConstraintException(e: Exception) = e…
James Black
  • 41,583
  • 10
  • 86
  • 166
9
votes
3 answers

Standalone deployment of Scalatra servlet

I implemented a Scalatra servlet and now want to create an executable jar, just like described in this tutorial: http://www.scalatra.org/2.2/guides/deployment/standalone.html I use IntelliJ IDEA with the Scala plugin for development and sbt to build…
sbaltes
  • 489
  • 1
  • 9
  • 17
8
votes
1 answer

Speeding up SBT-assembly

We have a project where we are building a large number of Scalatra microservices by packaging them using the sbt-assembly plugin, then creating Docker images using the sbt-docker plugin. The process is slow due to the number of micro-services…
Mark Butler
  • 4,361
  • 2
  • 39
  • 39
8
votes
2 answers

OAuth2 provider for Scalatra or Play framework in Scala

Is there any OAuth2 provider available for Scala that I can use with Scalatra or Play2 web framework? I have already seen this answer: OAuth 2.0 provider implementation for Scala/Lift I am looking for a provider library and not an OAuth2.0 client…
tuxdna
  • 8,257
  • 4
  • 43
  • 61
8
votes
4 answers

scala.Some cannot be cast to java.lang.String

In this application, I'm getting this error: scala.Some cannot be cast to java.lang.String When trying this: x.email.asInstanceOf[String] x.email is an Option[String] Edit: I understand that I'm dealing with different types here, I was just…
Alex Spangher
  • 977
  • 2
  • 13
  • 22
7
votes
3 answers

Why does jquery post json as a parameter name instead of as the request body?

For a webapp with a RESTful backend I am posting some json to the server using jquery's $post. Now to my surprise, the json is stuffed in a parameter key for the request's form data, instead of in the request body. I can think of some other ways to…
iwein
  • 25,788
  • 10
  • 70
  • 111
1
2 3
20 21