[
https://issues.apache.org/jira/browse/OFBIZ-4274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13107903#comment-13107903
]
Adrian Crum commented on OFBIZ-4274:
------------------------------------
Raj,
I understand what you are saying, but the OFBiz service result does not provide
enough information to affect the HTTP response headers. For example, if a user
was not authorized to create a resource, then an HTTP status code of 403 should
be returned. The problem is, OFBiz services do not categorize results that way
- the results are either "success" or "error" - so there is no way for the
servlet to map service responses to HTTP status codes. We could introduce a new
service return type - like "not-authorized" or something similar, but that
would involve rewriting all of the OFBiz services. There is no one-to-one
mapping of OFBiz service results to HTTP response codes.
As far as web client development is concerned, OFBiz REST client skeleton code
could be provided to make development easier. There is nothing in the code
snippet you provided that would prohibit a developer from connecting the Oracle
Jersey client API to an OFBiz REST client API:
{code}
OFBizRestClientRepresentation orcr = new OFBizRestClientRepresentation("xml");
WebResource webResource =
client.resource("https://localhost:8443/example/services/example");
ClientResponse response =
webResource.accept(orcr.getContentType()).get(ClientResponse.class);
orcr.setResponse(response);
if (orcr.success()) {
// Process response
} else {
// Process error
}
{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: RestExampleSchema.xsd, RestXmlRepresentation.xml,
> rest-conf.xml
>
>
> 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