I'd say that this is a bug in the tree controller. Tapestry "should
not" be sending back any JSON data enclosed with "()".

This represents a browser "quirck" and should be handled in the
appropriate place - the browser. I'd bring it up with dojo, probably
by filing a bug in http://trac.dojotoolkit.org .

A mimetype of text/javascript means you are expecting javascript
content such as "function foo(){} " - json mimetype is for object
structures that need to be evaluated in line. Either the tree is
incorrectly using javascript mimetype when it should be using json or
you aren't returning what the tree is expecting.

On 12/17/06, Alexandru Dragomir <[EMAIL PROTECTED]> wrote:
Some good news.
In TreeLoadingControllerV3.js , runRpc  , the  mimetype is set as
"text/javascript".

In method doLoad from BrowserIO.js :
 - if mimetype is "text/javascript" the method dj_eval(http.responseText);
is called
 - if mimetype is "*/json" the method dj_eval("("+http.responseText+")"); is
called

So that's why the brackets are not added and must be set from the server..

A suggestion of how should i go on ?
Should i build a custom ReponseBuilder that treats the text/javascript
mimetype ? Would be beter to be in the framework.. ?

Alex





On 12/17/06, Alexandru Dragomir <[EMAIL PROTECTED]> wrote:
>
> I've been looking into TreeRpcControllerV3.js and TreeEditor.js for the
> place where the response is handled , but i haven't got any result beside a
> headache.. :)
>
> Any suggestion is welcome !
>
> Alex
>
>
> On 12/17/06, Alexandru Dragomir <[EMAIL PROTECTED]> wrote:
> >
> > I tried it but is still not working.
> >
> > But i found something else. I manage to hook the JSONWriterImpl and send
> > whatever plain text i want to the client.
> > When i send the string : ({title: 'a new title'}) is working.
> > When i send the string : {title: 'a new title'} is not  working.
> >
> > So the conclusion is that  the brackets  "()" must be sent.
> >
> > Is this the way the widget should work ?
> > Maybe i should put this question to dojo list ?
> >
> > thanks!
> > Alex
> >
> > On 12/16/06, Jesse Kuhnert < [EMAIL PROTECTED]> wrote:
> > >
> > > Maybe the tree widget is expecting a json array vs object being
> > > returned...Ie ["title","a new title"]. You can do that easily by doing
> > > this instead:
> > >
> > > JSONArray arr = writer.array();
> > > arr.put ("title");
> > > arr.put("a new title");
> > >
> > >
> > >
> > > On 12/16/06, Jesse Kuhnert <[EMAIL PROTECTED] > wrote:
> > > > Yes, that should be fine. It is a perfectly valid JSON response.
> > > There
> > > > aren't too many ways to vary it.
> > > >
> > > > On 12/16/06, Alexandru Dragomir <[EMAIL PROTECTED] > wrote:
> > > > > ok, then i might be doing something else wrong..
> > > > > Is the tree widget.
> > > > > And now i'm at editing a node label phase.
> > > > > I edit , press enter , and the response received is  {"title" : "a
> > > new
> > > > > title"} without other brackets.
> > > > >
> > > > > The render method is
> > > > > public void renderComponent(IJSONWriter writer, IRequestCycle
> > > cycle)
> > > > >     {
> > > > >
> > > > >         JSONObject json = writer.object();
> > > > >         json.put("title", "a new title");
> > > > >      }
> > > > >
> > > > > Alex
> > > > >
> > > > >
> > > > > On 12/16/06, Jesse Kuhnert < [EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Quoting/not quoting a response should have nothing to do with it
> > > being
> > > > > > valid JSON. Nor should a response contain the surrounding "("
> > > content
> > > > > > ")".
> > > > > >
> > > > > > I'd be interested in knowing which dojo widget this is but if
> > > it's
> > > > > > using dojo.io as the transport layer it should be adding in the
> > > "("
> > > > > > for you.
> > > > > >
> > > > > > On 12/16/06, Alexandru Dragomir <[EMAIL PROTECTED] >
> > > wrote:
> > > > > > > I'm working on a component that expects a json response (..
> > > frankly ,
> > > > > > i'm
> > > > > > > not sure anymore about this)
> > > > > > >
> > > > > > > Is a dojo widget that i'm trying to convert into tapestry.
> > > > > > >
> > > > > > > A valid response would be :
> > > > > > >
> > > > > > > ({title: "a new title"})
> > > > > > >
> > > > > > > or even
> > > > > > >
> > > > > > > dojo.debug("server gave a new title"); ({title: "a new
> > > title"})
> > > > > > >
> > > > > > > The problem is that using the JSONWriter i get something like
> > > :
> > > > > > >
> > > > > > > {"title" : "a new title"} -> the title is quoted and i think
> > > that is why
> > > > > > i
> > > > > > > get  an error saying  SyntaxError: invalid label
> > > > > > >
> > > > > > > If i don't use JSON response , i use XML , which is not good
> > > either.
> > > > > > >
> > > > > > > Any suggestion of what i'm doing wrong ?
> > > > > > > Should i build a custom ResponseBuilder or Writer ?
> > > > > > >
> > > > > > > thanks!
> > > > > > > Alex
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Jesse Kuhnert
> > > > > > Tapestry/Dojo team member/developer
> > > > > >
> > > > > > Open source based consulting work centered around
> > > > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > > > >
> > > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Jesse Kuhnert
> > > > Tapestry/Dojo team member/developer
> > > >
> > > > Open source based consulting work centered around
> > > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > > >
> > >
> > >
> > > --
> > > Jesse Kuhnert
> > > Tapestry/Dojo team member/developer
> > >
> > > Open source based consulting work centered around
> > > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>




--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to