本文整理了Java中org.glassfish.jersey.server.JSONP
类的一些代码示例,展示了JSONP
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONP
类的具体详情如下:
包路径:org.glassfish.jersey.server.JSONP
类名称:JSONP
暂无
代码示例来源:origin: jersey/jersey
@GET
@JSONP(queryParam = JSONP.DEFAULT_QUERY)
public List<ChangeRecordBean> getChanges(@QueryParam(JSONP.DEFAULT_QUERY) String callback, @QueryParam("type") int type) {
return changes;
}
代码示例来源:origin: jersey/jersey
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: jersey/jersey
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: jersey/jersey
@GET
@Path("latest")
@JSONP
public ChangeRecordBean getLastChange(@QueryParam("callback") String callback, @QueryParam("type") int type) {
return changes.get(changes.size() - 1);
}
}
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: jersey/jersey
@GET
@JSONP
@Produces({"application/javascript", MediaType.APPLICATION_JSON})
public NonJaxbBean getSimpleBeanJSONP() {
return new NonJaxbBean();
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: jersey/jersey
@GET
@JSONP
@Produces({"application/javascript", MediaType.APPLICATION_JSON})
public NonJaxbBean getSimpleBeanJSONP() {
return new NonJaxbBean();
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: ef-labs/vertx-jersey
@GET
@Path("jsonp")
@JSONP(queryParam = "cb")
@Produces("application/javascript")
public MyObject getJsonPadding() {
MyObject o = new MyObject();
o.setName("Andy");
return o;
}
代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: ef-labs/vertx-jersey
@GET
@JSONP(queryParam = "cb")
@Path("json")
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public String getJson() {
return "{}";
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Returns a JavaScript callback name to wrap the JSON entity into. The callback name is determined from the {@link JSONP}
* annotation.
*
* @param jsonp {@link JSONP} annotation to determine the callback name from.
* @return a JavaScript callback name.
*/
private String getCallbackName(final JSONP jsonp) {
String callback = jsonp.callback();
if (!"".equals(jsonp.queryParam())) {
final ContainerRequest containerRequest = containerRequestProvider.get();
final UriInfo uriInfo = containerRequest.getUriInfo();
final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
final List<String> queryParameter = queryParameters.get(jsonp.queryParam());
callback = (queryParameter != null && !queryParameter.isEmpty()) ? queryParameter.get(0) : callback;
}
return callback;
}
代码示例来源:origin: smoketurner/notification
@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();
}
代码示例来源:origin: GeneralElectric/snowizard
/**
* 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));
}
代码示例来源:origin: smoketurner/notification
@GET
@JSONP
@Timed
@Path("/{username}")
内容来源于网络,如有侵权,请联系作者删除!