use of org.jboss.marshalling.MarshallingConfiguration in project wildfly by wildfly.
the class SimpleMarshallingContext method isMarshallable.
@Override
public boolean isMarshallable(Object object) {
if (object == null)
return true;
MarshallingConfiguration configuration = this.repository.getMarshallingConfiguration(this.repository.getCurrentMarshallingVersion());
try {
ObjectTable table = configuration.getObjectTable();
if ((table != null) && table.getObjectWriter(object) != null)
return true;
ClassExternalizerFactory factory = configuration.getClassExternalizerFactory();
if ((factory != null) && (factory.getExternalizer(object.getClass()) != null))
return true;
SerializabilityChecker checker = configuration.getSerializabilityChecker();
return ((checker == null) ? SerializabilityChecker.DEFAULT : checker).isSerializable(object.getClass());
} catch (IOException e) {
return false;
}
}
use of org.jboss.marshalling.MarshallingConfiguration in project jdepth by Crab2died.
the class MarshallingCodeCFactory method buildDecoder.
public static MarshallingDecoder buildDecoder() {
MarshallerFactory factory = Marshalling.getProvidedMarshallerFactory("serial");
MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
UnmarshallerProvider provider = new DefaultUnmarshallerProvider(factory, configuration);
return new MarshallingDecoder(provider, 1024);
}
use of org.jboss.marshalling.MarshallingConfiguration in project netty by netty.
the class RiverCompatibleMarshallingDecoderTest method createMarshallingConfig.
@Override
protected MarshallingConfiguration createMarshallingConfig() {
// Create a configuration
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(3);
return configuration;
}
use of org.jboss.marshalling.MarshallingConfiguration in project netty by netty.
the class AbstractCompatibleMarshallingDecoderTest method testFragmentedUnmarshalling.
@Test
public void testFragmentedUnmarshalling() throws IOException {
MarshallerFactory marshallerFactory = createMarshallerFactory();
MarshallingConfiguration configuration = createMarshallingConfig();
EmbeddedChannel ch = new EmbeddedChannel(createDecoder(Integer.MAX_VALUE));
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
marshaller.start(Marshalling.createByteOutput(bout));
marshaller.writeObject(testObject);
marshaller.finish();
marshaller.close();
byte[] testBytes = bout.toByteArray();
ByteBuf buffer = input(testBytes);
ByteBuf slice = buffer.readRetainedSlice(2);
ch.writeInbound(slice);
ch.writeInbound(buffer);
assertTrue(ch.finish());
String unmarshalled = ch.readInbound();
assertEquals(testObject, unmarshalled);
assertNull(ch.readInbound());
}
use of org.jboss.marshalling.MarshallingConfiguration in project netty by netty.
the class AbstractCompatibleMarshallingDecoderTest method testTooBigObject.
@Test
public void testTooBigObject() throws IOException {
MarshallerFactory marshallerFactory = createMarshallerFactory();
MarshallingConfiguration configuration = createMarshallingConfig();
ChannelHandler mDecoder = createDecoder(4);
EmbeddedChannel ch = new EmbeddedChannel(mDecoder);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
marshaller.start(Marshalling.createByteOutput(bout));
marshaller.writeObject(testObject);
marshaller.finish();
marshaller.close();
byte[] testBytes = bout.toByteArray();
onTooBigFrame(ch, input(testBytes));
}
Aggregations