| Author |
Message |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 19/02/2009 18:41:01
|
jimeng
Request-scope Wrangler
Joined: 11/07/2006 17:41:40
Messages: 84
Offline
|
Is there an example of a DataView that uses a JSONProvider? Is there another class that I need to implement to define the way in which an object gets serialized or deserialized?
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 19/02/2009 19:11:24
|
jimeng
Request-scope Wrangler
Joined: 11/07/2006 17:41:40
Messages: 84
Offline
|
Maybe my question is actually about SAXalizerMappingContext. Is there an example that demonstrates creation and/or configuration of a SAXalizerMappingContext?
And on a sidenote: The class I need to serialize already has methods for converting to JSON and from JSON. In that case, do I bypass the JSON Provider? Or maybe implement SerializationProvider with calls to my class's toJSON and fromJSON methods?
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 03/03/2009 07:02:20
|
antranig2
Request-scope Wrangler
Joined: 05/06/2006 02:51:30
Messages: 24
Offline
|
Yes, a DataView can just return a String... which you could construct by injecting and invoking the JSONProvider, or otherwise.
An example of a DataView, which for certain reasons needs to take complete charge of its serialisation can be seen at https://source.sakaiproject.org/contrib/whitman/timeline/trunk/tool/src/java/org/sakaiproject/timeline/tool/producers/TimelineEventJSONProducer.java
A straightforward way of adjusting serialization, whilst continuing to use the framework's facilities, is to return a "flattened" data representation consisting of Maps of Lists etc.
Yours,
A.
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 09/03/2009 23:26:48
|
jimeng
Request-scope Wrangler
Joined: 11/07/2006 17:41:40
Messages: 84
Offline
|
I've looked at a couple examples of DataView impl's that report content type of JSON, including the one Antranig mentioned above. They also return VIEW_ID for getViewID(). In this case, VIEW_ID is "EventsJSON.js". I see no file named "EventsJSON.js" in this project. There's another example in the wiki at this URL:
http://rsf.fluidproject.org/wiki/Wiki.jsp?page=DataViews
In that one, the VIEW_ID is "catalog". Again I see no templates or javascript files with names beginning in "catalog". I'm trying to return a JSON object. My DataView uses "UBookOfferResult" as the VIEW_ID returned by getViewID(). When I run, I get a stack trace that seems to indicate that RSF is looking for an HTML template:
WARN: Error invoking action (2009-03-09 16:38:18,952 http-8080-Processor21_PonderUtilCore)
Target exception of class uk.org.ponder.rsf.flow.errors.SilentRedirectException
Successive lines until stack trace show causes progressing to exception site:
No ViewComponentProducer is registered for view UBookOfferResult
uk.org.ponder.rsf.flow.errors.SilentRedirectException
at uk.org.ponder.rsf.view.support.ConcreteViewResolver.getUnmappedProducers(ConcreteViewResolver.java:114)
at uk.org.ponder.rsf.view.support.ConcreteViewResolver.getProducers(ConcreteViewResolver.java:129)
at uk.org.ponder.rsf.flow.support.ARI2Processor.accreteViewARIs(ARI2Processor.java:4
at uk.org.ponder.rsf.flow.support.ARI2Processor.interceptActionResult(ARI2Processor.java:40)
followed by:
WARN: Exception rendering view: (2009-03-09 16:38:18,979 http-8080-Processor21_PonderUtilCore)
Target exception of class java.lang.IllegalArgumentException
Successive lines until stack trace show causes progressing to exception site:
Error setting dependency viewRender of bean RSFRenderHandler
--> Error setting dependency viewTemplate of bean viewRender
--> No template found for view UBookOfferResult: tried paths (expected) /templates/sakai-UBookOfferResult.html, /templates/UBookOfferResult.html, classpath:uk/org/ponder/rsf/builtin/templates/sakai-UBookOfferResult.html, classpath:uk/org/ponder/rsf/builtin/templates/UBookOfferResult.html, /component-templates/Messages.html, /component-templates/UBookOfferDetails.html, /component-templates/PriceHelper.html, /content/templates/old-date.html, /content/templates/yahoo-date.html, /content/templates/plainTextEditor.html, /content/templates/plainSelect.html, /content/templates/double-list-select.html, /content/templates/dynamic-list-input.html, /content/templates/TableWidgets.html, /content/templates/sakai-old-date.html, /content/templates/sakai-FCKEditor.html, /content/templates/sakai-plainTextEditor.html, /content/templates/sakai-rsf-portal.html, from all TemplateResolverStrategy which were marked as a root resolver (rootPriority > 0)
java.lang.IllegalArgumentException
at uk.org.ponder.rsf.templateresolver.support.BasicTemplateResolver.locateTemplate(BasicTemplateResolver.java:157)
at uk.org.ponder.rsf.templateresolver.support.TemplateLoaderBean.getObject(TemplateLoaderBean.java:32)
at uk.org.ponder.rsac.support.RSACBeanLocatorImpl.createBean(RSACBeanLocatorImpl.java:576)
at uk.org.ponder.rsac.support.RSACBeanLocatorImpl.getLocalBean(RSACBeanLocatorImpl.java:34
It seems pretty clear that I am doing something wrong. I've tried to follow the example discussed in the wiki, but I'm missing some key point.
Thanks. Jim
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 09/03/2009 23:30:14
|
jimeng
Request-scope Wrangler
Joined: 11/07/2006 17:41:40
Messages: 84
Offline
|
BTW, the actual object returned by getData(ViewParameters) in my class is a Map<String,String>.
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 10/03/2009 04:44:14
|
antranig2
Request-scope Wrangler
Joined: 05/06/2006 02:51:30
Messages: 24
Offline
|
DataViews do not require templates to be present. Have you made sure to register your DataView in a context file?
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 12/03/2009 04:22:35
|
jimeng
Request-scope Wrangler
Joined: 11/07/2006 17:41:40
Messages: 84
Offline
|
Suppose I have a class that implements DataView and DataInputHandler, similar to the Catalog example of the JSONCatalogView example. When the client posts to this view, what should happen? I was thinking that the handleInput() method would be called and then the getData() method would be called.
When this class implemented just DataView, the getData() method was called. But since I added DataInputHandler, the handleInput() method gets called and getData() does not. That results in a null return to the client-side javascript callback function.
Is there something special I need to do?
Thanks.
Jim
|
|
|
 |
![[Post New]](/rsf/templates/default/images/icon_minipost_new.gif) 28/04/2009 23:32:27
|
antranig
Request-scope Wrangler
Joined: 03/04/2006 13:29:55
Messages: 643
Offline
|
I think we resolved this privately by deciding that the proper semantics were to follow a POST explicitly with a GET? If this is still a problem, please could you post back?
Cheers,
Boz.
|
|
|
 |
|
|