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

Can Dropwizard Metrics be integrated with Scalatra?

I try to setup a performance metrics tool with one of our new service built with Scala. I use Dropwizard Metrics since it is a popular one. The following code can't get compiled @Timed get("/greeting", operation(dummy)){ val name: Option[String] =…
TeeKai
  • 671
  • 2
  • 10
  • 20
0
votes
1 answer

Sending HTTP request using Scalatra & Scala

I have a Scalatra web application, when a user sends a get request to the server, ie. www.example.com/getsomething it routes to the following code: class ExampleServlet extends ScalatraServlet { get("/getsomething") { //code here } } In…
0
votes
1 answer

How can I get Slick 3 to produce BIGSERIAL instead of GENERATED BY DEFAULT AS IDENTITY?

I'm getting up and running with Slick 3 in a Scalatra app, with PostgreSQL. I'm able to read from a manually created table just fine, but I'm having trouble creating one via Slick. When I print out the generated SQL, I see this: CREATE TABLE…
sdanzig
  • 4,510
  • 1
  • 23
  • 27
0
votes
1 answer

Deploy on Heroku using Scalatra

I am trying to deploy my Scalatra web application in heroku but I am having one problem. My application works in local with SBT and using "heroku local web". I am using heroku sbt plugin. When I use "sbt stage deployHeroku" the application is…
Hellzzar
  • 185
  • 1
  • 9
0
votes
1 answer

Scalatra throwing null pointer exception with java 8

I am running a web application with Scala version 2.9.0 and Scalatra version 2.1.0-SNAPSHOT. I build the application with Java 1.6. It runs fine when I run it with Java 1.7 but fails when ran with Java 1.8 with this error. What can be the issue? It…
RckR
  • 45
  • 4
0
votes
1 answer

Jetty config without resourceBase

I have a Scalatra with Jetty and it is serving REST API at the moment. No static context served at all. However, it seems I cannot skip setting resourceBase without getting java.lang.IllegalStateException: No resourceBase or war set for context Do…
Petteri H
  • 11,779
  • 12
  • 64
  • 94
0
votes
1 answer

Async authentication in scalatra

I am trying to build a web app using scalatra, and am working on the authentication. I successfully used scentry with an userpassword strategy. However, to do that, I had to "await" on my database requests: some of the scentry methods (authenticate,…
OlivierH
  • 385
  • 3
  • 12
0
votes
1 answer

Working with futures in slick and scalatra

I am trying to handle a future I got from slick in order to generate a response to a request, but I'm stuck at the "async" part. Here is a snippet: get("/tmp") { new AsyncResult() { override val is: Future[_] =…
OlivierH
  • 385
  • 3
  • 12
0
votes
1 answer

Scala how to inject mock object to ScalatraFlatSpec

I stuck with Unit test in Scala for many days. I cannot inject mock object to Unit test. The ScalatraFlatSpec call to the actual database not my mock variable and i have no idea to do. This is my API class Dashboard extends Servlet { …
0
votes
1 answer

Scala ByteArrayInputStream to String

I'm trying to log the body of a post made using org.apache.http.client. I'm using Scalatra version 2.4.0.RC3 and Scala version 2.11.7. My response is a 400 Bad Request and I need to get the message provided in the response body. Here is my current…
0
votes
1 answer

container:start stopped working in Scalatra sbt project : "invalid key"

I have a scalatra project built the standard way using giter8. I am uncertain why container:start no longer functions in my scalatra project: no change was made to build.sbt. here is the error: Using /home/stephen/.sbt/0.12.0 as sbt dir, -sbt-dir…
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
0
votes
1 answer

ScalatraBootstrap don't run

I'm trying to configure my Scalatra application according documentation, but I can't run. I have such a code for bootstrap file import javax.servlet.ServletContext import org.scalatra._ import org.scalatra.example.UserController class…
Dmitry Meshkov
  • 921
  • 7
  • 20
0
votes
1 answer

How to get request parameters in a Scalatra Servlet?

I currently have a working Scalactra servlet. class MyScalatraServlet extends MyScalatraWebAppStack { get("/") { response.getWriter().println("Test") val scDate = com.example.app.ScalaDate.printDate() …
0
votes
1 answer

Heroku error on scala application

Any idea what may cause the following error? sinan@ThinkPad-X1-Carbon:~/dev/heroku/kumbaraci50$ git push heroku master Counting objects: 4390, done. Delta compression using up to 4 threads. Compressing objects: 100% (2419/2419), done. Writing…
sardok
  • 1,086
  • 1
  • 10
  • 19
0
votes
1 answer

Scalatra : Access file path from a deployed application

I need to access file path on the server in Scalatra application. Without war file the following worked for me where file was stored in /src/main/resources/data location. this.getClass.getResource("/data").getPath However the same doesn't work…
Amit Jain
  • 1,372
  • 8
  • 16