Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Li Haoyi
    @lihaoyi
    seems like a classpath version conflict; can you make sure you've upgraded cask to 0.7.5 throughout your application, and that you're doing a clean compile?
    kurgansoft
    @kurgansoft
    It turns out it did work launching it from the command line. After generating the IDEA project again, launching it from IntelliJ works now as well.
    Li Haoyi
    @lihaoyi
    sounds like intellij's caches were stale; wouldn't be the first time
    oneengineer
    @oneengineer
    How can I make paramter id optional ?
      @cask.get("/tasks")
      def taskPage(id:Option[String])
    It tells me lack of id
    Noel Welsh
    @noelwelsh
    @cask.get("/tasks/:id")
    def taskPageWithId(id: String) = ???
    
    @cask.get("/tasks")
    def taskPageWithoutId() = ???
    oneengineer
    @oneengineer
    the doc says I can use option[T]
    I cannot use override, the combination would kill me
    oneengineer
    @oneengineer
    Also is there any to bypass the parameter check? I.e. I can write extra paramter in the URL than parameters in function without causing error?
    Li Haoyi
    @lihaoyi
    how about id: Option[String] = None or id: String = null
    oneengineer
    @oneengineer
    thanks ! it does the trick
    Markus Joschko
    @jocsch
    What is the best strategy to restrict file upload size?
    Alexandros Bantis
    @ambantis
    Hi, please excuse the noob question. Is it possible to have multiple route objects/classes/traits that are mixed together into a single MainRoute?
    Alexandros Bantis
    @ambantis

    ah ... I implemented it as

    object Foo extends cask.Routes { ... }
    object Bar extends cask.Routes { ... }
    object Application extends cask.Main {
      override def allRoutes = Seq(Foo, Bar)
    }

    Would this be the recommended approach?

    Li Haoyi
    @lihaoyi
    yeah
    or case classes if you want to inject things into them
    jodersky
    @jodersky
    FYI: cask 0.7.6 is now available on maven central, for Scala 2.13 and Dotty 0.27.0-RC1 !
    discobaba
    @uncleweirdo_twitter
    Since I'm a Haoyi fan, I thought I'd try Cask, but was disappointed to find the examples on https://www.lihaoyi.com/cask/ don't run ...
    jodersky
    @jodersky
    that's too bad. But without more information it will be hard to help...
    discobaba
    @uncleweirdo_twitter
    Oh, I figured they failed universally.
    ./mill -w app.runBackground
    Compiling /private/tmp/minimalApplication-0.7.6/build.sc
    build.sc:4: object creation impossible. Missing implementation for:
    def crossScalaVersion: String // inherited from trait CrossModuleBase
    object app extends CrossScalaModule{
    ^
    Compilation Failed
    Li Haoyi
    @lihaoyi
    @jodersky looks like your cross-building for Dotty change broke it, probably just need to tweak the example project mangler over here https://github.com/lihaoyi/cask/blob/master/build.sc#L251 to make it mangle the CrossScalaModule back into a normal ScalaModule
    (we could also make it insert a def crossScalaVersion field, but I think for an example project the non-cross module is simpler and more newbie friendly)
    jodersky
    @jodersky
    oh yes, it seems that indeed the addition of cross-building broke it
    I'll fix it
    Li Haoyi
    @lihaoyi
    will need to tag another numbered version in order to update the example downloads
    jodersky
    @jodersky
    This should do it lihaoyi/cask#36
    I checked locally that the generated examples work. Let me know if you'd still like to review, otherwise I'll publish a new release a bit later
    thanks for the pointer about what broke!
    Li Haoyi
    @lihaoyi
    shipit
    discobaba
    @uncleweirdo_twitter
    Wow, thanks for the quick service;-)
    Jason Zou
    @jasonzou
    Screen Shot 2020-10-20 at 11.38.17 AM.png
    I am new to cask. I downloaded twirl-0.7.7.zip and tried to run. I got the following message:
    Cannot resolve app. Did you mean all?
    Watching for changes to 2 paths... (Ctrl-C to exit)
    jodersky
    @jodersky
    looks like my previous fix didn't catch that one. I'll need to review it again
    in the mean time, can you try using another example? The scalatags example works
    lukas-mi
    @lukas-mi

    Hello,

    I've been trying out cask and so far loving the simplicity!

    However, I have a question regarding how to shut down cask application correctly. Scenario is this: in the main object (extends cask.Main) message consumer is created, this consumer runs in the main's thread. It basically polls a queue (java.util.concurrent.BlockingQueue) and does some work. Now in the router object (extends cask.Routes) on every request its body is put into this queue. So for example if queue consumer fails and throws an exception, I'd like for the whole application to stop. Not sure if it's a good approach but I've tried executionContext.shutdown from within object extending cask.Main but routes are still being served and JVM does not exit. So what's the correct way here?

    Li Haoyi
    @lihaoyi
    Can you look at what the Cask test suites do?
    IIRC they shut down the server when done
    lukas-mi
    @lukas-mi
    Thanks for the response, found the usage of underlying Undertow server. So I guess I'll just override cask.Main.main and create the server directly. Though it would be nice for DefaultHandler to be exposed publicly without needing to extend cask.Main because now I only need defaultHandler from it :).
    Li Haoyi
    @lihaoyi
    yeah cask.Main is a bit of an opaque blob; I never really thought about providing a nice API, if you have some ideas PRs are welcome. But for now, it's hopefully small enough you can deconstruct it and use the pieces you care about directly
    jodersky
    @jodersky
    Happy new year! @lihaoyi I just saw someone mention that the undertow version used by cask contains some vulnerabilities. Is it ok for you if I merge this https://github.com/lihaoyi/cask/pull/42/files?
    Li Haoyi
    @lihaoyi
    go for it
    jodersky
    @jodersky
    I forgot that the upgrade to undertow changes the cookie handling slightly. It will no longer handle cookie values with spaces implicitly; those must now be quoted explicitly. This doesn't affect cask itself, but one of the tests now fails because of a missing feature in scala-requests (lihaoyi/requests-scala#73)
    I can update the test for now, but ideally we'd also fix scala-requests to handle spaces in cookies correctly
    Li Haoyi
    @lihaoyi
    sounds good
    Quafadas
    @Quafadas
    Does anyone have a link to a repo with Cask at the back and scala JS at the front? Does such a thing exist / work "comfortably" together? Intuitively feels like it could work well...
    discobaba
    @uncleweirdo_twitter
    I'm trying to blend cask with a legacy web app (Turbine) so I can slowly convert to a steady diet of scala. I replaced an external web server with embedded undertow thinking I could just split the requests by prefix. That basically works. However I'm not being particularly adept at figuring out how to share the session. Turbine is creating a cookie with the standard JSESSIONID and passing it around, but that cookie isn't showing up in the cask session. Can anyone send me down the right path?
    Siddhartha Gadgil
    @siddhartha-gadgil
    Quafadas
    @Quafadas
    @siddhartha-gadgil Thanks. I'll have a play with these ... I think exactly what I was looking for. Much appreciated.
    daymo
    @daymo
    I'm seeing a warning in Firefox that says The script from “http://localhost:8080/static/app.js” was loaded even though its MIME type (“”) is not a valid JavaScript MIME type. And indeed, when I check the headers content type in the browser it is not set. How can set it in Cask? I tried naively
    script(type:= "text/javascript", src := "/static/app.js") but it didn't make the warning disappear.