Live data from Hacker News

Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

javalin.io

21–30 of 139 posts

Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

#21
post #10
post #8

I'm pretty sure the "Hello Javalin World" Kotlin example won't compile, just FYI.

Seems to compile fine here, what's the issue? Edit: I was looking at the wrong snippet, the offending snippet has been fixed.

Probably not used to seeing lambdas inside of parens:

  .get("/", ctx -> ctx.result("Hello World"))
Could also be written as

  .get("/") { ctx -> ctx.result("Hello World") }
The second form seems much more common in Kotlin.

Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

#22

I haven’t tried this framework, but just looking at some examples, the web sockets and sse seem a bit out of place. In a Loom world you’d expect these to use channels or queues or something similar in a loop - not callbacks. Callback hell is what virtual threads try to avoid. I’m not sure if loom has any primitives like go’s multi-channel select that might make this workable though. In either case Loom and frameworks…

Having recently implemented a WebSocket service in Go, the Javalin way seems preferable. This is what a similar Go version would look like:

    wsHandler := func(w http.ResponseWriter, r \*http.Request) {
        conn, err := upgrader.Upgrade(w, r)
        if err != nil {
            w.SendStatus(http.StatusInternalServerError)
            return
        }

        ctx, ctxCancel := context.WithCancel(context.Background())
        var wg sync.WaitGroup

        wg.Add(1)
        go func() {
            defer sync.Done()

            for {
                msg, err := conn.ReadMessage()
                if err != nil {
                    return
                }
            }
        }()

        msgPipe := make(chan []byte, 1024)
        wg.Add(1)
        go func() {
            defer wg.Done()
            for {
                select {
                case 
I like Go, but I found writing WebSocket code very annoying.

Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

#23
I just wanted to say thank you for your work. The straightforward docs are some the best in my opinion when you want to go from "How do I do ..." to answer.

I ended up using Javalin with Kotlin and SQLite to build my wedding website.

Most of my projects are lucky to see the light of day, but with a very persistent project manager and a simple lightweight framework, I was able to ship a fantastic product with very little fuss.

Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

#24
post #6

Javalin is the bomb! I don’t know why Java community likes to make things complicated.

“An idiot admires complexity, a genius admires simplicity, a physicist tries to make it simple, for an idiot anything the more complicated it is the more he will admire it, if you make something so clusterfucked he can't understand it he's gonna think you're a god cause you made it so complicated nobody can understand it. That's how they write journals in Academics, they try to make it so complicated people think you're a genius.” - Terry A. Davis

Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

#29
this is very cool. quick question though - do u have a gradle build setup ? im new to java and saw this problem on spring boot. That you needed to have this bunch of complex directory structures cos of the way java packages worked. for e.g. the test directories were parallel to the src directory, so they could be named with the same package name.

for a single file...i can just run java. but it would be nice to see a gradle setup that keeps simplicity and yet can have thousands of files and testcases organised in a nice structure.

secondly, it is nice that you have Jetty hooks. Can you also have CORS & proxy protocol ? its literally mandatory to have this stuff if ur deploying on any of the k8s based clouds.

e.g. https://stackoverflow.com/questions/73225314/accept-proxy-pr...

Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making

#30
post #10
post #8

I'm pretty sure the "Hello Javalin World" Kotlin example won't compile, just FYI.

Seems to compile fine here, what's the issue? Edit: I was looking at the wrong snippet, the offending snippet has been fixed.

Huh, I wonder what's different with my setup. I would need to put curly braces around that closure before it would compile, i.e:

    .get("/", { ctx -> ctx.result("Hello World") })
Closures defined only by the arrow are a Java thing... or so I thought. :D
Post reply on HN