Handles a request containing an open request.

@param request the request containing row open request.
327030
private void handleOpenItemRequest(final Request request) {

		// Check for tree item id
		String param = request.getParameter(ITEM_REQUEST_KEY);
		if (param == null) {
			throw new SystemException("No tree item id provided for open request.");
		}

		// Remove the prefix to get the item id
		int offset = getItemIdPrefix().length();
		if (param.length() <= offset) {
			throw new SystemException("Tree item id [" + param + "] does not have the correct prefix value.");
		}
		String itemId = param.substring(offset);

		// Check is a valid item id
		if (!isValidTreeItem(itemId)) {
			throw new SystemException("Tree item id [" + itemId + "] is not valid.");
		}

		// Check expandable
		TreeItemIdNode custom = getCustomTree();
		if (custom == null) {
			List<Integer> rowIndex = getExpandedItemIdIndexMap().get(itemId);
			if (!getTreeModel().isExpandable(rowIndex)) {
				throw new SystemException("Tree item id [" + itemId + "] is not expandable.");
			}
		} else {
			TreeItemIdNode node = getCustomIdNodeMap().get(itemId);
			if (!node.hasChildren()) {
				throw new SystemException("Tree item id [" + itemId + "] is not expandable in custom tree.");
			}
		}

		// Save the open id
		setOpenRequestItemId(itemId);

		// Run the open action (if set)
		final Action action = getOpenAction();
		if (action != null) {
			final ActionEvent event = new ActionEvent(this, "openItem");
			Runnable later = new Runnable() {
				@Override
				public void run() {
					action.execute(event);
				}
			};
			invokeLater(later);
		}

	}
848045
public static boolean isSaneRequest(HttpServletRequest request) {
        if (request != null && request.getMethod() != null) {
            return true;
        }
        return false;
    }
954735
public static void with(HttpRequest request, Runnable runnable) {
        HttpRequest existing = REQUEST.get();
        boolean isSet = false;
        try {
            if (request != existing) {
                isSet = true;
                REQUEST.set(request);
            }
            runnable.run();
        } finally {
            if (isSet) {
                REQUEST.remove();
            }
        }
    }
699280
@Override
  public boolean execute(HttpRequestBase request) {
    DataSenderThread senderThread = new DataSenderThread(HTTP_CLIENT_INSTANCE, request);
    senderThread.run();
    return true;
  }
1286753
@Override
	public void handleRequest(final Request request) {
		if (plainBtn.isPressed()) {
			WMessages.getInstance(this).info("Plain button pressed.");
		}

		if (linkBtn.isPressed()) {
			WMessages.getInstance(this).info("Link button pressed.");
		}
	}
88123
private void addPostParams(final Request request) {
        if (status != null) {
            request.addPostParam("Status", status.toString());
        }

        if (announceUrl != null) {
            request.addPostParam("AnnounceUrl", announceUrl.toString());
        }

        if (announceMethod != null) {
            request.addPostParam("AnnounceMethod", announceMethod.toString());
        }
    }
1156996
@Override
	public void serviceRequest(final Request request) {
		LOG.debug("Before Service Request - Clearing targetable index.");
		UIContext uic = UIContextHolder.getCurrent();

		super.serviceRequest(request);
		// Clear phase scope scratch map
		LOG.debug("After Service Request - Clearing scratch map with phase scope.");
		uic.clearScratchMap();
	}
670254
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		WComponent visibleDialog = getVisible();

		if (visibleDialog != null) {
			visibleDialog.serviceRequest(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);
		}
	}
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);
				}
			}
		}
	}
946526
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		if (isPresent(request)) {
			if (getExpandMode() != ExpandMode.NONE) {
				handleExpansionRequest(request);
			}

			if (getSelectMode() != SelectMode.NONE) {
				handleSelectionRequest(request);
			}

			if (getPaginationMode() != PaginationMode.NONE) {
				handlePaginationRequest(request);
			}

			if (isFilterable()) {
				handleFilterRequest(request);
			}

			if (isSortable()) {
				handleSortRequest(request);
			}
		}
	}
