Community Page
- www.brodwall.com/johannes/blog/ Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- The evolution of SOA Introduce the concepts of services and SOA Design principles of SOA ... The benefits of employing SOA Review of common business goals ... Related articles. Web Application...
- Great article and I agree with you that ............ Thanks for the tips!
- Great read, good work old chap :)
- Hi...Your post really got me thinking man..... an intelligent piece ,I must say.
- Was a good read. thank great post, I think this article is useful. I'll be back for more. Thanks for sharing the information . .. :)
Jump to original thread »
A Brief Adventure with Universal Repositories and REST Web Services
Started by jhannes · 10 months ago
Inspired by Per Mellqvist (and myself, to be fair), I wanted to explore the possibility of using a generic DAO or Repository interface for REST. Based on this simple idea, I was able to create a very cute and testable prototype of a full Web Service stack for REST based Web Services. The m
... Continue reading »
2 years ago
Sjekk ut WP-Syntax pluggen til WordPress. Vil gi deg en vakker output på kodeeksemplene dine.
1 year ago
When trying to run it, I had to add 10 external jars. Makes me wonder
if they're all really needed. Second, in the "trade" package there are
unresolved references to the ...rest.UrlMemoryRepository class.
Still, really cool stuff.
1 year ago
Yeah, as it turns out, Spring is a dependency hog, and the other dependencies stack up.
If you're not doing it already, you really should use Maven to build this (and other) project. It really helps with dependency mess.
Sorry about the UrlMemoryRepository. I am reworking the code, and it is in a bit of an intermediate state right now. If this is a blocker for you, I can prioritize fixing it. Let me know.
1 year ago
Another thing is that the repository interface looks a lot like the Map interface. Make me wonder about the differences, such as method names (should "retrieve" be called "get"?), the type parameters (wouldn't it be nicer with a key type parameter?), would it be possible to go so far as to have Repository implement Map?
Also I didn't quite like the "hack" with URLs being used interchangeably with Keys, or the "Long.valueOf(parts[1])" in RESTRepositoryServlet.getKey where Keys are suddenly assumed/restricted to be Longs.
Not "complaining", just trying to provide some humble feedback, hoping it might be of some interest.
1 year ago
I have indeed considered using the Map interface. My main issue is how to treat keys during inserts. The Map interface is not designed for key generation purposes. I've toyed with a few options, but found none that I like.
Using URLs as keys is actually one of the neat things about REST. This will become more obvious if I get around to publishing work on more complex models.
Regarding "get" versus "retrieve". I choose "retrieve" because of the CRUD patterns (but I cowardly left "insert" as "create" to avoid the overloaded meaning of "insert"). Also, I wanted to remove the association with getters. But "get" might be a better name after all.
1 year ago
When POSTing or PUTting, however, the situation is more complex. I don't think it matters if you are creating or updating, what to do with direct attributes are clear, but not with referenced objects. A referenced object might exist only on the client side, or it might be in the repository, but with different attributes. Do you have a clear vision of how to handle this?
1 year ago
I'm thinking about GET as analogous to lazy loading proxies with Hibernate (or other persistence framework). This means that a GET request could either return a link, or the embedded object. Using the same analogy, PUT and POST requests can be similar to cascading saves, I think. This means that the onus is on the client to ensure that the correct state is transferred.
Does that make sense?