Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 13 03:57
    popojargo commented #974
  • Nov 10 18:54
    chthor closed #986
  • Nov 10 18:54
    chthor commented #986
  • Nov 08 07:52
    magnolia-k closed #80
  • Nov 08 07:52
    magnolia-k closed #40
  • Nov 08 07:52
    magnolia-k commented #40
  • Nov 08 05:15
    seasonedgeek commented #40
  • Nov 06 12:29
    magnolia-k commented #193
  • Nov 06 12:29

    magnolia-k on master

    Update configuration.md Fix ty… Update configuration.md Fix ty… Merge pull request #193 from co… (compare)

  • Nov 06 12:29
    magnolia-k closed #193
  • Nov 06 03:59
    counter2015 edited #193
  • Nov 05 10:56
    counter2015 commented #191
  • Nov 05 08:32
    counter2015 opened #193
  • Nov 01 22:26
    magnolia-k commented #986
  • Oct 31 18:30
    chthor opened #986
  • Oct 27 10:02
    magnolia-k synchronize #985
  • Oct 26 13:20
    magnolia-k commented #964
  • Oct 26 13:20
    magnolia-k commented #969
  • Oct 26 13:19
    magnolia-k opened #985
  • Oct 26 13:12

    magnolia-k on 2.7.x

    Excluded '#' and '&' from path … Merge pull request #983 from ma… (compare)

Steve Fosdal
@sfosdal
I’m trying this:
import org.scalatra.swagger.annotations._

@ApiModel(description = "some description")
case class Demo(strings: Seq[String]) {

  @ApiModelProperty(access = "hidden") lazy val foo: String = {
    "this part doesn't really matter"
  }

}
but the lazy val is documented. :/
Steve Fosdal
@sfosdal
making foo a def accomplishes the documentation part of what I want, but foo, in general doesn’t need to be re-evaluated every time
magnolia
@magnolia-k
In the current implementation, it seems that there is no logic using access
Calvin Ference
@vezril
Hey guys, quick question, what would be the way in scalatra to send out an HTTP request to a REST api?
TATSUNO Yasuhiro
@exoego
Do you mean cause scalatra server to send HTTP request to some external REST APIs?
Or you want to send HTTP request to REST APIs on your scalatra server?
James Earl Douglas
@earldouglas_gitlab
Is there something in Scalatra that forces a response's charset? I have get ("/") { contentType = "image/png" ; myImageInputStream }, and no matter what I try, I can't get the Content-Type header to be image/png. It always comes out as image/png;charset=UTF-8.
James Earl Douglas
@earldouglas_gitlab
Adding response.characterEncoding = None appears to solve the problem.
James Earl Douglas
@earldouglas_gitlab
Tomcat 9 shits the bed when the character encoding is unset. Is anyone aware of a guide for configuring Tomcat to allow Content-Type: image/png without a charset?
James Earl Douglas
@earldouglas_gitlab
Is Scalatra just incapable of serving binary data?
James Earl Douglas
@earldouglas_gitlab
I'm completely stuck here. Maybe Stack Overflow can help: https://stackoverflow.com/questions/57317370/
Naoki Takezoe
@takezoe
I tried fixing it several years ago, but it has been reverted: scalatra/scalatra#332
Naoki Takezoe
@takezoe
One possible solution is setting ContentType and then writing binary directory to HttpServletResponse.
like this:
get("/image") {
  contentType  = "image/png"
  val out = response.getOutputStream

  // write binary to OutputStream here
  ...

  () // return Unit
}
Naoki Takezoe
@takezoe
I also answered on StackOverflow. Hope it will help you! @earldouglas_gitlab
James Earl Douglas
@earldouglas
Thanks, @takezoe. Unfortunately this doesn't solve the problem; charset=utf-8 still gets appended to the Content-Type header.
get("/image") {   
  contentType  = "image/png"   
  val out = response.getOutputStream   
  out.write("foobar".getBytes())   
  ()
}
$ curl localhost:8080/image --head
HTTP/1.1 200 OK
Date: Sun, 04 Aug 2019 12:35:51 GMT
Content-Type: image/png;charset=utf-8
Content-Length: 6
Server: Jetty(9.4.8.v20171121)
Naoki Takezoe
@takezoe
@earldouglas Try to call response.flushBuffer() after writing binary data.
James Earl Douglas
@earldouglas
Great idea, but unfortunately didn't work.
Thanks again for the help. It's not an urgent issue for me anymore, as I've migrated off of Scalatra.
Ingemar Ådahl
@ingemaradahl

