/** {@inheritDoc} */ public void readFully(final byte[] buf) throws IOException { input.readFully(buf); }
/** {@inheritDoc} */ public void readFully(final byte[] b, final int off, final int len) throws IOException { unmarshaller.readFully(b, off, len); }
/** {@inheritDoc} */ public void readFully(final byte[] buf, final int off, final int len) throws IOException { input.readFully(buf, off, len); }
/** {@inheritDoc} */ public void readFully(final byte[] b) throws IOException { unmarshaller.readFully(b); }
public void readFully(final byte[] b, final int off, final int len) throws IOException { unmarshaller.readFully(b, off, len); }
public void readFully(final byte[] b) throws IOException { unmarshaller.readFully(b); }
protected ReceivedTransaction readTransaction(Unmarshaller unmarshaller) throws IOException { int type = unmarshaller.readByte(); if (type == 0) { return null; } else if (type == 1 || type == 2) { int formatId = unmarshaller.readInt(); int len = unmarshaller.readInt(); byte[] globalId = new byte[len]; unmarshaller.readFully(globalId); len = unmarshaller.readInt(); byte[] branchId = new byte[len]; unmarshaller.readFully(branchId); SimpleXid simpleXid = new SimpleXid(formatId, globalId, branchId); if (type == 2) { return new ReceivedTransaction(simpleXid, unmarshaller.readInt(), true); } return new ReceivedTransaction(simpleXid, 0, false); } else { throw EjbHttpClientMessages.MESSAGES.invalidTransactionType(type); } }
@Override public final void handleRequest(HttpServerExchange exchange) throws Exception { ContentType contentType = ContentType.parse(exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE)); if (contentType == null || contentType.getVersion() != 1 || !contentType.getType().equals(TransactionConstants.XID)) { exchange.setStatusCode(StatusCodes.BAD_REQUEST); HttpRemoteTransactionMessages.MESSAGES.debugf("Exchange %s has incorrect or missing content type", exchange); return; } try { Unmarshaller unmarshaller = MARSHALLER_FACTORY.createUnmarshaller(createMarshallingConf()); unmarshaller.start(new InputStreamByteInput(exchange.getInputStream())); int formatId = unmarshaller.readInt(); int len = unmarshaller.readInt(); byte[] globalId = new byte[len]; unmarshaller.readFully(globalId); len = unmarshaller.readInt(); byte[] branchId = new byte[len]; unmarshaller.readFully(branchId); SimpleXid simpleXid = new SimpleXid(formatId, globalId, branchId); unmarshaller.finish(); ImportResult<LocalTransaction> transaction = transactionContext.findOrImportTransaction(simpleXid, 0); transaction.getTransaction().performFunction((ExceptionBiFunction<ImportResult<LocalTransaction>, HttpServerExchange, Void, Exception>) (o, exchange2) -> { handleImpl(exchange2, o); return null; }, transaction, exchange); } catch (Exception e) { sendException(exchange, StatusCodes.INTERNAL_SERVER_ERROR, e); } }
/** {@inheritDoc} */ public void readFully(final byte[] buf, final int off, final int len) throws IOException { input.readFully(buf, off, len); }
/** {@inheritDoc} */ public void readFully(final byte[] buf) throws IOException { input.readFully(buf); }
/** {@inheritDoc} */ public void readFully(final byte[] buf, final int off, final int len) throws IOException { input.readFully(buf, off, len); }
/** {@inheritDoc} */ public void readFully(final byte[] buf, final int off, final int len) throws IOException { input.readFully(buf, off, len); }
/** {@inheritDoc} */ public void readFully(final byte[] b, final int off, final int len) throws IOException { unmarshaller.readFully(b, off, len); }
public void readFully(final byte[] b) throws IOException { unmarshaller.readFully(b); }
/** {@inheritDoc} */ public void readFully(final byte[] b) throws IOException { unmarshaller.readFully(b); }
/** {@inheritDoc} */ public void readFully(final byte[] b, final int off, final int len) throws IOException { unmarshaller.readFully(b, off, len); }
/** {@inheritDoc} */ public void readFully(final byte[] b) throws IOException { unmarshaller.readFully(b); }
/** {@inheritDoc} */ public void readFully(final byte[] b, final int off, final int len) throws IOException { unmarshaller.readFully(b, off, len); }