928472
@Override
	public void handleRequest(final Request request) {
		if (!isInitialised()) {
			getOrCreateComponentModel().delegate = new SafetyContainerDelegate(UIContextHolder.
					getCurrent());
			setInitialised(true);
		}

		try {
			UIContext delegate = getComponentModel().delegate;
			UIContextHolder.pushContext(delegate);

			try {
				for (int i = 0; i < shim.getChildCount(); i++) {
					shim.getChildAt(i).serviceRequest(request);
				}

				delegate.doInvokeLaters();
			} finally {
				UIContextHolder.popContext();
			}
		} catch (final ActionEscape e) {
			// We don't want to catch ActionEscapes (e.g. ForwardExceptions)
			throw e;
		} catch (final Exception e) {
			if (isAjaxOrTargetedRequest(request)) {
				throw new SystemException(e.getMessage(), e);
			} else {
				setAttribute(ERROR_KEY, e);
			}
		}
	}
818047
private void addQueryParams(final Request request) {
        if (order != null) {
            request.addQueryParam("Order", order.toString());
        }

        if (from != null) {
            request.addQueryParam("From", from);
        }

        if (bounds != null) {
            request.addQueryParam("Bounds", bounds.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1195232
@SuppressWarnings("unchecked")
  private void handlePublish(PublishRequest request) {
    state.getLogger().trace("{} - Received {}", state.getSessionId(), request);

    // If the request is for another session ID, this may be a session that was previously opened
    // for this client.
    if (request.session() != state.getSessionId()) {
      state.getLogger().trace("{} - Inconsistent session ID: {}", state.getSessionId(), request.session());
      return;
    }

    // If the request event index has already been processed, return.
    if (request.eventIndex() <= state.getEventIndex()) {
      return;
    }

    // If the request's previous event index doesn't equal the previous received event index,
    // respond with an undefined error and the last index received. This will cause the cluster
    // to resend events starting at eventIndex + 1.
    if (request.previousIndex() != state.getEventIndex()) {
      state.getLogger().trace("{} - Inconsistent event index: {}", state.getSessionId(), request.previousIndex());
      connection.send(ResetRequest.builder()
        .withSession(state.getSessionId())
        .withIndex(state.getEventIndex())
        .build());
      return;
    }

    // Store the event index. This will be used to verify that events are received in sequential order.
    state.setEventIndex(request.eventIndex());

    sequencer.sequenceEvent(request, () -> {
      for (Event<?> event : request.events()) {
        Set<Consumer> listeners = eventListeners.get(event.name());
        if (listeners != null) {
          for (Consumer listener : listeners) {
            listener.accept(event.message());
          }
        }
      }
    });
  }
1112918
protected CompletableFuture<AppendResponse> handleAppend(final AppendRequest request) {
    CompletableFuture<AppendResponse> future = new CompletableFuture<>();

    // Check that the term of the given request matches the local term or update the term.
    if (!checkTerm(request, future)) {
      return future;
    }

    // Check that the previous index/term matches the local log's last entry.
    if (!checkPreviousEntry(request, future)) {
      return future;
    }

    // Append the entries to the log.
    appendEntries(request, future);
    return future;
  }
204668
@Override
	public void handleRequest(final Request request) {
		if (clrBtn.isPressed()) {
			textFld.setText("");
		} else if (dupBtn.isPressed()) {
			// Get the text entered by the user.
			String text = textFld.getText();

			// Now duplicate it.
			textFld.setText(text + text);
		}
	}
943014
protected static void fetchAnonymousAccessTokenAndRunRequest(final Request request) {
        fetchAnonymousAccessToken(request.getUserId(), new ResponseHandler() {
            @Override
            public void onSuccess(Response response) {
                requestAuthenticated(request);
            }

            @Override
            public void onFailure(Throwable e, Response errorResponse) {
            }
        });
    }