[aerogear-dev] proper way to use AeroGear.Pipeline with parameter fed REST endpoint
rnaszcyn
rnaszcyn at redhat.com
Mon Oct 7 13:51:50 EDT 2013
Hi all. I have started to use Aerogear for my mobile connectivity with pretty
good luck. One question I have is what is the best way to connect using
Aerogear to REST endpoints that accept a parameter. For example, I have the
following working snippet in a Javascript file I used for a mobile
application.
// TODO: change the pipeline name to use the school id passed to the page
var schoolMenuPipe = AeroGear.Pipeline([ {
name : "schoolmenu",
recordId : "1",
settings : {
baseURL : "/harpsterserver/rest/p1/",
endpoint : "schoolmenu/1" // The school ID is temporarily hard coded!!
}
} ]).pipes.schoolmenu;
In order to get the parameter into the Pipeline call (in this case a school
ID) I have to include the endpoint in the settings object so the default
pipeline name won't be used for the endpoint.
The REST endpoint is running on EAP and is hard coded with a return value
now for prototype purposes.
@GET
@Path("/school/{id}")
@Produces("application/json")
public School getSchool(@PathParam("id") Long id){
// TODO: add code that will search for a specific school
return new School(2, "Marist High School");
}
Everything is working fine right now but leaves me wondering if I have a
good solution pattern. I am new to Aerogear so perhaps I am missed some
documentation or code example.
--
View this message in context: http://aerogear-dev.1069024.n5.nabble.com/proper-way-to-use-AeroGear-Pipeline-with-parameter-fed-REST-endpoint-tp4956.html
Sent from the aerogear-dev mailing list archive at Nabble.com.
More information about the aerogear-dev
mailing list