Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #88 from dleangen/web-minor-updates
Browse files Browse the repository at this point in the history
Very minor changes to web provider
  • Loading branch information
pkriens authored Sep 6, 2017
2 parents 3a6b76c + cd0db8f commit 3674cb3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
14 changes: 0 additions & 14 deletions osgi.enroute.rest.simple.provider/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,6 @@ In REST protocols, the `PUT` verb would be used to store a new person. To create

Since the REST methods provide full type safe access to the parameters and remaining URI segments a significant amount of validation is executed by the implementation of this service. These validations will result in the appropriate HTTP error and status code. Implementation should also add explanatory texts to the response.

Additionally, the REST methods may throw any exception. You have two approaches: a "DDD-ish" approach, using a limited set of Exceptions that correspond directly to the most commonly used HTTP errors, or by using regular Java Exceptions, which get translated.

Example of a "DDD-ish" approach:

Person putPerson( PersonRequest request ) throws BadRequest400Exception, NotFound404Exception {
...
}
Using regular Exceptions would look more like this:

Person putPerson( PersonRequest request ) throws IllegalStateException, FileNotFoundException {
...
}

Regular Java Exceptions are translated to an HTTP error code. The conversions from exception to status code is as follows:

* IllegalStateException <E2><80><93> 400 BAD REQUEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h1>Index</h1>
<script id=template language=text/html>
{{#applications}}
<ul>
<li><a href={{link}}>{{name}}</a> {{#description}}{{.}} {{/description}}
<li><a href={{link}}/index.html>{{name}}</a> {{#description}}{{.}} {{/description}}
</ul>
{{/applications}}
</script>
Expand Down
15 changes: 8 additions & 7 deletions osgi.enroute.web.simple.test/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ Conditional-Package: \
osgi.identity;filter:='(osgi.identity=osgi.enroute.webconsole.xray.provider)'

-runbundles: \
biz.aQute.bndlib;version='[3.0.0,3.0.1)',\
com.springsource.org.json;version='[1.0.0,1.0.1)',\
net.sourceforge.htmlunit;version='[2.15.0,2.15.1)',\
org.apache.commons.fileupload;version='[1.3.1,1.3.2)',\
org.apache.commons.io;version='[2.4.0,2.4.1)',\
org.apache.felix.configadmin;version='[1.8.6,1.8.7)',\
org.apache.felix.http.api;version='[3.0.0,3.0.1)',\
org.apache.felix.http.jetty;version='[3.2.0,3.2.1)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.log;version='[1.0.1,1.0.2)',\
org.apache.felix.scr;version='[2.0.0,2.0.1)',\
org.apache.felix.webconsole;version='[4.2.8,4.2.9)',\
org.eclipse.equinox.coordinator;version='[1.3.100,1.3.101)',\
org.eclipse.equinox.event;version='[1.3.100,1.3.101)',\
org.eclipse.equinox.metatype;version='[1.4.100,1.4.101)',\
Expand All @@ -51,12 +46,18 @@ Conditional-Package: \
osgi.enroute.google.angular.webresource;version=snapshot,\
osgi.enroute.hamcrest.wrapper;version=snapshot,\
osgi.enroute.junit.wrapper;version=snapshot,\
osgi.enroute.logger.simple.provider;version=snapshot,\
osgi.enroute.stackexchange.pagedown.webresource;version=snapshot,\
osgi.enroute.twitter.bootstrap.webresource;version=snapshot,\
osgi.enroute.web.simple.provider;version=snapshot,\
osgi.enroute.web.simple.test;version=snapshot,\
osgi.enroute.webconsole.xray.provider;version=snapshot
osgi.enroute.webconsole.xray.provider;version=snapshot,\
biz.aQute.bndlib;version='[3.3.0,3.3.1)',\
org.apache.commons.io;version='[2.5.0,2.5.1)',\
org.apache.felix.http.jetty;version='[3.1.0,3.1.1)',\
org.apache.felix.scr;version='[2.0.6,2.0.7)',\
org.apache.felix.webconsole;version='[4.2.16,4.2.17)',\
osgi.enroute.web.simple.provider;version='[1.3.3,1.3.4)',\
slf4j.api;version='[1.7.0,1.7.1)'

Require-Capability: \
osgi.enroute.webresource; \
Expand Down

0 comments on commit 3674cb3

Please sign in to comment.