DWR

Support for parameter of type Map<String, Object>

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Normal Normal
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: 4.0
  • Component/s: None
  • Documentation Required:
    No
  • Description:
    Hide
    Suppose you want to create a method that can return generic "database rows" from server to client.
    A DWR method with this signature can be created to accomplish this task:

    public Map<String, Object> getRowsFromDb();

    now if you then need to return updated date back from client to server, another method can be created with this signature:

    public void updateData(Map<String, Object> data);

    The problem is that DWR can convert Map<String, Object> to JSON, but cannot convert JSON back to Map<String, Object>.
    Considering the informations contained in JSON, DWR should be able at least to convert incoming JSON to String, Boolean, float, or Map.

    For more info refer to thread "Passing parameters of type Map<String, Object>" in the DWR mailing list.
    Show
    Suppose you want to create a method that can return generic "database rows" from server to client. A DWR method with this signature can be created to accomplish this task: public Map<String, Object> getRowsFromDb(); now if you then need to return updated date back from client to server, another method can be created with this signature: public void updateData(Map<String, Object> data); The problem is that DWR can convert Map<String, Object> to JSON, but cannot convert JSON back to Map<String, Object>. Considering the informations contained in JSON, DWR should be able at least to convert incoming JSON to String, Boolean, float, or Map. For more info refer to thread "Passing parameters of type Map<String, Object>" in the DWR mailing list.

Activity

Hide
Mike Wilson added a comment - 01/Jan/11 10:19 AM

This is interesting, we could look at providing an alternative data mapping path that does less conversion in more of a JSON-style, maps and arrays of other maps, arrays or primitives. IIRC this has been suggested previously on the list as well. Ideally this algorithm could be selected as we select converters today.

Show
Mike Wilson added a comment - 01/Jan/11 10:19 AM This is interesting, we could look at providing an alternative data mapping path that does less conversion in more of a JSON-style, maps and arrays of other maps, arrays or primitives. IIRC this has been suggested previously on the list as well. Ideally this algorithm could be selected as we select converters today.

People

Dates

  • Created:
    01/Jan/11 7:37 AM
    Updated:
    01/Jan/11 10:19 AM