H
H
Hermann Demin2021-06-07 20:10:36
Java
Hermann Demin, 2021-06-07 20:10:36

How to write java http local server?

Greetings!

Could you tell me how to write a simple local server that could run local files, for example .bat , on receiving certain requests?
I learned how to set up a local server in java using the om.sun.net.httpserver library, but I just can’t figure out how to make it able to perform certain actions on certain post requests.
At the moment, I already have a server that listens on a specific port on the locale, but my attempts to write logic fail. I would be glad if you at least tell me in which direction to move and where to read

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Shitskov, 2021-06-07
@Zarom

Maybe Jenkins is for you. It will be possible to launch both manually through the interface, and through api / hooks

V
Vladimir Korotenko, 2021-06-07
@firedragon

Why explain for God's sake? A bunch of servers and a small cart.

O
Orkhan, 2021-06-07
Hasanly @azerphoenix

You can write a couple of servlets that, for example, with GET || POST request will launch your batch file.
Here, here about servlets - https://www.baeldung.com/intro-to-servlets
Here, here about running a batch file - https://stackoverflow.com/questions/615948/how-do-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question