I think that I've found right way to de/serialize such proxy:

I must use RequestFactory.getSerializer instead of AutoBeanCodex.decodeInto/
AutoBeanCodex.encode

kind of

public static <F extends BaseProxy, RC extends RequestContext> F 
deserialize(RequestFactory requestFactory, Class<F> clazz, String payload)
{
    String[] parts = payload.split(":", 2);
    ProxyStore store = new DefaultProxyStore(parts[1]);
    ProxySerializer ser = requestFactory.getSerializer(store);
    F filter = ser.deserialize(clazz, parts[0]);

    return filter;
}

public static <F extends BaseProxy> String serialize(RequestFactory 
requestFactory, F filter)
{
    DefaultProxyStore store = new DefaultProxyStore();
    ProxySerializer ser = requestFactory.getSerializer(store);
    final String key = ser.serialize(filter);
    String payload = key + ":" + store.encode();

    return payload;
}


 
this is right?

On Thursday, April 2, 2015 at 6:53:47 PM UTC+3, Anton Mityagin wrote:
>
>
> Hi
>
> Assume I have following ValueProxy
>
>
> @ProxyFor(value = MailFilter.class)
> public interface MailFilterProxy extends ValueProxy
> {
>     String getQuery();
>     
>     void setQuery(String query);
>     
>     List<ContactProxy> getFrom();
>     
>     void setFrom(List<ContactProxy> from);
> }
>
>
> User edits this proxy in some Editor<MailFilterProxy>. After this this 
> proxy encoded to payload by AutoBeanCodex:
>
> AutoBean<MailFilterProxy> bean = AutoBeanUtils.getAutoBean(mailFilter);
>
> String payload = AutoBeanCodex.encode(bean).getPayload();
>
>
> encoding FilterProxy to string is needs to get right URL for list of 
> MailProxy, somthing like #ml:f={encoded filter payload}
>
> and representation filter for list as ValueProxy to be able to use GWT 
> Editor & Driver framework (don't know right name of this functionality)
>
> Next, users goes to list place with new filter payload:
>
> getPlaceController().goTo(new ListPlace(MailProxy.class, payload)
>
>
> in list Activity I trying to decode this payload into MailFilterProxy:
>
> MailRequest request = getRequestFactory(); // some request for mails
>
> MailFilterProxy *filter *= request.create(MailFilterProxy.class);
>
> AutoBean<MailFilterProxy> bean = AutoBeanUtils.getAutoBean(filter);
>
> AutoBeanCodex.decodeInto(StringQuoter.split(getPlace().getFilterPayload()), 
> bean);
>
> *filter *= bean.as();
>
>
> next I trying to fire list request with new MailFilterProxy
>
> request.getList(*filter*).with(getWith()).fire(new 
> Receiver<List<MailProxy>>(...));
>
>
> And I catch an exception:
>
> Unfrozen bean with null RequestContext
>
>
>
> This occurs because AutoBeanCodex uses MailRequestImpl_FactoryImpl for 
> creation of ContactProxy - list items, but not MailRequest 
> and it was not set any tags (REQUEST_CONTEXT_STATE, STABLE_ID)
>
> What I'm doing wrong? How to do it right or some workaround?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to