本文整理汇总了Java中flex.messaging.io.SerializationContext.setDeserializationValidator方法的典型用法代码示例。如果您正苦于以下问题:Java SerializationContext.setDeserializationValidator方法的具体用法?Java SerializationContext.setDeserializationValidator怎么用?Java SerializationContext.setDeserializationValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flex.messaging.io.SerializationContext
的用法示例。
在下文中一共展示了SerializationContext.setDeserializationValidator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setThreadLocals
import flex.messaging.io.SerializationContext; //导入方法依赖的package包/类
/**
*
*/
public void setThreadLocals()
{
if (serializationContext != null)
{
SerializationContext context = (SerializationContext)serializationContext.clone();
// Get the latest deserialization validator from the broker.
MessageBroker broker = getMessageBroker();
DeserializationValidator validator = broker == null? null : broker.getDeserializationValidator();
context.setDeserializationValidator(validator);
SerializationContext.setSerializationContext(context);
}
TypeMarshallingContext.setTypeMarshaller(getTypeMarshaller());
}
示例2: setUp
import flex.messaging.io.SerializationContext; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
ClassDeserializationValidator classDeserializationValidator = new ClassDeserializationValidator();
classDeserializationValidator.addAllowClassPattern("flex.messaging.io.amfx.testtypes.*");
serializationContext = new SerializationContext();
serializationContext.setDeserializationValidator(classDeserializationValidator);
SerializationContext.setSerializationContext(serializationContext);
//trace = new AmfTrace();
}
示例3: deserializateRequest
import flex.messaging.io.SerializationContext; //导入方法依赖的package包/类
private void deserializateRequest(DeserializationValidator validator) {
try {
// Find sample AMF data, or read the default file.
String sample = System.getProperty("AMF_SAMPLE_FILE");
if (sample == null || sample.length() < 1)
sample = "amf_request.xml";
URL resource = ClassLoader.getSystemResource(sample);
URI uri = new URI(resource.toString());
File testData = new File(uri.getPath());
String testDataLocation = testData.getCanonicalPath();
// Generate sample AMF request from the data file.
PipedOutputStream pout = new PipedOutputStream();
DataOutputStream dout = new DataOutputStream(pout);
DataInputStream din = new DataInputStream(new PipedInputStream(pout));
AmfTrace trace = new AmfTrace();
trace.startResponse("Serializing AMF/HTTP response");
MessageGenerator gen = new MessageGenerator();
gen.setDebugTrace(trace);
gen.setOutputStream(dout);
gen.parse(testDataLocation);
trace.endMessage();
trace.newLine();
// Create a deserializer for sample AMF request.
ActionContext context = new ActionContext();
ActionMessage message = new ActionMessage();
context.setRequestMessage(message);
SerializationContext dsContext = SerializationContext.getSerializationContext();
if (validator != null)
dsContext.setDeserializationValidator(validator);
MessageDeserializer deserializer = new AmfMessageDeserializer();
deserializer.initialize(dsContext, din, trace);
deserializer.readMessage(message, context);
trace.endMessage();
trace.newLine();
//if (UnitTrace.debug) // Print trace output.
// System.out.print(trace.toString());
} catch (Exception e) {
e.printStackTrace();
Assert.fail();
}
}