@Override public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/** * Method that will add JSONP wrapper object, if and as * configured by collected annotations. */ public Object applyJSONP(Object value) { if (_jsonp != null) { // full prefix+suffix? if (_jsonp.prefix != null || _jsonp.suffix != null) { return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value); } if (_jsonp.method != null) { return new JSONPObject(_jsonp.method, value); } } return value; } }
@Override public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/** * Method that will add JSONP wrapper object, if and as * configured by collected annotations. */ public Object applyJSONP(Object value) { if (_jsonp != null) { // full prefix+suffix? if (_jsonp.prefix != null || _jsonp.suffix != null) { return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value); } if (_jsonp.method != null) { return new JSONPObject(_jsonp.method, value); } } return value; } }
@Override public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/** * Method that will add JSONP wrapper object, if and as * configured by collected annotations. */ public Object applyJSONP(Object value) { if (_jsonp != null) { // full prefix+suffix? if (_jsonp.prefix != null || _jsonp.suffix != null) { return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value); } if (_jsonp.method != null) { return new JSONPObject(_jsonp.method, value); } } return value; } }
@Override public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/** * Method that will add JSONP wrapper object, if and as * configured by collected annotations. */ public Object applyJSONP(Object value) { if (_jsonp != null) { // full prefix+suffix? if (_jsonp.prefix != null || _jsonp.suffix != null) { return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value); } if (_jsonp.method != null) { return new JSONPObject(_jsonp.method, value); } } return value; } }
@Override public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/** * Method that will add JSONP wrapper object, if and as * configured by collected annotations. */ public Object applyJSONP(Object value) { if (_jsonp != null) { // full prefix+suffix? if (_jsonp.prefix != null || _jsonp.suffix != null) { return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value); } if (_jsonp.method != null) { return new JSONPObject(_jsonp.method, value); } } return value; } }
public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/** * Method that will add JSONP wrapper object, if and as * configured by collected annotations. */ public Object applyJSONP(Object value) { if (_jsonp != null) { // full prefix+suffix? if (_jsonp.prefix != null || _jsonp.suffix != null) { return new JSONWrappedObject(_jsonp.prefix, _jsonp.suffix, value); } if (_jsonp.method != null) { return new JSONPObject(_jsonp.method, value); } } return value; } }
public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { // No type for JSONP wrapping: value serializer will handle typing for value: serialize(jgen, provider); }
/*** * Build a Response, optionally wrapped in a JSONP callback. * <p>The response will be wrapped in a JSONP callback if any of the following apply: * <ul> * <li> The requested media type is <em>application/javascript</em> * <li> The callback is not null or empty * </ul> * @param request The request * @param response The response to wrap * @param callback The callback * @return A Response object, wrapped if necessary. */ public static Object wrapJsonp(Request request, GenericEntity<?> response, @Nullable String callback) { if (JaxRsUtil.isVariant(request, CustomMediaTypes.APPLICATION_JSONP_TYPE) || !isNullOrEmpty(callback)) { callback = Optional.ofNullable(callback).orElse(DEFAULT_JSONP_CALLBACK); return new JSONWrappedObject(format("%s(", callback), ");", response.getEntity()); } else { return Response.ok(response).build(); } }
public void send(String apiKey, String queue, final Object message) { checkNotNull(queue, "queue"); try { URI uri = _queueService.clone() .segment(queue, "send") .build(); _client.resource(uri) .type(MediaType.APPLICATION_JSON_TYPE) .header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey) // Wrap the message in a JSONWrappedObject that forces Jersey to use Jackson to serialize it // no matter what the type. Otherwise null and String objects don't get serialized correctly. .post(new JSONWrappedObject("", "", message)); } catch (EmoClientException e) { throw convertException(e); } }