Hi, I'm having trouble understanding how to fully support passing urls as route parameters. Based on

get("/encoded-uri/:name") {
  params("name")
}

from RouteTest.scala, the following test fails:

get("/encoded-uri/https%3A%2F%2Fexample%2Ftest%3F%253Ffoo%3Dbar") {
  status should equal(200)
  body should equal("https://example/test?%3Ffoo=bar")
}
It smells a lot like scalatra/scalatra#52 which talks about doing special things for ?, /, and # characters. For reference %3F decodes to ?, and %253F decodes to %3F
So my problem is that the name parameter is sort of decoded "twice". The body in the test above actually contains https://example/test??foo=bar which is incorrect
Naoki Takezoe
@takezoe
@ingemaradahl Looks like a bug? Could you file an issue on GitHub?
Ingemar Ådahl
@ingemaradahl
Naoki Takezoe
@takezoe
Thanks!
Ignacio Javier Fernández Soto
@ignaciofernandezsoto
Hey there! I have a question regarding scalatra. Is there a way to reutilize the url path defined in the servlet?
I have get("/notifications"), get("/notifications/:user_id"), post("/notifications/:user_id"), put("/notifications/:user_id")
I'd like to have something class level, like override def basePath = "/notifications". Is there a way to do such a thing?
Naoki Takezoe
@takezoe
@ignaciofernandezsoto Mapping your ScalatraServlet to /notifications/* doesn't work?
Ignacio Javier Fernández Soto
@ignaciofernandezsoto
Hey Naoki, thank you very much! Got it working
Jonas Natten
@jnatten
Is there an ETA for when a version will be available for 2.13?
Anyone successfully using the 2.7RC in production?
Naoki Takezoe
@takezoe
GitBucket already uses Scalatra 2.7RC1 in order to support Scala 2.13.
Jonas Natten
@jnatten
Hmm, might consider doing the same then if there is no known eta. Thanks :)
Naoki Takezoe
@takezoe
There isn't serious issue in Scalatra 2.7 with Scala 2.13 so far. At first, we planned to include more features in Scalatra 2.7, but we don't have enough resources to complete the our initial plan. So, it may be a time to release Scalatra 2.7.0.
john-roj
@john-roj
Any success on using sbt 1.3.0??? I am getting [error] sbt.librarymanagement.ResolveException: Error downloading org.scalatra:scalatra_2.12:[2.6.50000,2.6.60000) [error] No version found for VersionInterval(Some(Version(2.6.50000)),Some(Version(2.6.60000)),true,false)
Naoki Takezoe
@takezoe
@john-roj What's your build.sbt?
john-roj
@john-roj
I don't think it has anything special... sbt 1.3.0 changes "library management" with coursier. if I apply the ThisBuild / useCoursier := false it works, just wondering why coursier can't find the dependency I am adding scalatra jars under
libraryDependencies ++=  {  val ScalatraVersion     = "2.6.5"
"org.scalatra"               %% "scalatra"                        % ScalatraVersion exclude ("org.slf4j", "slf4j-api"),
        "org.scalatra"               %% "scalatra-scalate"                % ScalatraVersion,
        "org.scalatra"               %% "scalatra-json"                   % ScalatraVersion,
        "org.scalatra"               %% "scalatra-swagger"                % ScalatraVersion,
...
Taras Iagniuk
@taryk
@takezoe hi, could you have a look at my PR when you have a chance please? scalatra/scalatra#979
Taras Iagniuk
@taryk
and a corresponding PR into 2.7.x scalatra/scalatra#980
Naoki Takezoe
@takezoe
@taryk Thanks. Let me take a look. By the way, do you need updating Scalatra 2.6.x? We've already released 2.7.0-RC1, so we don't want to keep enhancing 2.6.x if there isn't strong demand.
Taras Iagniuk
@taryk
@takezoe ah, cool! it would still be nice if you could release 2.6.x, so that we can benefit from the change right now
Naoki Takezoe
@takezoe
This library looks interesting. I wonder if we can replace Scalatra's Swagger support by this library.
Nils Kilden-Pedersen
@nilskp
@takezoe they currently only support Akka HHTP and Http4s. But yeah, it looks interesting.
Naoki Takezoe
@takezoe
I'm trying Tapir now. akka-http / http4s integration is interesting. But it seems to be not able to express all of OpenAPI specification. I think it can't replace Scalatra's Swagger support.