|
Implement a REST Servlet
------------------------ Key: OFBIZ-4274 URL: https://issues.apache.org/jira/browse/OFBIZ-4274 Project: OFBiz Issue Type: New Feature Reporter: Adrian Crum Priority: Minor Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: RestConfig.patch RestConfig.patch is a POC configuration that shows how the Example component can support REST requests. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031151#comment-13031151 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ A good candidate for a prototype could be the Webtools' "Entity Data Maintenance" application: we could rewrite it to work with RESTful URIs like webtools/entities/ webtools/entities/orderheaders/ webtools/entities/orderheaders?orderTypeId=SALES_ORDER webtools/entities/orderheaders/10010 (CRUD using GET/POST/DELETE) webtools/entityrelations/orderheader (this will return URLs of related entities) We could provide different representations for the responses (and this could also serve to reimplement the "XML data export" part). > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031149#comment-13031149 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ We need a way to map REST URLs to the appropriate OFBiz services. This issue is for discussion/collaboration on adding REST request handling to the OFBiz project. The REST URLs (or URIs) should represent resources and the HTTP commands should represent actions taken on those resources. The generally accepted convention is that POST is a create operation, PUT is an update operation, GET returns the requested resource, and DELETE is a delete operation. A servlet will be developed that reads a configuration file which maps REST resource URLs to OFBiz services (POC configuration attached). REST Introduction: http://www.infoq.com/articles/rest-introduction A good example of a REST API: http://apidoc.adility.com/submission-api > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031149#comment-13031149 ] Adrian Crum edited comment on OFBIZ-4274 at 5/10/11 12:40 PM: -------------------------------------------------------------- We need a way to map REST URLs to the appropriate OFBiz services. This issue is for discussion/collaboration on adding REST request handling to the OFBiz project. The initial comments/design were taken from a discussion on the dev mailing list. The REST URLs (or URIs) should represent resources and the HTTP commands should represent actions taken on those resources. The generally accepted convention is that POST is a create operation, PUT is an update operation, GET returns the requested resource, and DELETE is a delete operation. A servlet will be developed that reads a configuration file which maps REST resource URLs to OFBiz services (POC configuration attached). REST Introduction: http://www.infoq.com/articles/rest-introduction A good example of a REST API: http://apidoc.adility.com/submission-api was (Author: [hidden email]): We need a way to map REST URLs to the appropriate OFBiz services. This issue is for discussion/collaboration on adding REST request handling to the OFBiz project. The REST URLs (or URIs) should represent resources and the HTTP commands should represent actions taken on those resources. The generally accepted convention is that POST is a create operation, PUT is an update operation, GET returns the requested resource, and DELETE is a delete operation. A servlet will be developed that reads a configuration file which maps REST resource URLs to OFBiz services (POC configuration attached). REST Introduction: http://www.infoq.com/articles/rest-introduction A good example of a REST API: http://apidoc.adility.com/submission-api > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: RestConfig.patch Updated POC configuration. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Component/s: framework > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031517#comment-13031517 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ By default, request payloads (HTTP entity) are basically the target service's parameters wrapped in the resource name. In an XML payload the service parameters are child elements of the resource element (whose tag name is the resource name). This approach leverages the existing service definitions to define a REST resource API. By default, response payloads are the service results. The service result Map is converted to the requested media type. In cases where the request payload is controlled by an external application, the REST resource configuration could map the requests to a service that performs a data conversion (or translation) and then calls OFBiz services with the converted data. The method of converting service results into a response an external application expects is undefined at this time. Supporting this type of functionality (client-defined API) is beyond the scope of the initial implementation. Installations requiring that kind of support could use an ESB for translation. The servlet will support pluggable converters that convert payloads to/from media types (XML, JSON). > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: (was: RestConfig.patch) > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: (was: RestConfig.patch) > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: RestConfig.patch Updated POC config patch. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13031517#comment-13031517 ] Adrian Crum edited comment on OFBIZ-4274 at 5/11/11 4:08 PM: ------------------------------------------------------------- By default, request payloads (HTTP entity) are basically the target service's parameters wrapped in the resource name. In an XML payload the service parameters are child elements of the resource element (whose tag name is the resource name). This approach leverages the existing service definitions to define a REST resource API. By default, response payloads are the service results. The service result Map is converted to the requested media type. In cases where the request payload is controlled by an external application, a custom media handler can be provided for conversion. See the attached patch for an example. The servlet will support media handlers that convert payloads to/from media types (XML, JSON). See the attached patch for an example. was (Author: [hidden email]): By default, request payloads (HTTP entity) are basically the target service's parameters wrapped in the resource name. In an XML payload the service parameters are child elements of the resource element (whose tag name is the resource name). This approach leverages the existing service definitions to define a REST resource API. By default, response payloads are the service results. The service result Map is converted to the requested media type. In cases where the request payload is controlled by an external application, the REST resource configuration could map the requests to a service that performs a data conversion (or translation) and then calls OFBiz services with the converted data. The method of converting service results into a response an external application expects is undefined at this time. Supporting this type of functionality (client-defined API) is beyond the scope of the initial implementation. Installations requiring that kind of support could use an ESB for translation. The servlet will support pluggable converters that convert payloads to/from media types (XML, JSON). > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102559#comment-13102559 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ The HTTP command OPTIONS should return information about the service in the response body - in the requested format. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102570#comment-13102570 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ A nice feature to have would be the ability to support dynamic XML stylesheets so that REST XML clients can validate request/response payloads. The payload XML would contain the stylesheet reference URL, and the servlet would create a stylesheet based on the REST configuration file/service definition. Example XML request payload: {code} <post xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost/webtools/entities/orderheaders/post.xsd"> ... </post> {code} > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: rest-conf.xml.pdf RestConfig.patch Updated patch and PDF file so anyone who is interested can see the configuration file without applying the patch. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch, rest-conf.xml.pdf > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13104849#comment-13104849 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ REST payloads are a Map that contains the service parameters and service results. XStream will be used for the XML representation: http://xstream.codehaus.org/converters.html > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch, rest-conf.xml.pdf > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105193#comment-13105193 ] Adrian Crum commented on OFBIZ-4274: ------------------------------------ A clear distinction needs to be made between HTTP status and service status. OFBiz service results will not be used to modify the HTTP response status. The service results are contained within the response payload - so there is no need to manipulate the HTTP response status. If the request is sent to a valid URL, and if the service was invoked successfully, then the HTTP response status will be 200 (OK). The HTTP response status will be used as intended - to indicate an invalid URL (404), user is not authenticated (401), an exception was thrown while processing the request (500), etc. If a service returns an error, then the HTTP response status will be 200 (OK) and the response body will contain the service results - which will describe the error. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch, rest-conf.xml.pdf > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: RestXmlRepresentation.pdf RestXmlRepresentation.pdf is the proposed XML representation. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch, RestXmlRepresentation.pdf, rest-conf.xml.pdf > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Crum updated OFBIZ-4274: ------------------------------- Attachment: RestExample.xsd RestExample.xsd contains some schema examples. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch, RestExample.xsd, RestXmlRepresentation.pdf, rest-conf.xml.pdf > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
|
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106019#comment-13106019 ] Adrian Crum edited comment on OFBIZ-4274 at 9/16/11 12:14 PM: -------------------------------------------------------------- RestExample.xsd contains some schema examples. The schemas a re pretty basic - just enough to ensure the correct structure. They do not validate service parameters. That was a design decision to keep things flexible. To aid in development, the OPTIONS method could return a set of schemas that include XML templates (inside comments) that can be used to create the XML payloads. was (Author: [hidden email]): RestExample.xsd contains some schema examples. > Implement a REST Servlet > ------------------------ > > Key: OFBIZ-4274 > URL: https://issues.apache.org/jira/browse/OFBIZ-4274 > Project: OFBiz > Issue Type: New Feature > Components: framework > Reporter: Adrian Crum > Priority: Minor > Attachments: RestConfig.patch, RestConfig.patch, RestExample.xsd, RestXmlRepresentation.pdf, rest-conf.xml.pdf > > > Implement a REST servlet that will map REST requests to OFBiz services. Details are in the comments. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira |
| Free forum by Nabble | Edit this page |
