I am relatively new in terms of Java web development skills. I have a project that I think would make a good candidate for a RESTful service from what little I understand about APIs. I'm trying to get into the details of how this is supposed to be structured, but not really getting anywhere in terms of google searches and reading the material I already have. I'm hoping that this post will yield some validation and/or redirection in terms of my knowledge and assumptions on this topic.
My current assumption is that my RESTful service will have the following structure:
- Database Data (SQL).
- An ORM (I'm using a relatively unpopular ORM called CPO, but this would just be replaced with Hibernate with most people).
- A Java manager class with methods that talk to the ORM to obtain the data
- A Java controller class/classes that handles request mapping and uses
@ResponseBody
to direct/handle the URL and actions of how the data is handled via HTTP verbs (http://mysite.com/computers/dell might beGET
request with the word "dell" in the URL being a parameter that will return a JSON array of information about dell computers). - This service should be made with Spring Boot, or somehow be able to stand alone and be independent of any other application.
Now assuming that the above is correct, then I'd have (on a very basic level) a RESTful service that any application can use to consume and use data.
So say I then have my web application. Let's say I'm making a web app about computer hardware information, and I'm using Spring to build this web app. Here are my assumptions:
- I'd have a bunch of views as JSPs, with the JSPs having HTML, CSS, and JavaScript includes. The JavaScript would handle AJAX calls to this application's controller as needed (below).
- This web app would also have it's own controller to handle the app's URL requests and routing, and the controller would then use, say, the
ModelAndView
object or something along those lines to "talk to" the RESTful service's controller, obtain whatever data is being passed, pass that data back to the view (Javascript, JSP, etc...) for display.
Am I on the right track, here? I understand that there is also an authentication aspect to RESTful services, but I'm not there yet conceptually (and my project is going to be used in a private network so security is not a priority at this point).
Any insight, criticism, knowledge, feedback, or clarification is greatly appreciated.