Possible issues with PUT in Restlet
I'm having some issues with updating settings via PUT and seems consistent no matter what I do. Everything else works fine.
I've taken a copy of WebUI in PHP and have been patching it to work with 0.6 and I have yet to get it to accept a PUT. I turned on logging and here's what I get:
What this appears to be telling me is that it's trying to parse my XML using GSON (JSON) which is obviously incorrect. So I went back to make sure there wasn't anything different with this submission than with all the other commands sent to the restlet. I couldn't find anything else different. In fact, the metadata section didn't appear to change between 0.5.2 and 0.6, so this should have worked without any code change to the original WebUI in PHP. Based on the REST interface specs, it should default to an XML content type, and all the other REST commands are successful, so I'm at a loss.
If there are other ways that I could test this to make sure I have nothing wrong on my side. Here's what I'm sending:
Any help would be appreciated.
Cheers!
Mark
I've taken a copy of WebUI in PHP and have been patching it to work with 0.6 and I have yet to get it to accept a PUT. I turned on logging and here's what I get:
- Code:
2011-09-23 09:02:59,309 WARN [RestletApplication] Unable to parse the object with Gson.
com.google.gson.JsonParseException: Expecting object found: "<?xml"
at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:100)
at com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120)
at com.google.gson.JsonDeserializationContextDefault.fromJsonPrimitive(JsonDeserializationContextDefault.java:85)
at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:56)
at com.google.gson.Gson.fromJson(Gson.java:551)
at com.google.gson.Gson.fromJson(Gson.java:498)
at com.google.gson.Gson.fromJson(Gson.java:467)
at com.google.gson.Gson.fromJson(Gson.java:417)
at com.google.gson.Gson.fromJson(Gson.java:389)
at org.restlet.ext.gson.GsonRepresentation.getObject(GsonRepresentation.java:48)
at org.restlet.ext.gson.GsonConverter.toObject(GsonConverter.java:87)
at org.restlet.service.ConverterService.toObject(ConverterService.java:158)
at org.restlet.resource.UniformResource.toObject(UniformResource.java:644)
at org.restlet.resource.ServerResource.doHandle(ServerResource.java:431)
at org.restlet.resource.ServerResource.put(ServerResource.java:1170)
at org.restlet.resource.ServerResource.doHandle(ServerResource.java:521)
at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:587)
at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:299)
at org.restlet.resource.ServerResource.handle(ServerResource.java:846)
at org.restlet.resource.Finder.handle(Finder.java:510)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Router.doHandle(Router.java:497)
at org.restlet.routing.Router.handle(Router.java:737)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:151)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.engine.ChainHelper.handle(ChainHelper.java:111)
at org.restlet.engine.application.ApplicationHelper.handle(ApplicationHelper.java:72)
at org.restlet.Application.handle(Application.java:388)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Router.doHandle(Router.java:497)
at org.restlet.routing.Router.handle(Router.java:737)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Router.doHandle(Router.java:497)
at org.restlet.routing.Router.handle(Router.java:737)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:151)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.routing.Filter.doHandle(Filter.java:156)
at org.restlet.routing.Filter.handle(Filter.java:203)
at org.restlet.engine.ChainHelper.handle(ChainHelper.java:111)
at org.restlet.Component.handle(Component.java:388)
at org.restlet.Server.handle(Server.java:488)
at org.restlet.engine.http.connector.BaseServerHelper.handle(BaseServerHelper.java:158)
at org.restlet.engine.http.connector.BaseServerHelper.handleInbound(BaseServerHelper.java:167)
at org.restlet.engine.http.connector.BaseHelper.handleNextInbound(BaseHelper.java:418)
at org.restlet.engine.http.connector.Connection.readMessages(Connection.java:695)
at org.restlet.engine.http.connector.Controller$2.run(Controller.java:95)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
2011-09-23 09:02:59,310 INFO [LogService] 2011-09-23 09:02:59 127.0.0.1 - - 23423 PUT /rest/metadata - 415 554 535 941 http://127.0.0.1:23423 - -
What this appears to be telling me is that it's trying to parse my XML using GSON (JSON) which is obviously incorrect. So I went back to make sure there wasn't anything different with this submission than with all the other commands sent to the restlet. I couldn't find anything else different. In fact, the metadata section didn't appear to change between 0.5.2 and 0.6, so this should have worked without any code change to the original WebUI in PHP. Based on the REST interface specs, it should default to an XML content type, and all the other REST commands are successful, so I'm at a loss.
If there are other ways that I could test this to make sure I have nothing wrong on my side. Here's what I'm sending:
- Code:
<?xml version="1.0" encoding="UTF-8" ?>
<metadata>
<audioLocalArtExtractorEnabled>true</audioLocalArtExtractorEnabled>
<videoLocalArtExtractorEnabled>true</videoLocalArtExtractorEnabled>
<videoOnlineArtExtractorEnabled>true</videoOnlineArtExtractorEnabled>
<videoGenerateLocalThumbnailEnabled>true</videoGenerateLocalThumbnailEnabled>
<metadataLanguage>en</metadataLanguage>
<retrieveOriginalTitle>false</retrieveOriginalTitle>
<descriptiveMetadataExtractor>ONLINE_VIDEO_SOURCES</descriptiveMetadataExtractor>
</metadata>
Any help would be appreciated.
Cheers!
Mark