Thursday, April 2, 2015

Problem with sending to server ValueProxy which contains List of EntityProxy after has been decode by AutoBeanCodex


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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment