I am planning to build an adapter between a PC and devices which have the same function but which have different interfaces. The adapter will probably be based on a Raspberry Pi and will have a touch display. The PC app will know nothing about which device is actually connected and the device will be selected via the touch screen on the adapter.

I would like the adapter to provide a REST API which will allow the PC to communicate in a standardised way with the attached device. The adapter will indicate on the display which type of device is attached, display the current status and perhaps logging information.

enter image description here

My first idea was to create a Java app on the RPi which has a GUI and is also a REST server. After doing some research I haven't found any examples of this kind of app.

Am I missing something? Is there reason not to mix a REST server and a GUI?


2 Answers 2


Mixing a REST service and a GUI app is likely possible but would be pretty unusual. It would probably be much easier to work with a GUI app that talks to the RESTful service, even if both run on the Raspi. You'd need to design the API such that it supports the management functions that you need on the Raspi, perhaps with additional authorization requirements.


The problem when hosting the api in the same process as the gui is one of multithreading.

You need to be able to respond to requests even if you are doing work in the gui app.

A dedicated http server is designed to handle multiple incomming requests optimally and has the benefit of the OS to balance it with other processes.

However, a good library will provide the same functionality from within another app well enough to work on the small scale you need, as long as you are careful with the interactions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.