static MarshallingConfiguration createMarshallingConf() { MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); return marshallingConfiguration; }
/** * Exceptions don't use an object/class table, as they are common across protocols * * @return */ MarshallingConfiguration createExceptionMarshallingConfig() { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); return marshallingConfiguration; }
static MarshallingConfiguration createMarshallingConf() { MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); return marshallingConfiguration; } }
/** * Creates and returns a {@link org.jboss.marshalling.Marshaller} * * @param marshallerFactory The marshaller factory * @return * @throws IOException */ private org.jboss.marshalling.Marshaller getMarshaller(final org.jboss.marshalling.MarshallerFactory marshallerFactory) throws IOException { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); // TODO - Do we need an Object and Class table? marshallingConfiguration.setVersion(2); // TODO - Will need classloading server side to be in context of bean being called. return marshallerFactory.createMarshaller(marshallingConfiguration); }
/** * Creates and returns a {@link org.jboss.marshalling.Marshaller} * * @param marshallerFactory The marshaller factory * @return * @throws IOException */ private org.jboss.marshalling.Marshaller getMarshaller(final org.jboss.marshalling.MarshallerFactory marshallerFactory) throws IOException { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); // TODO - Do we need an Object and Class table? marshallingConfiguration.setVersion(2); // TODO - Will need classloading server side to be in context of bean being called. return marshallerFactory.createMarshaller(marshallingConfiguration); }
private static MarshallingConfiguration createMarshallingConfig(URI uri) { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); if (helper != null) { marshallingConfiguration.setObjectResolver(helper.getObjectResolver(uri)); } return marshallingConfiguration; }
RemoteServerTransport(final Channel channel, final int version, final MessageTracker messageTracker, final Context localContext) { this.channel = channel; this.version = version; this.messageTracker = messageTracker; this.localContext = localContext; this.configuration = new MarshallingConfiguration(); configuration.setVersion(version == 2 ? 4 : 2); configuration.setClassResolver(new ContextClassResolver()); }
/** * Creates and returns a {@link Unmarshaller} * * * @param marshallerFactory The marshaller factory * @return * @throws IOException */ private Unmarshaller getUnMarshaller(final MarshallerFactory marshallerFactory, final ClassResolver classResolver) throws IOException { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); marshallingConfiguration.setClassResolver(classResolver); return marshallerFactory.createUnmarshaller(marshallingConfiguration); }
/** * Creates and returns a {@link Unmarshaller} * * * @param marshallerFactory The marshaller factory * @return * @throws IOException */ private Unmarshaller getUnMarshaller(final MarshallerFactory marshallerFactory, final ClassResolver classResolver) throws IOException { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); marshallingConfiguration.setClassResolver(classResolver); return marshallerFactory.createUnmarshaller(marshallingConfiguration); }
@Override public synchronized void start(StartContext startContext) throws StartException { final RiverMarshallerFactory factory = new RiverMarshallerFactory(); final MarshallingConfiguration configuration = new MarshallingConfiguration(); configuration.setClassResolver(ModularClassResolver.getInstance(moduleLoaderInjectedValue.getValue())); this.configuration = configuration; this.factory = factory; }
private MarshallingConfiguration createMarshallingConfig(URI uri) { final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setObjectResolver(new HttpProtocolV1ObjectResolver(uri)); marshallingConfiguration.setObjectTable(HttpProtocolV1ObjectTable.INSTANCE); marshallingConfiguration.setVersion(2); return marshallingConfiguration; }
@Override public MarshallingConfiguration apply(MarshallingConfigurationContext context) { MarshallingConfiguration config = new MarshallingConfiguration(); config.setClassResolver(ModularClassResolver.getInstance(context.getModuleLoader())); config.setClassTable(new DynamicClassTable(context.getModule().getClassLoader())); return config; } },
public static void sendException(HttpServerExchange exchange, int status, Throwable e) { try { exchange.setStatusCode(status); exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/x-wf-jbmar-exception;version=1"); final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); final Marshaller marshaller = MARSHALLER_FACTORY.createMarshaller(marshallingConfiguration); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final ByteOutput byteOutput = new NoFlushByteOutput(Marshalling.createByteOutput(outputStream)); // start the marshaller marshaller.start(byteOutput); marshaller.writeObject(e); marshaller.write(0); marshaller.finish(); marshaller.flush(); exchange.getResponseSender().send(ByteBuffer.wrap(outputStream.toByteArray())); } catch (IOException e1) { HttpRemoteTransactionMessages.MESSAGES.debugf(e, "Failed to write exception"); } } }
@Override protected final Object doOperation(HttpServerExchange exchange, String name) throws NamingException { ContentType contentType = ContentType.parse(exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE)); if (contentType == null || !contentType.getType().equals("application/x-wf-jndi-jbmar-value") || contentType.getVersion() != 1) { exchange.setStatusCode(StatusCodes.BAD_REQUEST); exchange.endExchange(); return null; } final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); try (InputStream inputStream = exchange.getInputStream()) { Unmarshaller unmarshaller = MARSHALLER_FACTORY.createUnmarshaller(marshallingConfiguration); unmarshaller.start(new InputStreamByteInput(inputStream)); Object object = unmarshaller.readObject(); unmarshaller.finish(); doOperation(name, object); } catch (Exception e) { NamingException nm = new NamingException(e.getMessage()); nm.initCause(e); throw nm; } return null; }
private static void doMarshall(HttpServerExchange exchange, Object result) throws IOException { exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/x-wf-jndi-jbmar-value;version=1"); final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); Marshaller marshaller = MARSHALLER_FACTORY.createMarshaller(marshallingConfiguration); marshaller.start(new NoFlushByteOutput(Marshalling.createByteOutput(exchange.getOutputStream()))); marshaller.writeObject(result); marshaller.finish(); }
@Override public MarshallingConfiguration apply(MarshallingConfigurationContext context) { MarshallingConfiguration config = new MarshallingConfiguration(); config.setClassResolver(ModularClassResolver.getInstance(context.getModuleLoader())); config.setClassTable(new DynamicClassTable(context.getModule().getClassLoader())); config.setObjectTable(new ExternalizerObjectTable(context.getModule().getClassLoader())); return config; } },
@SuppressWarnings("deprecation") @Override public MarshallingConfiguration apply(MarshallingConfigurationContext context) { Module module = context.getModule(); ModuleDeployment deployment = context.getDeployment(); MarshallingConfiguration config = new MarshallingConfiguration(); config.setClassResolver(ModularClassResolver.getInstance(module.getModuleLoader())); config.setSerializabilityChecker(new StatefulSessionBeanSerializabilityChecker(deployment)); config.setClassTable(new StatefulSessionBeanClassTable()); config.setObjectTable(new EJBClientContextIdentifierObjectTable()); return config; } },
EJBServerChannel(final RemotingTransactionServer transactionServer, final Channel channel, final int version, final MessageTracker messageTracker) { this.transactionServer = transactionServer; this.channel = channel; this.version = version; this.messageTracker = messageTracker; final MarshallingConfiguration configuration = new MarshallingConfiguration(); if (version < 3) { configuration.setClassTable(ProtocolV1ClassTable.INSTANCE); configuration.setObjectTable(ProtocolV1ObjectTable.INSTANCE); configuration.setObjectResolver(new ProtocolV1ObjectResolver(channel.getConnection(), true)); configuration.setVersion(2); } else { configuration.setObjectTable(ProtocolV3ObjectTable.INSTANCE); configuration.setObjectResolver(new ProtocolV3ObjectResolver(channel.getConnection(), true)); configuration.setVersion(4); } marshallerFactory = new RiverMarshallerFactory(); this.configuration = configuration; }
@Override public MarshallingConfiguration apply(MarshallingConfigurationContext context) { Module module = context.getModule(); ModuleDeployment deployment = context.getDeployment(); MarshallingConfiguration config = new MarshallingConfiguration(); config.setClassResolver(ModularClassResolver.getInstance(module.getModuleLoader())); config.setSerializabilityChecker(new StatefulSessionBeanSerializabilityChecker(deployment)); config.setClassTable(new StatefulSessionBeanClassTable()); config.setObjectResolver(new EJBClientContextIdentifierResolver()); config.setObjectTable(new ExternalizerObjectTable(module.getClassLoader())); return config; } },
public static void sendException(HttpServerExchange exchange, int status, Throwable e) throws IOException { exchange.setStatusCode(status); exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/x-wf-jbmar-exception;version=1"); final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); final Marshaller marshaller = MARSHALLER_FACTORY.createMarshaller(marshallingConfiguration); OutputStream outputStream = exchange.getOutputStream(); final ByteOutput byteOutput = new NoFlushByteOutput(Marshalling.createByteOutput(outputStream)); // start the marshaller marshaller.start(byteOutput); marshaller.writeObject(e); marshaller.write(0); marshaller.finish(); marshaller.flush(); } }