parameters - Restlet annotation type -
i'm newbie.
i have 2 questions.
when utilize restlet, have utilize @post, @get.
example:
@post public string registeruserinfo(stringrepresentation rep){ string str = rep.gettext(); .... homecoming "success"; } but, saw many @post illustration in google. ( e.g. @post("text/plain") @post("xml") @post("........") )
i want know type possible? actually, spend many time finding guide , restlet user guide , example. however, can not find official document. if know, please allow me know.
another question utilize restlet. saw many tutorials, said "you should separate method.."
for example, create 2 methods "registeruserinfo" , "modifyuserinfo". seek implement 1 resource class "userresource" above 2 methos. however, many people said separate 2 resource class. 1 registeruserresource, 1 modifyuserresource.
then, @ end of project, maybe, project flooded many classes. right? don't know.... please allow me know.
actually i'm not familiar english. hope question delivered exactly.
i think can find user guide @ url: http://restlet.com/learn/guide/2.2/ think can find sample code: http://restlet.com/learn/guide/2.2/introduction/first-steps/
and here explanation annotations: http://restlet.com/learn/guide/2.2/core/resource/
regarding design of application , resources, first determine resources need (quickly reply next question: state want expose?)
in case, want expose users, see 2 resources:
list of users (@get homecoming list of users, @post add together new one) user (@get homecoming representation of user, @put update total state, @delete remove it)which more or less corresponds in term of implementation: - usersserverresource
@get public list<user> list(){ [...] } @post public user add(user user) { [...] } a userserverresource
@get public user represent(){ [...] }
@put public user update(user user) { [...] }
@delete public user update(user user) { [...] }
you can implement resources using pojo (such "user" in sample code above) in conjunction extensions back upwards serialization/deserialization such jackson (cf http://restlet.com/learn/guide/2.2/core/services/converter). encourage utilize such feature ease developement of resources.
if want precise command on representations exchanged between client , server, can utilize representation class, or stringrepresentation class.
feel free inquire more details.
parameters resources annotations restlet
No comments:
Post a Comment