-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sitemap Events: registration response buggy #1216
Comments
Basic UI, not Classic UI. |
To sync the changes the clients could be changed first accept the old reply and the new reply. For example:
If all clients has been updated the Sitemap Events endpoint can be fixed. |
What's the plan here? I see two options:
|
See: openhab#1216 Signed-off-by: Markus Rathgeb <[email protected]>
See: openhab#1216 Signed-off-by: Markus Rathgeb <[email protected]>
@openhab/webui-maintainers @openhab/android-maintainers @openhab/ios-maintainers Can you please comment here? I would prefer to correct the response of |
I agree. The more critical part of this IMO are the mobile apps, since they are shipped independently from openHAB Distro. They need to be compatible to both „ways“. |
For the Android app, it should be easy to implement both (-> openhab/openhab-android#3335); the most interesting part is getting it tested before the code is merged. |
For BasicUI, it should be possible to implement both. |
For MainUI, no change is needed since MainUI is not using the Sitemap events ( |
Merge the code on the server first and when it's in a snapshot release, test the Android app. The app can be released faster than the server. |
First à PR must be submitted in core. |
@openhab/ios-maintainers Can you comment here? |
I updated my previous message, there is no need to support old and new response in Basic UI. |
If a new resource is created the response should use status code 201 and the HTTP response headers should contain the location of the created resource.
See e.g. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201
The current implementation in the
SitemapResource
looks likeopenhab-core/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/SitemapResource.java
Lines 288 to 311 in d23fb59
Response.created(uri);
is already and it will create a status code 201 and the URI as location header...BUT
Response.created(uri);
does not create aResponse
it creates aResponseBuilder
.The call to
build()
is missing.Other methods in this class already uses the correct construct
return Response.ok(responseObject).build();
As you return a
ResponseBuilder
object instead ofResponse
the resulting response looks very different.ResponseBuilder
object is (as every object that is not aResponse
) deserialized by the Gson as a JSON string.ResponseBuilder
is an interface so the JSON string looks like the current response builder implementation that is used (and could change if another implementation or an updated implementation will be used).The solution would be to add the missing
build()
method call.It seems the clients just eat what they get and needs to be fixed, too.
For example that way (I fixed the
Classic UIBasic UI already):https://github.com/openhab/openhab-webui/compare/master...maggu2810:jax-rs-whiteboard?expand=1
Current reply:
Should be:
The text was updated successfully, but these errors were encountered: