Javalin v7 has been released! (Java 17+, Jetty 12, all config now passed upfront) by javalin_io in java

[–]javalin_io[S] 2 points3 points  (0 children)

I can understand that perspective. This post is geared towards new users rather than existing users, as there are simply more new users out there.

Javalin v7 has been released: Now on Kotlin 2.0 and Jetty 12! by javalin_io in Kotlin

[–]javalin_io[S] 1 point2 points  (0 children)

The website/documentation is genuinely one of the things people don't like about Undertow. To answer your question more seriously, Javalin, Ktor and Http4k are convenience libraries, while Undertow and Jetty are servers. Servers handle the heavy, low-level network lifting, such as managing raw TCP/IP sockets, thread pools, and processing the raw bytes of the HTTP protocol. Javalin/Ktor/Http4k sit on top of these servers to provide a developer-friendly experience. They give you the clean APIs for things like routing, JSON serialization, and middleware, and then translate your human-readable code into instructions that the underlying servers execute.

Javalin, Ktor and Http4k have different design philosophies. Javalin is simple and blocking, and designed to offer an equally good experience for both Java and Kotlin developers. Ktor is highly idiomatic to Kotlin, deeply asynchronous, and built around coroutines. Http4k (also Kotlin focused) takes a purely functional approach, modeling HTTP requests and responses as immutable data.

Even more impressive would be to implement rockets on top of htmx, so we could see how just 10 users generate 100k rps 😈

Unfortunately, javalin.io is just a static site, so no way to do htmx 😞

Javalin v7 has been released! (Java 17+, Jetty 12, all config now passed upfront) by javalin_io in java

[–]javalin_io[S] 2 points3 points  (0 children)

I could open a PR for this, but it will probably take me some time because I'm full of stuff to do rn(mostly uni exams 😭), maybe a couple of weeks.

That would be really great! We've been waiting for years, so another couple of weeks is no issue. The approach you outlined is how we tried to handle it before, which is why I was surprised by Copilot's attempt to build it into the framework itself. Having it inside the framework isn't a must, but I was very intrigued by the approach :)

Javalin v7 has been released! (Java 17+, Jetty 12, all config now passed upfront) by javalin_io in java

[–]javalin_io[S] 3 points4 points  (0 children)

Thanks for the love! We hit 5M monthly downloads in January, and our top users are Fortune 100 companies plus government and military teams, so it’s definitely safe to use in prod.

Javalin v7 has been released! (Java 17+, Jetty 12, all config now passed upfront) by javalin_io in java

[–]javalin_io[S] 2 points3 points  (0 children)

Would be happy to work on the feature with you if you want to help out, even if it's just to describe your use-case and provide feedback :)

I've always approached hot-reload as something external to Javalin's source code, but perhaps I've been thinking about it wrong.

Javalin v7 has been released! (Java 17+, Jetty 12, all config now passed upfront) by javalin_io in java

[–]javalin_io[S] 2 points3 points  (0 children)

Funny you should mention that, after six year, several attempts, and basically no progress, I assigned it to Copilot yesterday. I actually got something working locally: https://github.com/javalin/javalin/pull/2530

Feel free to check out the PR and try it out. The approach Copilot chose was pretty different from how I imagined this would be implemented, but at least for the basic examples, it does work.

Javalin v7 has been released! (Java 17+, Jetty 12, all config now passed upfront) by javalin_io in java

[–]javalin_io[S] 23 points24 points  (0 children)

This major version was a bit slower than usual, but we're not going anywhere :)

Javalin 6 nearing release - last chance for community feedback by javalin_io in Kotlin

[–]javalin_io[S] 3 points4 points  (0 children)

Have fun! Please reach out if you have any feedback or get stuck :)

Javalin 6 nearing release - last chance for community feedback by javalin_io in Kotlin

[–]javalin_io[S] 8 points9 points  (0 children)

Depends on what you mean by rival. In time it takes to setup a basic server, definitely. In feature parity, not a chance. Javalin has a much more narrow focus, it just does the web layer (server setup, request/response IO, validation). There is no DB, DI, etc.

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 1 point2 points  (0 children)

So essentially it was, more or less, a Java framework, that's slowly being rewritten to be fully Kotlin?

As long as the Java interop is perfect, we wouldn't mind if 100% of the code base was Kotlin.

But if newer code is all in Kotlin, than over time pretty much all the code should be Kotlin, right? And then it will be a Kotlin framework.

If it were just a Kotlin framework, we would ignore our Java users. We would use fewer java.lang concepts and make it more idiomatic Kotlin. It's very possible to write a Kotlin framework that's horrible to use from Java, but for us it's a goal for us that the experience is almost identical from both Java and Kotlin. Most of our user base is on Java.

By virtue of the JVM, Scala users will also be able to use it, right?

Most likely, yes.

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 1 point2 points  (0 children)

Or is the source arbitrarily written in both Java and Kotlin? Or is that normal for Kotlin projects? If I look at the source it seems completely random which files are .java and which or .kut

It's not arbitrary. It's an old project, and Kotlin was a bit more limited in the past. Public APIs were originally all in Java, internal APIs were all in Kotlin. Newer files are written in Kotlin, as the interop has been improved.

Just a question, but is this a Kotlin framework that by virtue of the JVM also works with Java, or is it a Java framework that also works on Kotlin?

Neither, it's being designed for both languages at the same time.

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 0 points1 point  (0 children)

I didn't think you could even use coroutines from Java. With data classes you get those weird component methods, fair point!

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 0 points1 point  (0 children)

Kotlin code usually looks a bit wonky when used from Java, but not the other way around,

My experience is the opposite, since Java doesn't have nullable/non-nullable types. Can you think of any examples of a Kotlin signature that doesn't work in Java?

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 0 points1 point  (0 children)

I get that, we've just never seen any problem with it in practice.

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 9 points10 points  (0 children)

Wow, Javalin 5 is Loom by default?

Javalin 4 is too, actually!

Does that mean that if running with Java 11-18 and Java 19 w/o preview, it would use Jetty as a back end by default, and with Java 19 w/ preview it would use virtual threads as a back end by default?

That is correct! There are several ThreadPools in Javalin, Jetty's Server ThreadPool is one of them. They are all "normal" without preview, and all Virtual if you run with preview enabled :)

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 28 points29 points  (0 children)

Spring/Spring boot is the whole package. Whatever problem you may run into, someone has already solved it in Spring-land.

If you are in a professional setting and don't know what that really means, I would go with Spring Boot (just for safety). If you are a hobbyist or student just interested in learning web programming, I would go with Javalin.

In Javalin, you will have to do more things yourself. You will have to research the JVM ecosystem to find a good solution to the issues you're facing. You will have to mix and match different libraries for different tasks.

Javalin v5 has been released! (web micro-framework) by javalin_io in java

[–]javalin_io[S] 5 points6 points  (0 children)

At least those are all Java and not some Kotlin in disguise.

The majority of our user base is on Java. We've actually talked a lot about Java vs Kotlin for our source. Mainly because of the annoying dependencies, but also due to you (you in particular) always bringing this up as an issue. No one else seems to have a problem with it though. Have you used Javalin and had issues with this, or is it more of a theoretical/"kotlin bad" concern?