enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
202 stars 34 forks source link

Serialize Context attributes in lib-context #7903

Closed gbbirkisson closed 2 years ago

gbbirkisson commented 4 years ago

Context has a map of attributes. When I set attributes in the context I expect to be able to read them, but the ContextMapper does not attempt to serialize them when getting the context from Javascript.

Maybe that is done for a reason because there are objects in the attributes that maybe are not serializable, but it would be nice to have some way to access attributes in javascript that I know are serializable.

rymsha commented 2 years ago

For now we will serialize only types of Number, String, Boolean and MapSerializable. The rest of attributes (for instance of type Date or BranchId) will be swallowed - we may reconsider what else we want to serialize in future.

We'll merge top-level, local, session (in order of preference) attributes into one Map, so it is possible to mimic Java getAttribute call in JS.