ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Malin (Jira)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-11007) REST: adding segmented URI support
Date Fri, 27 Dec 2019 16:28:00 GMT

    [ https://issues.apache.org/jira/browse/OFBIZ-11007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17004268#comment-17004268

Nicolas Malin commented on OFBIZ-11007:

Hello [~mthl] ,

I reviewed the patch, resync with trunk, correct issues raise by Jacques and after an uncomfortable
situation with the path naming I tried an other naming that I find it more intuitive:

    entity/list -> entitymaint
    entity/{entityName} -> FindGeneric
    entity/{entityName}/{pkValues: .*} -> ViewGeneric 
    entity/edit/{entityName} -> edit form
    entity/edit/{entityName}/{pkValues: .*} -> edit form
    entity/relations/{entityName} -> ViewRelation
This introduce a conflict for the resolution due to the parsing of request map entries didn't
realize on the entry request-map ordered definition in controller.xml (so if you call *entity/list*,
it's *entity/\{entityName}* that would be match), and  generate list of reserved word that
dynamic element can't be use (entity would be never named *list*, *edit* or *relations*)

For the first, I change in function RequestHandler.resolveTemplateURI() the resolution order
 *  check first by raw: entity/list match before any dynamic case
 *  order entries by the dynamic deep. The previous example would be parsing as follow  

    entity/edit/{entityName}/{pkValues: .*}
    entity/{entityName}/{pkValues: .*}     
For the second I think it's not a problem but more on developper hands

The code changed on RequestHandler.resolveTemplateURI() it's just to experiment and exchange
if my idea have some interesting element or smells like death :)
All has been put on [^OFBIZ-11007_refactor-entitymaint.patch]


> REST: adding segmented URI support
> ----------------------------------
>                 Key: OFBIZ-11007
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11007
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: Trunk
>         Environment: 
>            Reporter: Artemiy Rozovyk
>            Assignee: Nicolas Malin
>            Priority: Minor
>              Labels: REST, URI
>             Fix For: Upcoming Branch
>         Attachments: OFBIZ-11007_refactor-entitymaint.patch, OFBIZ-11007_refactor-entitymaint.patch,
entitymaint_example.patch, restful_URIs.patch
> Following the discussion on making OFBiz RESTful OFBIZ-4274 i implemented the support
of segmented URIs without interfering with current mechanisms of URI resolution nor with 
_overrideView()_ feature.
> Combined with work on associating URIs and HTTP methods done by [~mthl] in OFBIZ-10438
, we are now able to provide RESTful APIs as follows:
> {code:java}
> <request-map uri="foo/bar" method="get">
> ...
> <request-map uri="foo/bar/{baz}" method="get">
> ...
> <request-map uri="foo/bar/{baz}" method="post">
> ...
> {code}
> After we matched a request-map having parametrized URI as in 
> {code:java}
> uri="foo/bar/{baz}"
> {code}
> the value is available inside the request attributes with the corresponding key (here
> The *restful_URIs.patch* allows segmented URI support.
> The *entitymaint_example.patch* is a modified _entitymaint_ part that serves as an example
of possible application of new system. 
> Any questions or comments are welcomed.

This message was sent by Atlassian Jira

View raw message