Questions tagged [finatra]

A Sinatra (software)-inspired web framework for scala, running on top of Finagle, from Twitter.

Finatra is a framework for fast, testable Scala services that is built on TwitterServer and Finagle

It is used in production by Twitter.

Reference: Finatra

44 questions
5
votes
2 answers

How to handle put requests in Finatra?

I have a service which has a put endpoint. I want to be able to access the url param as well as the body. How do I achieve this. This is my endpoint: put("/:customerNum") { foo: Foo => val custNum = ??? } How do I access customerNum ?
deep
  • 1,586
  • 1
  • 18
  • 29
3
votes
2 answers

Why does Finatra use flatMap and not just map?

This might be a really dumb question but I am trying to understand the logic behind using #flatMap and not just #map in this method definition in Finatra's HttpClient definition: def executeJson[T: Manifest](request: Request, expectedStatus: Status…
3
votes
2 answers

Finatra access-control-allow-origin

I try to access my REST API that I built using Finatra via AJAX calls. Unfortunately, I get the following error: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested…
navige
  • 2,447
  • 3
  • 27
  • 53
3
votes
1 answer

Disable http in finatra app

I am deploying a Finatra app to Heroku. Thanks to Twitter guys together with Heroku this is a very easy task. The thing is that Heorku gives you https out of the box (if im trying to reach my service through https it just works). Nevertheless it…
Gal
  • 371
  • 2
  • 14
2
votes
1 answer

Resolving import conflicts in Scala SBT

I'm trying to following this tutorial, but I'm getting the same error for two days. i found some similar questions here in SO, but any of them helped me (maybe is because my lack of knowledge in scala and sbt). Here is my build.sbt name :=…
James
  • 1,653
  • 2
  • 31
  • 60
2
votes
1 answer

Finatra downloads HTML file instead of displaying it

I am using Finatra 2.1.6 with this code: get("/:*") { request: Request => response.ok.fileOrIndex( request.params("*"), "index.html") } If I run this from e.g. IntelliJ, it works perfectly fine and displays the html file. However, if I start…
navige
  • 2,447
  • 3
  • 27
  • 53
1
vote
2 answers

Does Log4j2 and SLF4J MDC get along?

Using Finatra, I'm trying to activate traceID logging, but nothing ends up in Log4J2 output. Finatra supports SLF4J MDC. SLF4J MDC is supposed to support Log4J (2?). Log4J2 is supposed to support MDC and SLF4J. But in the end, the MDC data is always…
brisssou
  • 499
  • 6
  • 12
1
vote
0 answers

can't match route with named parameters in finatra controller

I am using com.twitter.finatra.http.Controller to set up endpoints in Scala and I have an endpoint like this: get(s"${endpoint}/:id/lookup/?") {request: Request => println("here") val id = request.params("id") response.ok } It is my…
chibis
  • 658
  • 2
  • 12
  • 22
1
vote
1 answer

Finatra vs Akka-http performance as a plain http library

I need to build REST API for my services and I am new to Scala. I have come to know of finatra and akka-http. After studying for a while, I am more inclined towards finatra as it offers java-style syntax and methodology for web services. However,…
gschambial
  • 1,383
  • 2
  • 11
  • 22
1
vote
1 answer

HTTP/Spnego with Kerberos authentication for Finatra web server

I try to use Spnego with Finatra web server but I don't succeed. Here my GitHub project: https://github.com/glegoux/spnego-server-finatra With wireshark: error: KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN. My server log: ... Debug is true storeKey true…
glegoux
  • 3,505
  • 15
  • 32
1
vote
1 answer

How to publish services with ssl using docker-compose?

I have a service using finatra server running on docker container. Currently I am using letsencrypt , and I created my .pfx file etc. But I don't know how to use it with docker-compose. I have a keystore folder inside my project which has my ssl…
earlymorningtea
  • 508
  • 1
  • 9
  • 20
1
vote
1 answer

Finatra FeatureTests: How to manually deserialize returned json

I read the Finatra getting started guide and I was able to write the HelloWorld Service and its feature test. Currently my feature test looks like server.httpPost( path = "/hi", postBody = """{"name": "Foo", "dob": 136190040000}""", …
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
1
vote
1 answer

Detect protocol with finatra

Hello I'm faily new with Finatra and wanted to know if there is a way to validate that a request was made using the https protocol?
1
vote
1 answer

Finatra and Slick 3.1 returning success, failure, and value in response headers

I'm new to scala and I'm writing feature tests for a finatra and slick app, and I can't figure out why the response header is always sending back my resources as so: { success: true, failure: false, value: { resources... } } Has anyone…
JoshSGman
  • 529
  • 2
  • 6
  • 16
1
vote
1 answer

How can I make a specific httpclient to deserialize camel case json

I implement an API server with Finatra and my api outputs snake case json, i.e.; case class A { val someProperty: String } val a = A("value") a will be serialized int the json and vice versa {"some_property":"value"} But I have to access 3rd…
Mekajiki
  • 911
  • 2
  • 8
  • 18
1
2 3