In this example we will integrate React in an ActiveJ project. You can find full example sources on GitHub. Here we will consider using
AsyncServlet to set up the server that processes the requests. See how ActiveJ makes this process extremely simple.
HttpServerLauncher superclass takes care of setting up
all the required configurations for the HTTP server:
First, we provide an executor for the
Then, we provide an
AsyncServlet to open the
index.html of the provided path.
Finally, we write down
main() method to launch
SimpleApplicationLauncher. And that's it, no additional configurations are required. Simple and streamlined, isn't it?
If you want to run the example, clone ActiveJ and import it as a Maven project. Check out branch v4.3. Before running the example, build the project (Ctrl + F9 for IntelliJ IDEA).
Then, run the following command in
SimpleApplicationLauncher class and run its
Then open your favourite browser and go to localhost:8080