java - Implementing a RESTful service -
i'm building web service support android e-reader app i'm making our campus magazine. service needs return issue objects app, each of has cover image , collection of articles displayed. i'd general input on 2 strategies i'm considering, and/or specific on few issues i'm having them:
strategy 1: have 2 db tables,
issues,articles:issuestable containsint id,varchar name,varchar imageuri.articlescontains many more columns (headline, content, blurb, etc.), each article on separate row. 1 of columnsissueid, points issue article belongs. when issue number n requested, service first pulls dataissuestable , uses create new issue object. constructor instantiates newlist<article>instance variable , populates pulling articles matching issueidarticlestable. can't figure out option how execute @ single endpoint, app has create 1 http connection needs issue (or not important think is?).have single
issuestableid,name, ,imageuricolumns, plus large number of additionaltext article1... text article40columns. articles packaged jsonobjects before being uploaded server, , these jsonobjects (which long) stored directly in database. worry here text files long, plus have nagging suspicion strategy isn't in line best practices (although can't put finger on why...)
also, being first web service, , given requirements specified above, advisable use spring (or other) framework or better off using jax-rs?
there 2 questions here
- how convert objects json , expose them rest service.
- how store/retrieve data.
to implement webservices, jersey favorite option. open-source reference implementation of jsr 311 (jax-rs). in addition, jersey uses jackson automatically handle json/object mapping.
to store data, second option... not option :) first solution seems viable. imho, application seems tiny, should not put in place jpa/hibernate etc.you should make 1 request hand join between issues , article, populate requested issue let jackson automatically convert object json.
Comments
Post a Comment