if (startPost.isRemote() && initState.querySpec.options .contains(QueryOption.EXPAND_BINARY_CONTENT)) { final String errFmt = "%s is not allowed for remote clients.";
@Override public void handleRequest(Operation op) { Action a = op.getAction(); if (a == Action.PUT) { Operation.failActionNotSupported(op); return; } if (a == Action.PATCH && op.isRemote()) { // PATCH is reserved for in-process QueryTaskService Operation.failActionNotSupported(op); return; } try { if (a == Action.GET || a == Action.PATCH) { if (offerQueryOperation(op)) { this.privateQueryExecutor.submit(this.queryTaskHandler); } } else { if (offerUpdateOperation(op)) { this.privateIndexingExecutor.submit(this.updateRequestHandler); } } } catch (RejectedExecutionException e) { op.fail(e); } }
@Override public void handleRequest(Operation op) { Action a = op.getAction(); if (a == Action.PUT) { Operation.failActionNotSupported(op); return; } if (a == Action.PATCH && op.isRemote()) { // PATCH is reserved for in-process QueryTaskService Operation.failActionNotSupported(op); return; } try { if (a == Action.GET || a == Action.PATCH) { if (offerQueryOperation(op)) { this.privateQueryExecutor.submit(this.queryTaskHandler); } } else { if (offerUpdateOperation(op)) { this.privateIndexingExecutor.submit(this.updateRequestHandler); } } } catch (RejectedExecutionException e) { op.fail(e); } }
@Override public boolean handleRequest(Service service, Operation inboundOp) { if (inboundOp == null && service != null) { inboundOp = service.dequeueRequest(); } if (inboundOp == null) { return true; } // Reject remote requests with 503 if node is not started, node stopping or // isRejectRemoteRequests flag is true (which can be used to reject requests before starting // factories) if ((!isStarted() || isStopping() || this.isRejectRemoteRequests) && inboundOp.isRemote()) { PostgresHostUtils.failServerNotAvailable(inboundOp); return true; } return super.handleRequest(null, inboundOp); }
if (get.isRemote() && getHost().isAuthorizationEnabled()) { get.nestCompletion((op, ex) -> { if (ex != null) {
@Override public void handlePatch(Operation patch) { if (patch.isRemote()) { // PATCH is reserved for in-process from LuceneDocumentIndexService Operation.failActionNotSupported(patch); return; } Object request = patch.getBodyRaw(); if (request instanceof BackupRequest) { handleBackup(patch); return; } else if (request instanceof RestoreRequest) { try { handleRestore(patch); } catch (IOException e) { patch.fail(e); } return; } Operation.failActionNotSupported(patch); }
ServiceDocumentDescription desc = r.description; if (updateOp.isRemote()) { updateOp.fail(new IllegalStateException("Remote requests not allowed")); return;
if (get.isRemote() && getHost().isAuthorizationEnabled()) { get.nestCompletion((op, ex) -> { if (ex != null) {
if (!op.isRemote()) { return FilterReturnCode.CONTINUE_PROCESSING;
case GET: if (!op.isRemote() && op.hasBody() && op .getBodyRaw() instanceof InternalDocumentIndexInfo) { Operation.failActionNotSupported(op);
ServiceDocumentDescription desc = r.description; if (updateOp.isRemote()) { updateOp.fail(new IllegalStateException("Remote requests not allowed")); return;
case GET: if (!op.isRemote() && op.hasBody() && op.getBodyRaw() instanceof InternalDocumentIndexInfo) { InternalDocumentIndexInfo response = new InternalDocumentIndexInfo(); response.indexWriter = this.writer;
@Override public void sendRequest(Operation op) { if (!validateOperation(op)) { return; } Operation clone = op.clone(); setExpiration(clone); setCookies(clone); OperationContext ctx = OperationContext.getOperationContext(); try { // First attempt in process delivery to co-located host if (!op.isRemote()) { if (this.host != null && this.host.handleRequest(clone)) { return; } } sendRemote(clone); } finally { // we must restore the operation context after each send, since // it can be reset by the host, depending on queuing and dispatching behavior OperationContext.restoreOperationContext(ctx); } }
@Override public boolean handleRequest(Service service, Operation inboundOp) { if (inboundOp == null && service != null) { inboundOp = service.dequeueRequest(); } if (inboundOp == null) { return true; } // Reject remote requests with 503 if node is not started, node stopping or // isRejectRemoteRequests flag is true (which can be used to reject requests before starting // factories) if ((!isStarted() || isStopping() || this.isRejectRemoteRequests) && inboundOp.isRemote()) { PostgresHostUtils.failServerNotAvailable(inboundOp); return true; } return super.handleRequest(null, inboundOp); }
assertTrue(op.getBodyRaw() instanceof String); assertEquals(Operation.MEDIA_TYPE_APPLICATION_X_WWW_FORM_ENCODED, op.getContentType()); assertTrue(op.isRemote());
private void performAndVerify304Response(String servicePath, Action action, boolean isRemote) { NotModifiedOwnerSelectedService.State dummyBody = new NotModifiedOwnerSelectedService.State(); Operation op = Operation.createGet(this.host, servicePath).setBody(dummyBody); op.setAction(action); if (isRemote) { op.forceRemote(); } Operation resultOp = this.sender.sendAndWait(op); assertNull(resultOp.getBodyRaw()); assertEquals(isRemote, resultOp.isRemote()); assertEquals(STATUS_CODE_NOT_MODIFIED, resultOp.getStatusCode()); }
private void performAndVerify304Response(String servicePath, Action action, boolean isRemote) { NotModifiedOwnerSelectedService.State dummyBody = new NotModifiedOwnerSelectedService.State(); Operation op = Operation.createGet(this.host, servicePath).setBody(dummyBody); op.setAction(action); if (isRemote) { op.forceRemote(); } Operation resultOp = this.sender.sendAndWait(op); assertNull(resultOp.getBodyRaw()); assertEquals(isRemote, resultOp.isRemote()); assertEquals(STATUS_CODE_NOT_MODIFIED, resultOp.getStatusCode()); }
return; if (!o.isRemote() && o.getAuthorizationContext() == null) { this.host.failIteration(new IllegalStateException( "Authorization context not set"));
return; if (!o.isRemote() && o.getAuthorizationContext() == null) { this.host.failIteration(new IllegalStateException( "Authorization context not set"));
if (!o.isRemote() && !(rsp instanceof ServiceErrorResponse)) { this.host.failIteration(new IllegalStateException("expected json response")); return;