Skip to content

Instantly share code, notes, and snippets.

@sunnygleason
Forked from jfarcand/gist:570685
Created September 8, 2010 19:42
Show Gist options
  • Save sunnygleason/570703 to your computer and use it in GitHub Desktop.
Save sunnygleason/570703 to your computer and use it in GitHub Desktop.
/**
* Inject a {@link Broadcaster} based on @Path
*/
private @PathParam("tablename") Broadcaster tablename;
@GET
@Path("{tablename}")
@Suspend(resumeOnBroadcast=true, period=30, listeners={EventsLogger.class})
public String getData(@PathParam("tablename") String tableName,
@Context UriInfo uri) throws Exception {
return mapper.writeValueAsString(manager.loadData(tableName,
convertUriToMap(uri.getPath())));
}
@PUT
@Path("{tablename}")
@Broadcast
public Broadcastale insertData(@PathParam("tablename") String tableName,
@Context UriInfo uri) throws Exception {
manager.insertData(tableName, convertUriToMap(uri.getPath()));
return new Broadcastable(/*thechange*/,tablename);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment