[aerogear-dev] Sender REST endpoint returns text/plain

Lukáš Fryč lukas.fryc at gmail.com
Thu Apr 30 02:01:01 EDT 2015


We have discussed this a bit this morning at IRC,

and agreed to use 202 Accepted status code and empty JSON body {} (here we
may later expose ID of the operation).

Additionally Java Sender lib should be changed to send Accept header
"application-json; text-plain", so that it keeps working with future and
past versions.

st 29. 4. 2015 v 18:14 odesílatel Idel Pivnitskiy <idel.pivnitskiy at gmail.com>
napsal:

> Hello,
>
> It is a good remark! I noticed it when worked on REST api doc generation
> [1].
> In my REST services I always use JSON or empty body and it looks like a
> pure api. text/plain is not compatible with it. Think, that it will be
> better to fix it in later releases.
>
> [1] https://github.com/aerogear/aerogear-unifiedpush-server/pull/526
>
> Best regards,
> Idel Pivnitskiy
> --
> E-mail: Idel.Pivnitskiy at gmail.com
> Twitter: @idelpivnitskiy <https://twitter.com/idelpivnitskiy>
> GitHub: @idelpivnitskiy <https://github.com/idelpivnitskiy>
> 2015-04-29 18:50 GMT+03:00 Lukáš Fryč <lukas.fryc at gmail.com>:
>
>> Hey guys,
>>
>> one issues Tadeas identified during testing sender endpoint via Java
>> Sender lib is connected to this quiet change in the REST response from REST
>> Sender endpoint (we added text/plain response specification):
>>
>>
>> https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/sender/PushNotificationSenderEndpoint.java#L107
>>
>>
>> As we were always responding with "Job submitted", admin-ui client
>> started to complain about the response not being JSON. So obvious fix was
>> change that to text/plain, right?
>>
>> Not really.. some clients like Java Sender lib already expects
>> application/json and JAX-RS then refuses these requests:
>>
>>
>> https://github.com/aerogear/aerogear-unifiedpush-java-client/blob/master/src/main/java/org/jboss/aerogear/unifiedpush/http/HttpClient.java#L82
>>
>>
>>
>> The question is, what should be the correct response?
>>
>> There are many options, I would be perfectly fine with 204 No Content
>> reply,
>>
>> but JSON might be more appropriate for future extensions, we may want to
>> return e.g. PushMessageInformation#id or something else as part of the
>> response.
>>
>> So, wouldn't be application/json more appropriate than text/plain? We may
>> send empty body now {}.
>>
>>
>> Is this something we want to address for Alpha? Or should we release
>> fixed Java Sender lib?
>>
>>
>> Cheers,
>>
>> ~ Lukas
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20150430/4dde7a26/attachment-0001.html 


More information about the aerogear-dev mailing list