Hello,
i ran into the problem, that Red5 was sending the password field of my user
objects to
the flash clients as the result of a NetConnection.call. I tried to declare
the user field
of my data objects (so i can prevent the user field from being sent at all)
but didn't
have success. So i traced it to Serializer.writeBean and implemented it
myself.
I attached the patch file for this. Since the precise number of fields has
to be known
before iterating over the set and i wanted to avoid iterating over it twice
i simply set
the property value to null before serializing it, which should lead to the
intended
result.
It has been briefly tested and showed no abnormalities.
bye,
Sebastian
DIFF:
--- C:/Red5/svn_trunk/org/red5/io/object/Serializer.new.java Thu Jan 04
02:54:07 2007
+++ C:/Red5/svn_trunk/org/red5/io/object/Serializer.java Thu Jan 04
02:59:01 2007
@@ -487,14 +487,34 @@
while (it.hasNext()) {
BeanMap.Entry entry = (BeanMap.Entry) it.next();
if (entry.getKey().toString().equals("class")) {
continue;
}
-
+
out.writePropertyName(entry.getKey().toString());
+
+ // Read the value here so it can be processed first
+ Object value = entry.getValue();
+
//log.info(entry.getKey().toString()+" = "+entry.getValue());
- serialize(out, entry.getValue());
+ // Check if the Field corresponding to the getter/setter pair
is transient
+ try {
+ Field field = bean.getClass().getDeclaredField(entry.getKey
().toString());
+ int modifiers = field.getModifiers();
+
+ if (Modifier.isTransient(modifiers)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Skipping " + field.getName() + " because
its transient");
+ }
+ value = null; // Serialize null instead of the real
value.
+ }
+ } catch(NoSuchFieldException nfe) {
+ // Ignore this exception and use the default behaviour
+ }
+
+ serialize(out, value);
+
if (it.hasNext()) {
out.markPropertySeparator();
}
}
// Write out end of object mark
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org