by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Will Sargent
    @wsargent
    I think one of those is what you want
    objektwerks
    @objektwerks
    @wsargent In other words, like with other Scala Http libraries, can I start ( in an integration test ) a Play application and then submit Http calls to it via an Http client of my choice. Today, for instance, I can do this using Akka-Http and Http4s. In effect, I would NOT be using any of the Play testing apparatus. Just think of it as an old-fashion integration test: client --- request/respone ---> server.
    In an older version of Play, I recall developers using something like NettyServer.createServer(...) to do what I want. Perhaps, that rings a bell. :)
    Alexis Hernandez
    @AlexITC
    If I understood you, this example could help, it's not different from any other test
    if what you want is to get the WSClient to invoke external servers, play docs explain how to construct one manually
    Will Sargent
    @will_sargent_twitter
    yah wsclient
    and OneServerPerSuite integration test
    you can embed apps or extract that code but i dont know why you would
    objektwerks
    @objektwerks
    @will_sargent_twitter @AlexITC Thanks, guys. I'll look into your suggestions. No doubt my request seems odd on a play forum. It's quite common else where. But, then, frameworks and libraries often function on different wavelengths. ;) Cheers!
    cutoffurmind
    @cutoffurmind_twitter
    Hey guys, I'm using alpakka s3 connector with latest play, is there any way to monitor akka-http connection pool? After some time I start getting exceeded configured max-open-requests value of 1024 and old connections are not closing so it breaks every stuff wich use Alpakka s3 and only server reboot helps
    cutoffurmind
    @cutoffurmind_twitter
    Also it seems akka-http and alpakka doesn't work with my application.conf akka configuration when I run it locally (sbt run) but it works fine on my test/prod delivered with sbt docker:publish
    Jason Pickens
    @steinybot
    I’m writing a custom body parser and for some reason the connection is being closed by play while the accumulator is running. Any idea why that might be the case?
    Jason Pickens
    @steinybot
    Ah ok so it is the idle timeout. Something clearly isn’t working with my body parser.
    @ugobourdon
    @ubourdon
    Hi all. I try to upgrade my playframework form 2.5 to 2.7 and i have issue with using play.api.Play.current. I have error message saying set play.allowGlobalApplication = true and i do it but that change nothing. Have you an idea ?
    1 reply
    demzpaul
    @demzpaul
    Anyone else having issue with webcal protocol not coming through? Or how can I add a custom HTTP method for webcal:// to the router?
    amantuer
    @amantuer
    Hello everyone, I want to get the number of result of sql sentence "SELECT max(id) FROM lib.table1" how to edit the code below to get the right INT value for variable “maxid” ?
    val maxid = SQL("SELECT max(id) FROM `lib`.`table1`")
    Andrew Selvia
    @AndrewSelvia
    Should it be possible to run a hello world Play 2.8 app within a Docker container running on a f1-micro (~140 MB of free memory) VM on GCP? I've tried setting "-J-Xmx128m" within javaOptions within build.sbt. I've also tried capping the container with -m 128m. I'm not having success, so I wanted to see if anyone had suggestions.
    Andrew Selvia
    @AndrewSelvia
    I have finally made it work with "-J-Xmx128m" & -m 256m. Still taking suggestions & advice.
    Alexis Hernandez
    @AlexITC
    I'm running play in an old raspberry pi, and it requires around 256mb
    Will Sargent
    @will_sargent_twitter
    play does not need a bunch of memory but you may run into load problems at a high request rate
    and use zgc or shenodah if possible
    zee
    @zee13621414_twitter
    Hey guys, where do I find the Some ( cookie : Cookie) method documentation? I am trying to figure out what is does..
    Alexis Hernandez
    @AlexITC
    look into the actual source code
    vasily802
    @vasily802

    Hi guys, can someone please help:
    I'm making a long-running database call from my Play2.7 app and getting

    DEBUG a.a.RepointableActorRef: 
    Aborting tcp connection to /0:0:0:0:0:0:0:1:60454 because of upstream failure:
    akka.http.impl.engine.HttpIdleTimeoutException: 
    HTTP idle-timeout encountered, no bytes passed in the last 75 seconds. 
    This is configurable by akka.http.[server|client].idle-timeout.

    I tried to make it wait longer by modifying the setting mentioned in the output in my src/main/resources/application.conf. I also tried following Play2 documentation here: https://www.playframework.com/documentation/2.7.x/SettingsAkkaHttp and setting play.server.akka.requestTimeout = "infinite". However, I still get that "75 seconds" message. How to override this timeout setting?
    Thanks a lot

    Philip Whitehouse
    @philipwhiuk
    Why?
    Why not return immediately and then show progress async
    vasily802
    @vasily802
    That's not even my code, but I got ta make it work
    Deepak Kumar
    @basicobject
    Guys I am not able to use this example to downlaod a file, the IDEA cries about andThen method, when I checked the CompletionStage it doesn't have a method andThen. https://github.com/playframework/playframework/blob/783766da4140f8c9907b18581432a97f544ab0f0/documentation/manual/working/scalaGuide/main/ws/code/ScalaWSSpec.scala#L388
    Antoine Doeraene
    @sherpal
    RunWith returns a future, andThen is a method of future but you need an implicit ExecutionContext in scope.
    Deepak Kumar
    @basicobject
    I did not understand runWith(sink) here returns a CompletionStage[Done]. Yes I do have the ExecutionContext in scope via DI
    Antoine Doeraene
    @sherpal
    Is it possible that for some reason you are manipulating objects from the javadsl and the code is expecting objects from the scaladsl?
    Manish Patil
    @manishspatil

    Hey Guys,

    I am new to Play Framework and had look at few examples. Also I picked up "Play for Scala - Covers Play 2" for reference. It seems little bit outdated so can you recommend me get up to the level with Play particulary from Scala's snadpoint of view.

    Many Thanks

    Deepak Kumar
    @basicobject
    package common
    
    import java.io.File
    
    import javax.inject.Inject
    import play.api.libs.ws.{WSClient, WSResponse}
    
    import scala.concurrent.{ExecutionContext, Future}
    import akka.stream.Materializer
    import akka.stream.javadsl.Sink
    import akka.util.ByteString
    
    class FileDownloader @Inject() (ws: WSClient)(
        implicit mat: Materializer,
        ec: ExecutionContext
    ) {
      def download(url: String): Future[Unit] = Future {
        val file = File.createTempFile("stream-to-file-", ".txt")
        val futureResponse: Future[WSResponse] =
          ws.url(url).withMethod("GET").stream()
    
        val downloadedFile: Future[File] = futureResponse.flatMap { res =>
          val outputStream = java.nio.file.Files.newOutputStream(file.toPath)
    
          val sink = Sink.foreach[ByteString] { bytes =>
            outputStream.write(bytes.toArray)
          }
    
          res.bodyAsSource
            .runWith(sink)
            .andThen {
              case result =>
                outputStream.close()
                result.get
            }
            .map(_ => file)
        }
      }
    }
    I didn't change anything here, I just copy pasted to see if it works in one of
    my play project.
    But the IDEA cries about the andThen method, here runWith returns a CompletionStage[Done], this being a code from documentation and a test is threre so the code should work as expected. But I don't understabdn why it is not working in my case.

    Hey Guys,

    I am new to Play Framework and had look at few examples. Also I picked up "Play for Scala - Covers Play 2" for reference. It seems little bit outdated so can you recommend me get up to the level with Play particulary from Scala's snadpoint of view.

    Many Thanks

    I just follow the documentation from the website it is really good.

    Antoine Doeraene
    @sherpal
    So indeed your sink comes from the javadsl (see the import line 10). When you use runwith using the Java api you get a completionstage. So you need to change your imports to use the scala dsl instead.
    Deepak Kumar
    @basicobject
    That's cool, looks like the error is gone, I will test it out, thanks
    Andres Jaimes
    @ajaimesv

    Howdy everyone,

    For some time I have created Play applications using the controllers -> services -> persistence pattern. I have been lately learning about akka actors. The question is, what can you tell me about actors, should I start using them? do you use them frequently? what for?

    I have seen some examples where people use them for persistence operations, remote calls, and anything where a long processing times are involved. If I’m asking this, probably I need to keep reading. It’s just that I can't see yet a real benefit of using them from what I’m doing right now.

    Thank you.

    swhelan-mim
    @swhelan-mim
    Hello all,
    With the recent deprecation and subsequent removal of the request() method is there a way to access the request object from within a validate() method on a form?
    Thank you.
    sfkpmr
    @sfkpmr
    First time using Play, trying to get it to work in Eclipse. I've installed sbt and added sbteclipse to plugins.sbt. I've run sbt compile and sbt eclipse, and then finally imported the project into Eclipse. BUT, now I'm having lots of "cannot be resolved to a type" errors in routes.java. Like, import router.RoutesPrefix and controllers.ReverseHomeController
    gispathfinder
    @zyxgis
    hello all
    How to package my app which is based on play2.7 to war
    Antoine Doeraene
    @sherpal
    @ajaimesv Play is built upon akka actors, but does everything so that you don't really need to use them. A few exceptions are
    • websockets handling (doing that using actors is a breeze, so be sure to check the Play websocket docs)
    • scheduling tasks for doing daily or weekly jobs, for example
    Andres Jaimes
    @ajaimesv
    thanks @sherpal will read about those topics :thumbsup:
    Andres Jaimes
    @ajaimesv
    Thinking about "does everything so that you don't really need to use them” does not mean I should not use them right? But by using them, I guess, I’m not going to get any extra akka benefit, because play is already using them under the hood
    Antoine Doeraene
    @sherpal
    Of course you can use them, and they are easy to integrate with play, precisely because play is built on them (there is already an actor system for you to use, for example)
    Andres Jaimes
    @ajaimesv
    this is very helpful. thanks again Antoine (@sherpal).