[ https://issues.apache.org/jira/browse/OFBIZ-10438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524296#comment-16524296 ]
Mathieu Lirzin commented on OFBIZ-10438: ---------------------------------------- Here are two patches for the refactoring ([^OFBIZ-10438_0005-Improved-Parse-controller-config-in-one-place.patch], [^OFBIZ-10438_0006-Improved-Split-resolveURI-in-two-methods.patch]) A few comments: - I reverted the use of the {{service}} method since you prefer to narrow to only {{GET}} and {{POST}} methods. - {{resolveURI}} has been splitted to separate the resolution of the uri and the resolution of method - {{resolveURI}} now integrates the logic regarding the override view uri. - I have used a new exception type to handle the special error handling for method not supported however I am not sure about the strategy unconditionally not using the default error page - I have removed the stream based implementation of {{resolveMethod}} which was a bit tricky to understand. - I have adapted the error message to not include the supported method (but not the translation). The reason is that IMO the {{OPTIONS}} method should be used for getting that information instead. - I am not sure we should support both "all" and "" to refer to the whole set of methods. it would be simpler to have only one choice. I don't have any preference. It is possible that I overlooked some of the tests you described above, so tell me if that's the case. > Add method attribute to request-map to controll a uri can be called GET or > POST only > ------------------------------------------------------------------------------------ > > Key: OFBIZ-10438 > URL: https://issues.apache.org/jira/browse/OFBIZ-10438 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: Trunk > Reporter: Shi Jinghai > Assignee: Shi Jinghai > Priority: Minor > Attachments: > OFBIZ-10438_0001-Improved-Add-ControlServlet-service-method.patch, > OFBIZ-10438_0002-Improved-Add-optional-method-attribute-in-request-ma.patch, > OFBIZ-10438_0003-Improved-Factorize-default-request-search-in-Request.patch, > OFBIZ-10438_0004-Improved-Add-RequestHandler-resolveURI-method.patch, > OFBIZ-10438_0005-Improved-Parse-controller-config-in-one-place.patch, > OFBIZ-10438_0006-Improved-Split-resolveURI-in-two-methods.patch > > > As discussed in OFBIZ-4274, OFBiz runs doGet method in ControlServlet no > matter what request it is. > I like Mathieu's comment on adding a method attribute to the request-map > element, it's almost the same as we implemented in our openapi: > > {code:java} > <request-map uri="examples" method="get"> > <security https="true" auth="true"/> > <event type="java" path="ExamplesHandlers" invoke="getExamples"/> > <response name="success" type="view" value="..."/> > <response name="error" type="view" value="..."/> > </request-map> > {code} > The difference is that we DON'T support method list expression: > {code:java} > <request-map uri="examples" method="get,post">...</request-map> > {code} > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)