We're going to create a client-server side application, where the client side was initially requested to be a desktop app. We have no experience in creating these applications using Java, but we have already started thinking about tools that we're going to use.
For example, we decided that we're going to use Spring
as the framework that will receive the requests, process them, by eventually fetching data from the data base (MySQL), and then return a response.
I'm not sure yet what will be the format of these responses (and requests from the client-side app), but it should be as much independent as possible from the client-side, so that if the customer changes opinion and decides that he/she wants a web or a mobile app, we don't need to change the server-side code that processes all the requests.
By looking at a project's source code provided by of one of us, who had already have some experience in this field, apparently he had used HttpServletRequest
and HttpServletResponse
objects as parameters of all methods of the controllers. I think it's a server-side Spring app. In this case, specifically, it would be a controller class, which processes requests to a certain URL.
The code is easier to understand, because it's similar to how I had worked with Javascript, Node, Express and Mongo sometime ago. It's all based on the MVC pattern. In that environment, requests were made either by writing the URL on the browser or by using XMLHttpRequest
(AJAX).
Now, my doubts and problems are:
If we really need to create a desktop app, for example with Swing, how are we going to do requests to the Spring controllers?
What's the best way to decouple the server-side code from the client-side code? Is JSON useful here? If yes, how roughly would it be used?
Should we use a framework also on the client-side that has the specific job of doing requests to the Spring controllers when necessary, or is it enough to somehow hard-code the requests? And how would this framework eventually deal with Swing?
Where would JDBC fit here? In the server-side code, I suppose. But when should we use it exactly?
Sorry, these are a lot of questions, but we're not introduced to these environments before, so we're somehow lost.