Handles a backup request.

@param request the backup request
@return future to be completed with a backup response
439701
public CompletableFuture<BackupResponse> backup(BackupRequest request) {
    ComposableFuture<BackupResponse> future = new ComposableFuture<>();
    threadContext.execute(() -> {
      role.backup(request).whenComplete(future);
    });
    return future;
  }
976919
@Override
	public void handleRequest(final Request request) {
		// Can only be an active DIALOG if it is AJAX targetted.
		if (isAjaxTargeted()) {
			if (getState() == INACTIVE_STATE) {
				handleTriggerOpenAction(request);
			}
			getOrCreateComponentModel().state = ACTIVE_STATE;
		} else if (getState() != INACTIVE_STATE) {
			getOrCreateComponentModel().state = INACTIVE_STATE;
		}
	}
1210932
@SuppressWarnings("unchecked")
	@Override
	public <T extends Resource> T request(final HttpRequestBase request) {
		try {
			HttpResponse response = execute(client, request);
			Resource resource = toPage(request, response);
			return (T)resource;
		} catch (Exception e) {
			throw MechanizeExceptionFactory.newException(e);
		}
	}
167320
protected void handleAppendResponseFailure(MemberState member, AppendRequest request, Throwable error) {
    // Trigger commit futures if necessary.
    updateHeartbeatTime(member, error);

    super.handleAppendResponseFailure(member, request, error);
  }
1302904
private CompletableFuture<CloseResponse> close(CloseRequest request) {
    return getService(request).thenCompose(service -> service.close(request));
  }
283583
private void handleTrackRequest(final Request request) {
		String trackRequested = request.getParameter(TRACK_INDEX_REQUEST_PARAM_KEY);
		int trackIndex = 0;

		try {
			trackIndex = Integer.parseInt(trackRequested);
		} catch (NumberFormatException e) {
			LOG.error("Failed to parse track index: " + trackIndex);
		}

		Track[] tracks = getTracks();

		if (tracks != null && trackIndex >= 0 && trackIndex < tracks.length) {
			ContentEscape escape = new ContentEscape(tracks[trackIndex]);
			escape.setCacheable(!Util.empty(getCacheKey()));
			throw escape;
		} else {
			LOG.warn("Client requested invalid track: " + trackIndex);
		}
	}
812082
void postSuccess(final DownloadRequest request) {
    downloadPoster.execute(new Runnable() {
      @Override public void run() {
        request.downloadCallback().onSuccess(request.downloadId(), request.destinationFilePath());
      }
    });
  }
1213450
@Override
	public void handleRequest(final Request request) {
		if (!isDisabled()) {
			final SelectToggleModel model = getComponentModel();
			String requestParam = request.getParameter(getId());

			final State newValue;
			if ("all".equals(requestParam)) {
				newValue = State.ALL;
			} else if ("none".equals(requestParam)) {
				newValue = State.NONE;
			} else if ("some".equals(requestParam)) {
				newValue = State.SOME;
			} else {
				newValue = model.state;
			}

			if (!newValue.equals(model.state)) {
				setState(newValue);
			}
			if (!model.clientSide && model.target != null && !State.SOME.equals(newValue)) {
				// We need to change the selections *after* all components
				// Have updated themselves from the request, as they may change
				// their values when their handleRequest methods are called.
				invokeLater(new Runnable() {
					@Override
					public void run() {
						setSelections(model.target, State.ALL.equals(newValue));
					}
				});
			}
		}
	}
976494
@Override
    public void handle(T result, HttpResponse response) {
        String restoreHeader = response.getHeaders().get(Headers.RESTORE);
        if (restoreHeader != null) {
            result.setRestoreExpirationTime(parseDate(restoreHeader));
            Boolean onGoingRestore = parseBoolean(restoreHeader);
            if (onGoingRestore != null) {
                result.setOngoingRestore(onGoingRestore);
            }
        }
    }
417368
private void handleSortRequest(final Request request) {
		String sortColStr = request.getParameter(getId() + ".sort");
		String sortDescStr = request.getParameter(getId() + ".sortDesc");

		if (sortColStr != null) {
			if ("".equals(sortColStr)) {
				// Reset sort
				setSort(-1, false);
				getOrCreateComponentModel().rowIndexMapping = null;
			} else {
				try {
					int sortCol = Integer.parseInt(sortColStr);
					// Allow for column order
					int[] cols = getColumnOrder();
					if (cols != null) {
						sortCol = cols[sortCol];
					}
					boolean sortAsc = !"true".equalsIgnoreCase(sortDescStr);

					// Only process the sort request if it differs from the current sort order
					if (sortCol != getSortColumnIndex() || sortAsc != isSortAscending()) {
						sort(sortCol, sortAsc);
						setFocussed();
					}
				} catch (NumberFormatException e) {
					LOG.warn("Invalid sort column: " + sortColStr);
				}
			}
		}
	}
507520
private void sendRequest(Object request, ContextualFuture future) {
    if (open && connection.open) {
      long requestId = ++this.requestId;
      futures.put(requestId, future);
      connection.handleRequest(requestId, request);
    } else {
      future.context.executor().execute(() -> future.completeExceptionally(new ConnectException("connection closed")));
    }

    if (request instanceof ReferenceCounted) {
      ((ReferenceCounted<?>) request).release();
    }
  }
226355
public CompletableFuture<CloseResponse> close(CloseRequest request) {
    ComposableFuture<CloseResponse> future = new ComposableFuture<>();
    threadContext.execute(() -> {
      PrimaryBackupSession session = sessions.get(request.session());
      if (session != null) {
        role.close(session).whenComplete((result, error) -> {
          if (error == null) {
            future.complete(CloseResponse.ok());
          } else {
            future.complete(CloseResponse.error());
          }
        });
      } else {
        future.complete(CloseResponse.error());
      }
    });
    return future;
  }
898921
@Override
    public Response execute(Request request) throws IOException {
        HttpURLConnection connection = openConnection(request);
        sendRequest(connection, request);
        return readResponse(connection);
    }
61365
private CompletableFuture<RestoreResponse> restore(RestoreRequest request) {
    return getService(request).thenCompose(service -> service.restore(request));
  }
1362000
public HttpResponse execute( final HttpUriRequest request ) throws IOException, ReadOnlyException {
        if ( readOnly ) {
            switch ( request.getMethod().toLowerCase() ) {
                case "copy": case "delete": case "move": case "patch": case "post": case "put":
                    throw new ReadOnlyException();
                default:
                    break;
            }
        }

        return httpClient.execute(request, httpContext);
    }
507013
public void execute(final AwsRequest request) {
    service.callFunction(
        Fields.EXECUTE_ACTION_NAME,
        Collections.singletonList(getRequestArgs(request)));
  }
671031
private CompletableFuture<QueryResponse> queryForward(QueryRequest request) {
    if (context.getLeader() == null) {
      return CompletableFuture.completedFuture(logResponse(QueryResponse.builder()
        .withStatus(Response.Status.ERROR)
        .withError(CopycatError.Type.NO_LEADER_ERROR)
        .build()));
    }

    LOGGER.trace("{} - Forwarding {}", context.getCluster().member().address(), request);
    return this.<QueryRequest, QueryResponse>forward(request)
      .exceptionally(error -> QueryResponse.builder()
        .withStatus(Response.Status.ERROR)
        .withError(CopycatError.Type.NO_LEADER_ERROR)
        .build())
      .thenApply(this::logResponse);
  }