Skip to content

Instantly share code, notes, and snippets.

@jfarcand
Created September 8, 2010 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jfarcand/570685 to your computer and use it in GitHub Desktop.
Save jfarcand/570685 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