Github user CMoH commented on the pull request:

    
https://github.com/apache/incubator-brooklyn/pull/1140#issuecomment-171728832
  
    @neykov Thanks for taking the time to review this (rather large) PR.
    
    I have tried to keep changes out of ```rest-api```, and now I'm trying to 
factor the ```rest-api-cxf``` project back into the original. Doing a diff 
between folders revealed the following types of changes:
    
    1. To get the simple matter out of the way: the ```@Context UriInfo ui``` 
parameter. I completely agree with your suggestion and will implement it. 
However, I was wondering if using swagger to generate the ```rest-client``` 
would not be easier (allowing us to collapse the annotations directly into the 
resource classes). #1100 generates the swagger spec during build, so this 
should be quite feasible now. I might experiment and come back to you, but I'm 
curious if you think this endeavour is worth the time.
    
    2. ```CatalogApi.createFromMultipart()``` uses non-standard annotations for 
injecting form parameters. I can experiment using the standard JAX-RS 
```@FormParam``` annotation as a common denominator.
    
    3. The new CXF resources are no longer annotated with the full URI path 
(e.g. ```/catalog``` instead of ```/v1/catalog```), which can help relocate the 
REST API independent of other WARs - including ```brooklyn-jsgui```. To 
complete the picture: CXF is exposed by default in karaf at ```/cxf```, and 
under that each service has its own context path (see ```jaxrs:server``` in 
```src/main/resources/service.xml```). For the purpose of backward 
compatibility I moved the entire CXF servlet from the default ```/cxf``` to 
```/v1``` (see 
```karaf/apache-brooklyn/src/main/resources/etc/org.apache.cxf.osgi.cfg```) and 
left the ```rest-resources-cxf``` path at ```/```, therefore yielding 
```/v1/catalog```. However, I can't think of this as a permanent solution.
    The end-plan is to have JSGUI configurable with the REST base URI, 
therefore leave CXF with its default servlet context (or whatever the karaf 
administrator may choose) and have the brooklyn REST APIs at 
```/brooklyn/v1```, ```/brooklyn/v2``` etc. Would that be doable in the far 
future?
    
    4. The hardest problem: Jersey-1 uses JAX-RS-1.x 
(```jsr311-api-1.1.1.jar```), while CXF-3.1.4 relies on JAX-RS-2.0 
(```javax.ws.rs-api-2.0.1.jar```). For this reason CXF is unable to find the 
annotations on resources, in spite of its advertised JAX-RS-1.1 backward 
compatibility. Actually this was the main reason for forking the ```rest-api``` 
project. If we can find a solution to this, we can merge back the two API 
projects.
    
    Sorry for the lengthy reply. Basically points 1 and 2 are more informative, 
while points 3 and 4 are more important. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to