1.1 Introduction to web applications

Today we are starting to learn how to write our own web applications . Large, complex server-side web applications are where Java dominates. And where do Java programmers make the most money :)

So what exactly are these web applications? A web application is a program that has a web interface instead of a graphical interface that can be opened in a browser like a regular website. Thus, a large and complex program runs on the server, and can be accessed from any browser.

What is the difference between a website and a web application? There is no hard border. The site is more designed for storing and displaying content. A web application, on the other hand, does large and complex tasks on the server.

For example, you have a web application that, through a simple interface, allows you to edit video on the server. It is difficult to call such an application a website.

Go, for example, to the GitLab service and try to say that this is a "site"

1.2 Introduction to web servers

Back in the 90s, when the first web applications appeared, they came up with the idea of ​​dividing them into two parts: the web application itself and the web server .

The web server took over all the routine work of working with the HTTP protocol:

  • Serving static files such as HTML, CSS, JavaScript;
  • Management of access rights to resources;
  • Management of loading, operation and unloading of web applications;
  • Logging, error logging;
  • Ensuring the interaction of web applications with each other and the like.

The business logic of the application was moved to the web application, and everything that all web applications have in common was moved to the web server. This made it possible to develop a web server independently of a web application, and to use one web server in thousands of applications.

As a result, the web server has become a platform for web applications. It even has its own API that web applications can call.

But most importantly, due to the fact that one server was used thousands of times, it was very profitable to spend the efforts of the Java community to add features to a common web server, and not to everyone in their own web application.

This is how the most popular web server for web applications written in Java, Apache Tomcat, was born. The official page of the project is https://tomcat.apache.org/

This is a very powerful web server and can be configured very flexibly. It is already over 20 years old and its 9th version is now available. In fact, it's an industry standard, so you need to learn how to work with it.