First of all, I am (unfortunately) not a professional programmer, that’s why I am asking for some basic help as startup.
I want to write a server side script in Java to receive URL-Requests from IoT devices and perform a post request to OH rest API to send commands to an item.
Those IoT devices do not support http/post request.
For this I have written a javascript (see here) but then I found out, that some IoT devices do not support javascript - that’s why I want to write a servlet.
Basically a small replacement of the BasicUI CMD servlet.
My questions now are where and how to start.
Ideally I just write the java code and embed it so that the code runs when a specific website is opened without the requirement to install a couple of professional programmer’s development tools.
Does anybody have a good starting point or experiences you’d like to share?
Seems you found your solution else where. Just in case if you are curious how shortest way looks a like see code below. Address to call is /cmd?item1=ON&item2=OFF&item3=10.3, so it allows to produce batch requests.
Hi Lukasz,
yes Piotr has developed a nice http listener which is a good solution.
However, I wanted to start coding something on my own in java and - who knows - maybe one day a binding (most probably not within the next five years ). So, I wanted to pursue this definitly further.
First of all, many thanks for your code.
On a high level, what are the next steps (compiling) and where do I have to copy the file?
You need to follow developer guide and install necessary dev tools (Java, IDE or text editor + maven). Once your tools are installed properly you can run binding skeleton script you can find in openhab addons repository. There you will get everything needed to attempt first compilation.