Hmmmn. What you've implemented deserializes the whole of the request into one of the actions variables. This is handy but was not actually what i was after, let me explain more.

I'm trying to use the dojo tree widget with lazy loading. For the moment my idea is to get it going outside struts and later investigate the possibilities of integrating it with the struts tree tag (almost certainly by adding code).

The dojo tree widget implements lazy loading via the RPCUrl attribute in a div with dojoType TreeLoader

<div dojoType="TreeLoadingController" RPCUrl="...../myAction.action" widgetId="treeController"></div>

Each time you click to expand a node it sends a GET request like this

..../myAction.action?action=getChildren&data={"node":{"widgetId":"2669","objectId":"2669","index":0,"isFolder":true},"tree":{"widgetId":"bandTree","objectId":""}}

What i want to achieve with your jsonplugin is to receive the action parameter as is but to receive the data parameter deserialized.

In order for this to work in your interceptor i'd need something along the lines of

JSONUtil.deserialize(request.getParameter(this.root));

instead of

JSONUtil.deserialize(request.getReader());


Maybe this is of little interest. I don't know if there are other dojo functions that act in this way. I can solve my problems this by using classes from the jsonplugin in my action directly and although its not such a clean solution it works.

dataNodeObj = new DataNode();
new JSONInterceptor().populateObject(dataNodeObj, (Map) JSONUtil.deserialize(data));

(To make make matters worse the dojo bind method that the tree controller uses to make its request does not set the content-type, although i think that this may be different in the tree controller V3).

If implementing this is a hassle perhaps its not worth it, what do you think.

max

Musachy Barroso wrote:
You can pass the content type as a parameter to dojo.bind (actually, it is a
field inside the object passed as the parameter)

musachy

On 6/28/07, Max Pimm <[EMAIL PROTECTED]> wrote:

Thanks. Unfortunately i'm having trouble integrating it since the dojo
call that i am using does not set the content-type header. I've not got
debugging to work yet with dojo but once i do i'll have a look at whats
going on. The problem is not with the inteceptor anyway.

max

Musachy Barroso wrote:
> Ok, it is done (I was bored today :) ). Make sure that the object
> returned
> from the value stack, from the "root" expression is not null.
>
> regards
> musachy
>
> On 6/27/07, Max Pimm <[EMAIL PROTECTED]> wrote:
>>
>> Thanks a million. At the moment i'm not using the interceptor but am
>> deserializing my variable to a Map using your JSONUtil.deserialize and
>> then populating my variable inside my action class (i've copied your
>> JSONInterceptor.populateObject method).
>>
>> I look forward to doing this in a cleaner way in the future via the
>> interceptor but for the moment thanks for all these classes in the
>> plugin. They do their job nicely.
>>
>> max
>>
>> Musachy Barroso wrote:
>> > Nope, the interceptor doesn't have that, but it would be really easy
>> > to add,
>> > I will add it on the next few days.
>> >
>> > regards
>> > musachy
>> >
>> > On 6/27/07, Max Pimm <[EMAIL PROTECTED]> wrote:
>> >>
>> >> I'm using the JSON plugin in one of my actions with the
documentation
>> >> that i've found here
>> >> (http://cwiki.apache.org/S2PLUGINS/json-plugin.html). My case is a
>> >> little different as i am not using SMD. I receive calls to the
action
>> >> with parameters passed via the query string. Most of these
parameters
>> do
>> >> not need to be deserialized but one of them does.
>> >>
>> >> I've seen how to specify a root for serialization of the response
>> >>
>> >> <result type="json">
>> >>   <param name="root">
>> >>     person.job
>> >>   </param>
>> >> </result>
>> >>
>> >> But is there anyway to apply the same thing to deserialization in
the
>> >> request?
>> >>
>> >>
>> >>
>> >>
---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>

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





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

Reply via email to