Concept mapping between ActionScript and Java objects for BlazeDS Messenger
The BlazeDS documentation shows you how to explicitly render ActionScript and Java objects. For example, this works great for RPC services like
import flash.utils.IExternalizable;
import flash.utils.IDataInput;
import flash.utils.IDataOutput;
[Bindable]
[RemoteClass(alias="javaclass.User")]
public class User implements IExternalizable {
public var id : String;
public var secret : String;
public function User() {
}
public function readExternal(input : IDataInput) : void {
id = input.readObject() as String;
}
public function writeExternal(output : IDataOutput) : void {
output.writeObject(id);
}
}
and
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class User implements Externalizable {
protected String id;
protected String secret;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
id = (String) in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(id);
}
}
If I call an RPC service that returns User
is secret
not sent over the wire.
Is it possible to do this for the messaging service as well? That is, if I create a custom messaging adapter and use the function below, can I also prevent the submission secret
?
MessageBroker messageBroker = MessageBroker.getMessageBroker(null);
AsyncMessage message = new AsyncMessage();
message.setDestination("MyMessagingService");
message.setClientId(UUIDUtils.createUUID());
message.setMessageId(UUIDUtils.createUUID());
User user = new User();
user.setId("id");
user.setSecret("secret");
message.setBody(user);
messageBroker.routeMessageToService(message, null);
+2
source to share