Web dev rookie here, I don't quite understand the common abstractions for servers in the Java world. I sort of understand the concept of servlets, but checking the documentation for Ktor I've read that Ktor can run on a servlet container, like Tomcat. Does that mean Ktor is a servlet itself? Or that implements the servlet interface somewhere, so it can run on Tomcat?
k
kqr
03/20/2021, 4:26 PM
I know nothing about it, but I guess it will register some kind of frontcontroller servlet in case of servlet web containers
@Manuel Pérez Alcolea the concept of servlets (and the whole Java EE stuff) is a bit old and "legacy". It's still widely used but in my opinion it's not considered "modern" anymore. You can check this article to read about current trends in server-side java world: https://jamesward.com/2021/03/16/the-modern-java-platform-2021-edition/
m
Manuel Pérez Alcolea
03/20/2021, 5:33 PM
thanks @Robert Jaros, that was a nice read. You shared it to complement what I know, right? Or does it answer my question about Ktor? I understand now that there are several acceptable ways to set up a server (http or not) but there are so many tools and concepts it's a bit overwhelming even today.
I've read about different things "X is a servlet that runs on Tomcat" but also "Tomcat is an implementation of the Java Servlet", so... both of them are servlets? Or is there a difference between "servlet *the class*" and "servet the environment/specification/server-of-servlets" or whatever that makes sense? I've always thought the Java world made very poor choices when it comes to terminology, I dunno.
r
Robert Jaros
03/20/2021, 8:46 PM
Tomcat is a servlet container - an application. It runs web applications packaged as war archives (a set of java classes). Servlet is a java class - a compiled java or kotlin code. And servlet is also a technology described by Java EE specification.