Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    VelizarHristov
    @VelizarHristov
    How do I fix it?
    VelizarHristov
    @VelizarHristov
    Hmm okay actually the error is from akka-stream.
    In StreamOfStreams.scala:796
    Tim Moore
    @TimMoore
    @VelizarHristov can you post your controller code? Likely to be a bug there. It typically means that you've tried to read a request more than once.
    gavinbaumanis
    @gavinbaumanis

    can someone help me with retrieving the path from the URI, progrmatically?
    I am trying to place the following in my MAIN (layout) template to exclude the menu of my app from the index page;
    @if(request.path !="/") { ... }
    I have tried including the Request and the RequestHeader scopes impicitly in the MAIN and/ or INDEX pages with;
    (implicit request : Request)

    I also have the following in my application controller;
    def index: Action[AnyContent] = Action {implicit request =>
    Ok(au.com.ecpr.pas.views.html.index())
    }

    but I can't seem to get it working, no matter what combination I use. : Thanks.

    gavinbaumanis
    @gavinbaumanis
    If i remove the implicit declaration from MAIN I get the following error;
    object path is not a member of package play.api.mvc.request
    VelizarHristov
    @VelizarHristov
    @TimMoore This is how the code for that endpoint looks like:
     def foo() = Action.async { implicit req =>
          makeRequest().map(result => Ok(views.html.bar(result)))
      }
    It looks like the controller doesn't have any interesting config, I think.
    Denis
    @dnspress
    hello! I have a twirl template with this code: @controllers.admin.routes.Admin.ws.webSocketURL(request)
    how to force using wss protocol instead of ws? Play app behind nginx and works without sll at all
    montrivo
    @montrivo
    Hello,
    I saw that the scala.concurrent.blocking { ... } method is not documented in play's thread pool documentation. Should it be avoided?
    VelizarHristov
    @VelizarHristov
    So it looks like my problem is because of sttp? I have sttp using Akka http backend.
    Tim Moore
    @TimMoore
    @VelizarHristov I guess the interesting code would be in makeRequest()
    VelizarHristov
    @VelizarHristov
    Hmm, adding a dependency on akka-http 10.1.10 fixed it.
    Christian Kaps
    @akkie
    Is it possible to use Play 2.7.3 with HTTP/2 and HTTP/1 at the same time. I need to implement an app with gRPC and WebSockets. gRPC needs HTTP/2 but WebSockets do not work over HTTP/2. Is Play able to serve both protocols?
    Christian Kaps
    @akkie
    To answer my own question. Yes it works. I've created a small POC and it works like a charm.
    Renato Cavalcanti
    @renatocaval
    @akkie, have you checked play-grpc?
    oh yes, sorry
    now I recognised your avatar
    Jamal Bouhssine
    @jamalBH
    hello
    I need some help please
    is there any one here
    ?
    Albaro Pereyra
    @AlbaroPereyra
    State your issue @jamalBH
    Piyush
    @piyushpatel2005_gitlab
    how to cast JsString to java.lang.String? I have scenario where I want to convert """[{"groupName":"Capacity Management","attributeName":"Mbps Used","doubleAttributeValue":1000},{"stringAttributeValue":"80 Mbps","groupName":"CIRCUIT ATTRIBUTE","attributeName":"Bandwidth"}]""" into "[{"Capacity Management": 1000},{"CIRCUIT ATTRIBUTE" : "80Mbps"}]"
    Piyush
    @piyushpatel2005_gitlab
    ok found it.
    Christian
    @bakku
    a small question: I want to show the name of the application in a navbar, the name of the application is configurable in the application.conf
    the navbar is a separate layout
    Since the play application is not global anymore I have to pass in the configuration via DI right ?
    what would be the most elegant solution to not have to pass the configuration into every controller and from the controller into the view
    deepaknagadi
    @deepaknagadi
    Hi I am trying to build a Kafka Consumer using PLay + Java
    Currently I am manually triggering my consumer using a route mentioned in my routes file
    Is there an example wherein once I have my application running it will be automatically listening to Kafka topics ?
    deepaknagadi
    @deepaknagadi
    is this channel active ?
    Igmar Palsenberg
    @igmar
    Tes
    We use alpakka to create the consumer, and start it on bootstrap. Use an actor for that, or an eager singleton bound in Guice
    deepaknagadi
    @deepaknagadi
    Is there an example that I can see ?
    new to the entire framework
    Igmar Palsenberg
    @igmar
    X
    Upgrades within 2.5.x should fine. Else look at the release notes
    deepaknagadi
    @deepaknagadi
    you mean alpakka ?
    Igmar Palsenberg
    @igmar
    We use alpakka for all IO, yes
    Lagom should be able to do this out of the box.
    deepaknagadi
    @deepaknagadi
    Lagom ...you mean play ?
    Igmar Palsenberg
    @igmar
    Else materialize in a separate class, and bind that as an eager singleton
    Igmar Palsenberg
    @igmar
    Lagom is build on top of Play
    Andres Jaimes
    @ajaimesv

    Hey there! I’m trying to read a ZonedDateTime instance from a json request with a custom format. For this I’m implementing my own Reads, but play seems to ignore it.

    My code looks like:

    case class MyClass(
      a: Int,
      b: String,
      date: ZonedDateTime
    )
    
    object MyClass {
      implicit val myClassFormat = Json.format[MyClass]
    
      implicit val readsZonedDateTime = Reads[ZonedDateTime](js =>
        js.validate[String].map[ZonedDateTime](str => {
            val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss")
            ZonedDateTime.parse(str, formatter.withZone(ZoneId.from(ZoneOffset.UTC)))
          }
        )
      )
    }

    but I keep getting this error:

    {
      "msg": [
        "error.expected.date.isoformat"
      ],
      "args": [
        "(ParseCaseSensitive(false)(Value(Year,4,10,EXCEEDS_PAD)'-'Value(MonthOfYear,2)'-'Value(DayOfMonth,2))'T'(Value(HourOfDay,2)':'Value(MinuteOfHour,2)[':'Value(SecondOfMinute,2)[Fraction(NanoOfSecond,0,9,DecimalPoint)]]))[Offset(+HH:MM:ss,'Z')['['ParseCaseSensitive(true)ZoneRegionId()']']]"
      ]
    }

    Could you please help me get this right?

    Andres Jaimes
    @ajaimesv
    I guess the default Reads implementation is trying to parse the date, hence ignoring my code.
    ErVito
    @ErVito
    Hi guys, I'm quite new to web-development in general and I'm experimenting with Play and forms. I've read the doc and I've seen from the api reference that a Form offers a fill method and a bind one (that, differently from the bindFromRequest, offers the possibility to bind a form to a specific Form or JsValue).
    So, forgive me if the question is trivial, what's the difference between a fill and a bind?
    Thanks in advance.
    Igmar Palsenberg
    @igmar
    fill() prefills a form with an initial default value
    bind() is the low-level flavour of bindFromRequest()