java - Rest Webservice in Controller or Service Layer? -
while developing rest based web service in jee 6 web application, containing jsf 2.0, cdi , ejb 3, make sense combine controller class (normally annotated @requestscoped
) rest service definition @path
?
or, should inside it's own *restservice class definition?
the project working follows below architecture requirement have rest services cater jsf clients, direct accesses other technologies.
jsf --> controller method (calls using rest client)--> rest service --> stateless business service --> dao (also stateless)
if combine controller , rest service (annotating methods @path), jsf client directly call controller method, , other client directly invoke rest service via url or rest client.
this permit take out rest client code invoking rest service controller.
thanks time in looking this.