use of org.neo4j.server.rest.transactional.TransactionHandle in project neo4j by neo4j.
the class TransactionalService method executeStatementsInNewTransaction.
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response executeStatementsInNewTransaction(final InputStream input, @Context final UriInfo uriInfo, @Context final HttpServletRequest request) {
try {
usage.get(features).flag(http_tx_endpoint);
SecurityContext securityContext = AuthorizedRequestWrapper.getSecurityContextFromHttpServletRequest(request);
long customTransactionTimeout = HttpHeaderUtils.getTransactionTimeout(request, log);
TransactionHandle transactionHandle = facade.newTransactionHandle(uriScheme, false, securityContext, customTransactionTimeout);
return createdResponse(transactionHandle, executeStatements(input, transactionHandle, uriInfo.getBaseUri(), request));
} catch (TransactionLifecycleException e) {
return invalidTransaction(e, uriInfo.getBaseUri());
}
}
use of org.neo4j.server.rest.transactional.TransactionHandle in project neo4j by neo4j.
the class TransactionalService method commitNewTransaction.
@POST
@Path("/commit")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public Response commitNewTransaction(final InputStream input, @Context final UriInfo uriInfo, @Context final HttpServletRequest request) {
final TransactionHandle transactionHandle;
try {
SecurityContext securityContext = AuthorizedRequestWrapper.getSecurityContextFromHttpServletRequest(request);
long customTransactionTimeout = HttpHeaderUtils.getTransactionTimeout(request, log);
transactionHandle = facade.newTransactionHandle(uriScheme, true, securityContext, customTransactionTimeout);
} catch (TransactionLifecycleException e) {
return invalidTransaction(e, uriInfo.getBaseUri());
}
final StreamingOutput streamingResults = executeStatementsAndCommit(input, transactionHandle, uriInfo.getBaseUri(), request);
return okResponse(streamingResults);
}
Aggregations