org.glassfish.jersey.server.JSONP Java Examples

The following examples show how to use org.glassfish.jersey.server.JSONP. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RuleResource.java    From notification with Apache License 2.0 7 votes vote down vote up
@GET
@JSONP
@Timed
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Response fetch() {

  final Optional<Map<String, Rule>> rules;
  try {
    rules = store.fetch();
  } catch (NotificationStoreException e) {
    throw new NotificationException(
        Response.Status.INTERNAL_SERVER_ERROR, "Unable to fetch rules", e);
  }

  if (!rules.isPresent()) {
    throw new NotificationException(Response.Status.NOT_FOUND, "No rules found");
  }

  return Response.ok(rules.get()).build();
}
 
Example #2
Source File: MCRJWPlayerResource.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path("{derivateId}/{path: .+}/sources.js")
@Produces({ "application/javascript" })
@JSONP(callback = "callback", queryParam = "callback")
public String getSourcesAsJSONP(@PathParam("derivateId") String derivateId, @PathParam("path") String path)
    throws URISyntaxException, IOException {
    // TODO: FIX THIS: https://jersey.java.net/documentation/latest/user-guide.html#d0e8837
    return getSources(derivateId, path);
}
 
Example #3
Source File: IdResource.java    From snowizard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Get a new ID as JSON
 *
 * @param agent
 *            User Agent
 * @return generated ID
 */
@GET
@Timed
@JSONP(callback = "callback", queryParam = "callback")
@Produces({ MediaType.APPLICATION_JSON,
    MediaTypeAdditional.APPLICATION_JAVASCRIPT })
@CacheControl(mustRevalidate = true, noCache = true, noStore = true)
public Id getIdAsJSON(
        @HeaderParam(HttpHeaders.USER_AGENT) final String agent) {
    return new Id(getId(agent));
}