Hi Dan/Maurizio Any help with the error I shared?
Thanks Bhargav Golla Developer. Freelancer. B.E (Hons.) Computer Science BITS-Pilani Github <http://www.github.com/bhargavgolla> | LinkedIN<http://www.linkedin.com/in/bhargavgolla> | Website <http://www.bhargavgolla.com/> On Wed, Jul 24, 2013 at 10:31 PM, Bhargav Golla <[email protected]>wrote: > > > On Wed, Jul 24, 2013 at 1:14 PM, Dan Haywood <[email protected] > > wrote: > >> Hi Bhargav, >> sorry not to get back to you sooner. >> >> couple of things: >> 1. the PUT resource on the object (RO spec 14.2) is for updating ALL >> properties, not just a single one. >> 2. the "complete" property is ALWAYS disabled (you can see that from the >> code [1], and from the arguments map in the representation[2] >> 3. notwithstanding, I think there's a bug in the RO viewer. I tried >> several different formats for the body [3], [4], [5], but got the same >> error in each case [6] >> >> So, if you want to raise a ticket for this, then either go ahead and fix >> it, or wait for me to do so... >> > Created an issue [1]. Will try to fix it. > >> >> In the meantime, you could workaround by doing a PUT to each of the >> individual property resources (per 16.2 of the spec); I believe this is >> working fine. >> > I am getting a 500 now that says that "does not represent map" when a make > a request like [2]. Any help? > > Regards > Bhargav > > [1] https://issues.apache.org/jira/browse/ISIS-479 > [2] PUT /myapp-webapp/restful/objects/TODO/L_0/properties/notes HTTP/1.1 > Host: localhost:8080 > Accept: application/json > Authorization: Basic c3ZlbjpwYXNz > Cache-Control: no-cache > > { "value": "10/22/2013" } > > Result: > { > "message": "does not represent map", > "stackTrace": [ > > "org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.mapHas(JsonRepresentation.java:1126)", > > "org.apache.isis.viewer.restfulobjects.rendering.domainobjects.JsonValueEncoder.asAdapter(JsonValueEncoder.java:359)", > > "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.objectAdapterFor(DomainResourceHelper.java:313)", > > "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.parseAsMapWithSingleValue(DomainResourceHelper.java:463)", > > "org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.parseAsMapWithSingleValue(DomainResourceHelper.java:454)", > > "org.apache.isis.viewer.restfulobjects.server.resources.DomainObjectResourceServerside.modifyProperty(DomainObjectResourceServerside.java:197)", > "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", > > "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)", > > "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", > "java.lang.reflect.Method.invoke(Method.java:601)", > > "org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)", > > "org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)", > > "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)", > > "org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)", > > "org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)", > > "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)", > > "org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)", > > "org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)", > > "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)", > > "org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)", > "javax.servlet.http.HttpServlet.service(HttpServlet.java:820)", > > "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)", > > "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)", > > "org.apache.isis.core.webapp.IsisSessionFilter$SessionState$1.handle(IsisSessionFilter.java:315)", > > "org.apache.isis.core.webapp.IsisSessionFilter.doFilter(IsisSessionFilter.java:404)", > > "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)", > > "org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)", > > "org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)", > > "org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)", > > "org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)", > > "org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)", > > "org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)", > > "org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)", > > "org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)", > > "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)", > > "org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)", > > "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)", > > "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)", > > "org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)", > > "org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)", > > "org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)", > > "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)", > "org.mortbay.jetty.Server.handle(Server.java:326)", > > "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)", > > "org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)", > "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)", > "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)", > "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)", > > "org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)", > > "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" > ], > "causedBy": null > } > >> >> Thx >> Dan >> >> >> >> [1] >> https://github.com/apache/isis/blob/f38fdb92941172eabb12e0943509f239e6d5925f/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java#L219 >> [2] >> >> http://localhost:8080/restful/objects/TODO/L_11 >> , { >> >> - members: >> { >> - ownedBy: >> { >> - memberType: "property", >> - value: "sven", >> - format: "decimal", >> - x-isis-format: "bigdecimal" >> }, >> - dueBy: >> { >> - memberType: "property", >> - value: "2013-07-24", >> - format: "date", >> - x-isis-format: "jodalocaldate" >> }, >> - cost: >> { >> - memberType: "property", >> - value: 1.75, >> - format: "decimal", >> - x-isis-format: "bigdecimal" >> }, >> - notes: >> { >> - memberType: "property", >> - value: null, >> - format: "decimal", >> - x-isis-format: "bigdecimal" >> }, >> - attachment: >> { >> - memberType: "property", >> - value: null, >> - format: "decimal", >> - x-isis-format: "bigdecimal" >> }, >> - description: >> { >> - memberType: "property", >> - value: "Buy bread", >> - format: "decimal", >> - x-isis-format: "bigdecimal" >> }, >> - category: >> { >> - memberType: "property", >> - value: "Domestic", >> - format: "decimal", >> - x-isis-format: "bigdecimal" >> }, >> - complete: >> { >> - memberType: "property", >> - value: false, >> - x-isis-format: "boolean", >> - disabledReason: "Always disabled" >> }, >> - versionSequence: >> { >> - memberType: "property", >> - value: 1, >> - format: "int", >> - x-isis-format: "long", >> - disabledReason: "Always disabled" >> } >> } >> >> >> >> [3] this - which is valid according to the spec, I think - didn't work: >> { >> "cost" : { >> "value" : 2.75 >> }, >> "description" : { >> "value" : "An updated description" >> }, >> "category" : { >> "value" : "Professional" >> } >> } >> >> [4] nor did this: >> { >> "members:" { >> "cost" : { >> "memberType": "property", >> "value" : 2.75 >> }, >> "description" : { >> "memberType": "property", >> "value" : "An updated description" >> }, >> "category" : { >> "memberType": "property", >> "value" : "Professional" >> } >> } >> } >> >> >> [5] nor did this: >> { >> "cost" : { >> "memberType": "property", >> "value" : 2.75 >> }, >> "description" : { >> "memberType": "property", >> "value" : "An updated description" >> }, >> "category" : { >> "memberType": "property", >> "value" : "Professional" >> } >> } >> >> >> [6] >> >> 1. Status Code: 400 >> 2. Server: Jetty(6.1.26) >> 3. Content-Length: 0 >> 4. Warning: 199 RestfulObjects Could not find properties list (nomembers >> [memberType=property]); got {"cost":{"memberType":"property","value": >> 2.75},"description":{"memberType":"property","value":"An updated >> description"},"category":{"memberType":"property","value": >> "Professional"}} >> 5. Content-Type: application/json >> >> >> >> >> On 23 July 2013 18:05, Bhargav Golla <[email protected]> wrote: >> >>> Hi Dan >>> >>> I am trying to edit the properties of an object and am following 14.2 in >>> ROSpec to do the same. I tried to make a PUT request to the URL by chagning >>> few properties and putting them into JSON. My request is as follows: >>> PUT /myapp-webapp/restful/objects/TODO/L_0 HTTP/1.1 >>> Host: localhost:8080 >>> Accept: application/json >>> Authorization: Basic c3ZlbjpwYXNz >>> Cache-Control: no-cache >>> >>> { "complete": { "value": "true" } } >>> >>> But it is giving me a 400 error. Do you have any help here? >>> >>> Regards >>> >>> Bhargav Golla >>> Developer. Freelancer. >>> B.E (Hons.) Computer Science >>> BITS-Pilani >>> Github <http://www.github.com/bhargavgolla> | >>> LinkedIN<http://www.linkedin.com/in/bhargavgolla> >>> | Website <http://www.bhargavgolla.com/> >>> >> >> >
