Thank you Mathieu, this makes things clearer and yes I stand corrected on using the word protocol instead of method.
I appreciate your patience and help in easing my way to your code, and please excuse any dumb questions from my side :) it's a bug chunk of code indeed. Examining your patch I have a few comments / questions: - Your explanation of the second and third patch is very brief, perhaps some elaboration could help? Can you describe the architecture and design and what you're trying to do? - The RequestHandler.java is really painful to look at. 1291 (jumping to 1355) lines of code, giving a sign of design issues. Maybe while working on implementing this feature we need to first refactor this file. It's HUGE and almost impossible to navigate. What do you think about refactoring it as a first step? - What is the purpose of the new Controller object? - What is the purpose of adding the new data structures from javax.ws.rs? What features do we need that are not covered by the standard collection APIs? - Can you elaborate on the connection between the architecture you're trying to apply with the resource example provided by Scott in [1]. Specifically, do we intend to include resource definitions in the DSL? How will they relate to the controller as patched in your work? - Can you provide a full explanation of the targeted architecture? It seems you're saying you have patches that you want to apply so that you can prepare other patches. What is the combined result of all of those? What exactly do you want to provide as the final architecture? Can you give us an idea of the full envisioned workflow from submitting a REST URL throughout the whole cycle? Thank you in advance for your feedback, and keep up the momentum, It's exciting stuff! [1] https://issues.apache.org/jira/browse/OFBIZ-4274 On Sat, Jul 7, 2018 at 3:36 PM, Mathieu Lirzin <[email protected]> wrote: > Hello Taher, > > Taher Alkhateeb <[email protected]> writes: > >> Before we dig into the details, may I first understand _why_ are you >> adding that functionality in the first place? In other words, you can >> decide on the HTTP protocol from the calling page right? If it is a >> form, it's a POST, if it is a URL, it's a GET, or you can override >> that in certain areas using the OFBiz DSL. So what is the purpose here >> of adding this functionality in the controller? If we implement a >> RESTFUL API, wouldn't we still decide on the HTTP protocol from the >> client side? Or am I missing something here? > > I guess by “HTTP protocol” you actually meant “HTTP method”. The reason > I want to add a ‘method’ attribute is that I want the controller to be > able to provide a RESTful API, where each HTTP method has semantics > attached to it [1]. > > The controller is where requests are dispatched to there corresponding > handler (event, service, view). Currently it is written in a RPC way > where URI refers to *actions* instead of *resources*. For example take > the Geo management from the webtools controller: > > <request-map uri="LookupGeo">...</request-map> > <request-map uri="createGeo">...</request-map> > <request-map uri="updateGeo">...</request-map> > <request-map uri="deleteGeo">...</request-map> > > In order to implement a RESTful API with the same capability. The idea > is to define a “geos” resouce which is a container of geo resources and > implement the different *actions* available on those resources via the > various HTTP methods available. So this would convert into something > like this: > > <request-map uri="geos" method="get">...</request-map> > <request-map uri="geos" method="post">...</request-map> > <request-map uri="geos/{id}" method="update">...</request-map> > <request-map uri="geos/{id}" method="delete">...</request-map> > > The last two examples requires additional changes that are not > implemented in the patches from OFBIZ-10458: > > - Handling URI templates > - Replacing the overridden view URI feature with an alternate solution. > > I am currently working on this in parallel of the JSON view handler. > > Does this additional explanation and example help? > > Thanks for the feedback. > > [1] https://www.restapitutorial.com/lessons/httpmethods.html > > -- > Mathieu Lirzin > GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37
