/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { output.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
@Override public void objectToStream(Object object, DataOutput stream) throws Exception { int version = this.context.getCurrentVersion(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try (DataOutputStream output = new DataOutputStream(bytes)) { this.versionSerializer.writeInt(output, version); try (Marshaller marshaller = this.context.createMarshaller(version)) { marshaller.start(Marshalling.createByteOutput(output)); marshaller.writeObject(object); marshaller.flush(); } } byte[] buffer = bytes.toByteArray(); IndexSerializer.VARIABLE.writeInt(stream, buffer.length); stream.write(buffer); }
@Override public <R> byte[] marshal(Command<R, ? super C> command) throws IOException { int version = this.context.getCurrentVersion(); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try (DataOutputStream output = new DataOutputStream(bytes)) { IndexSerializer.VARIABLE.writeInt(output, version); try (Marshaller marshaller = this.context.createMarshaller(version)) { marshaller.start(Marshalling.createByteOutput(output)); marshaller.writeObject(this.id); marshaller.writeObject(command); marshaller.flush(); } return bytes.toByteArray(); } } }
@Override public void writeInvocationResult(Object result) { if(identifier != null) { cancellationFlags.remove(identifier); } try { exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, EjbHeaders.EJB_RESPONSE_VERSION_ONE.toString()); // if (output.getSessionAffinity() != null) { // exchange.getResponseCookies().put("JSESSIONID", new CookieImpl("JSESSIONID", output.getSessionAffinity()).setPath(WILDFLY_SERVICES)); // } final Marshaller marshaller = HttpServerHelper.RIVER_MARSHALLER_FACTORY.createMarshaller(marshallingConfiguration); OutputStream outputStream = exchange.getOutputStream(); final ByteOutput byteOutput = new NoFlushByteOutput(Marshalling.createByteOutput(outputStream)); // start the marshaller marshaller.start(byteOutput); marshaller.writeObject(result); // TODO: Do we really need to send this back? PackedInteger.writePackedInteger(marshaller, contextData.size()); for(Map.Entry<String, Object> entry : contextData.entrySet()) { marshaller.writeObject(entry.getKey()); marshaller.writeObject(entry.getValue()); } marshaller.finish(); marshaller.flush(); exchange.endExchange(); } catch (Exception e) { HttpServerHelper.sendException(exchange, 500, e); } } }
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"); } } }
marshaller.writeObject(timer.getInfo()); marshaller.finish(); marshaller.flush(); info = Base64.getEncoder().encodeToString(out.toByteArray()); } catch (Exception e) { marshaller.writeObject(timer.getPrimaryKey()); marshaller.finish(); marshaller.flush(); primaryKey = Base64.getEncoder().encodeToString(out.toByteArray()); } catch (Exception e) {
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(); } }
marshaller.writeObject(timer.getInfo()); marshaller.finish(); marshaller.flush(); info = Base64.getEncoder().encodeToString(out.toByteArray()); } catch (Exception e) { marshaller.writeObject(timer.getPrimaryKey()); marshaller.finish(); marshaller.flush(); primaryKey = Base64.getEncoder().encodeToString(out.toByteArray()); } catch (Exception e) {
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 = RIVER_MARSHALLER_FACTORY.createMarshaller(marshallingConfiguration); OutputStream outputStream = exchange.getOutputStream(); final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream); // start the marshaller marshaller.start(byteOutput); marshaller.writeObject(e); marshaller.write(0); marshaller.finish(); marshaller.flush(); exchange.endExchange(); } catch (Exception ex) { HttpClientMessages.MESSAGES.failedToWriteException(ex); exchange.endExchange(); } } }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { output.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { output.flush(); }
/** {@inheritDoc} */ public void flush() throws IOException { marshaller.flush(); }