Hi guys,
This has been a long-standing argument which we couldn't conclude. I will
take Policy-Mgt as an example to explain the problem. There is a front-end
UI that gives the feature to add a policy to the system. This UI will call
an HTTP endpoint using Ajax. The question is regarding the implementation
of the HTTP endpoint. Below are the two approaches currently used:-

   - Write an HTTP API in the Jaggery App - This will convert the POST
   input to a Java object and call an OSGi service to save it.
   - Write a JAX-RS service - This will convert the POST input to a Java
   object and call an OSGi service to save it (Object is serialized to JAXB)

I am +1 for using as much as possible JAX-RS services instead of writing an
HTTP API in the Jaggery App. Below are my reasons -

   1. Writing a Jaggery API couples the API implementation to the Jaggery
   App. Jaggery App is a UI representation IMO.
   2. Couples the authentication mechanism (the Session) to the API. This
   has currently happened in the API Manager store and publisher apps where a
   session cookie is needed to invoke the API [1]
   3. Introducing of wrapper objects and another module layer to the
   Jaggery app. Since there is no JSON serialization libraries (such as a
   JAXB), before calling OSGi, wrapper objects have to be created. This
   increases the complexity in the module layer.

Below are the reasons that I can think of why we need to write Jaggery APIs
-

   - Plugin functionality to UUF? - Where a unit can contain it's API
   implementation.
   - Calling JAX-RS securely from front-end JS. We have discussed and
   arrived at a solution [2]

I understand that we can't eliminate the module layer completely because we
need to perform backend rendering. But think about it, the only time a
backend rendering is needed- is to render an individual view. WDYT?

[1] - https://docs.wso2.com/display/AM190/Store+APIs
[2] - Calling secured JAX-RS services from the browser - Dev mail

Cheers~

-- 
Dulitha Wijewantha (Chan)
Software Engineer - Mobile Development
WSO2 Inc
Lean.Enterprise.Middleware
 * ~Email       duli...@wso2.com <duli...@wso2mobile.com>*
*  ~Mobile     +94712112165*
*  ~Website   dulitha.me <http://dulitha.me>*
*  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
  *~Github     @dulichan <https://github.com/dulichan>*
  *~SO     @chan <http://stackoverflow.com/users/813471/chan>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to