Reports the given {@link CouchbaseRequest} as a orphan response.

@param request the request that shpuld be reported.
481278
@Override
    public void report(final CouchbaseResponse request) {
        if (!queue.offer(request)) {
            LOGGER.debug("Could not enqueue CouchbaseRequest {} for orphan reporting, discarding.", request);
        }
    }
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) {
            }
        });
    }
752370
public void setBucketAcl(SetBucketAclRequest request) {
        checkNotNull(request, "request should not be null.");

        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT);
        internalRequest.addParameter("acl", null);

        if (request.getCannedAcl() != null) {
            internalRequest.addHeader(Headers.BCE_ACL, request.getCannedAcl().toString());
            this.setZeroContentLength(internalRequest);
        } else if (request.getAccessControlList() != null) {
            byte[] json = null;
            List<Grant> grants = request.getAccessControlList();
            StringWriter writer = new StringWriter();
            try {
                JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer);
                jsonGenerator.writeStartObject();
                jsonGenerator.writeArrayFieldStart("accessControlList");
                for (Grant grant : grants) {
                    jsonGenerator.writeStartObject();
                    jsonGenerator.writeArrayFieldStart("grantee");
                    for (Grantee grantee : grant.getGrantee()) {
                        jsonGenerator.writeStartObject();
                        jsonGenerator.writeStringField("id", grantee.getId());
                        jsonGenerator.writeEndObject();
                    }
                    jsonGenerator.writeEndArray();
                    jsonGenerator.writeArrayFieldStart("permission");
                    for (Permission permission : grant.getPermission()) {
                        jsonGenerator.writeString(permission.toString());
                    }
                    jsonGenerator.writeEndArray();
                    jsonGenerator.writeEndObject();
                }
                jsonGenerator.writeEndArray();
                jsonGenerator.writeEndObject();
                jsonGenerator.close();
            } catch (IOException e) {
                throw new BceClientException("Fail to generate json", e);
            }
            try {
                json = writer.toString().getBytes(DEFAULT_ENCODING);
            } catch (UnsupportedEncodingException e) {
                throw new BceClientException("Fail to get UTF-8 bytes", e);
            }
            internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
            internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
            internalRequest.setContent(RestartableInputStream.wrap(json));
        } else if (request.getJsonAcl() != null) {
            byte[] json = null;
            try {
                json = request.getJsonAcl().getBytes(DEFAULT_ENCODING);
            } catch (UnsupportedEncodingException e) {
                throw new BceClientException("Fail to get UTF-8 bytes", e);
            }

            internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
            internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
            internalRequest.setContent(RestartableInputStream.wrap(json));
        } else {
            checkNotNull(null, "request.acl should not be null.");
        }

        this.invokeHttpClient(internalRequest, BosResponse.class);
    }
412870
public <T> T send(Request<T> request) {

		if (request == null) {
			throw new CommunicationErrorException("Request cannot be null.");
		}
		RequestUtil.validate(request);

		@SuppressWarnings("unchecked")
		T response = (T) dispatchByMethod(request);

		return response;
	}
722777
public static PortalRequest unwrapPortalRequest(HttpServletRequest request) {
        do {
            if (request instanceof PortalRequest) {
                return (PortalRequest) request;
            } else if (request instanceof HttpServletRequestWrapper) {
                request = (HttpServletRequest) ((HttpServletRequestWrapper) request).getRequest();
            } else {
                return null;
            }
        } while (true);
    }
659946
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		if (isMenuPresent(request)) {
			// If current ajax trigger, process menu for current selections
			if (AjaxHelper.isCurrentAjaxTrigger(this)) {
				WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
				menu.handleRequest(request);

				// Execute associated action, if set
				final Action action = getAction();

				if (action != null) {
					final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
							this.getActionObject());

					Runnable later = new Runnable() {
						@Override
						public void run() {
							action.execute(event);
						}
					};

					invokeLater(later);
				}
			}

			boolean openState = "true".equals(request.getParameter(getId() + ".open"));
			setOpen(openState);
		}
	}
719939
@Override
	public void serviceRequest(final Request request) {
		// Get trigger id
		triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME);
		if (triggerId == null) {
			throw new SystemException("No AJAX trigger id to check step count");
		}

		// Get trigger and its context
		ComponentWithContext trigger = AjaxHelper.getCurrentTriggerAndContext();
		if (trigger == null) {
			throw new IllegalStateException(
					"No component/context available for AJAX trigger " + triggerId + ".");
		}

		// Get expected step count
		UIContext uic = UIContextHolder.getCurrent();
		int expected = uic.getEnvironment().getStep();

		// Step should already be set on the session
		if (expected == 0) {
			throw new SystemException(
					"Step count should already be set on the session before AJAX request.");
		}

		// Get step count on the request
		int got = StepCountUtil.getRequestStep(request);

		// Check we are on the current step
		if (expected == got) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else { // Invalid step
			LOG.warn("AJAX: Wrong step detected. Expected step " + expected + " but got step " + got);
			// "GET" Ajax requests are just ignored and return an error code
			if ("GET".equals(request.getMethod())) {
				LOG.warn("Error code will be sent in the response for AJAX GET Request.");
				handleErrorCode();
				// Make sure the render phase is not processed
				throw new ActionEscape();
			} else if (StepCountUtil.isErrorRedirect()) { // Redirect to error page
				LOG.warn("User will be redirected to an error page.");
				redirectUrl = StepCountUtil.getErrorUrl();
			} else {  // Warp to the future by refreshing the page
				LOG.warn("Warp the user back to the future by refreshing the page.");
				handleWarpToTheFuture(uic);
				redirectUrl = buildApplicationUrl(uic);
			}
		}
	}
1134217
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		if (isPresent(request)) {
			List<MenuItemSelectable> selectedItems = new ArrayList<>();
			// Unfortunately, we need to recurse through all the menu/sub-menus
			findSelections(request, this, selectedItems);
			setSelectedMenuItems(selectedItems);
		}
	}
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);
			}
		}
	}
862951
private void handleShuffleState(final Request request) {

		String json = request.getParameter(SHUFFLE_REQUEST_KEY);
		if (Util.empty(json)) {
			return;
		}

		// New
		TreeItemIdNode newTree;
		try {
			newTree = TreeItemUtil.convertJsonToTree(json);
		} catch (Exception e) {
			LOG.warn("Could not parse JSON for shuffle tree items. " + e.getMessage());
			return;
		}

		// Current
		TreeItemIdNode currentTree = getCustomTree();

		boolean changed = !TreeItemUtil.isTreeSame(newTree, currentTree);

		if (changed) {
			setCustomTree(newTree);
			// Run the shuffle action (if set)
			final Action action = getShuffleAction();
			if (action != null) {
				final ActionEvent event = new ActionEvent(this, "shuffle");
				Runnable later = new Runnable() {
					@Override
					public void run() {
						action.execute(event);
					}
				};
				invokeLater(later);
			}
		}
	}
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.");
		}
	}
299779
public CompletableFuture<RestoreResponse> restore(RestoreRequest request) {
    logRequest(request);
    return CompletableFuture.completedFuture(logResponse(RestoreResponse.error()));
  }
182645
public JobResult jobResult(HttpRequestBase request) {
        JobResult jobResult = new JobResult();
        try {
            HttpResponse response = httpClient.execute(request);
            if (response != null) {
                jobResult.responseCode = response.getStatusLine().getStatusCode();
                HttpEntity responseEntity = response.getEntity();
                long contentLength = responseEntity.getContentLength();
                if (contentLength < 0) {
                    contentLength = 0;
                }
                ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) contentLength);
                InputStream in = responseEntity.getContent();
                int read;
                byte[] tmpBuf = new byte[8192];
                while ((read = in.read(tmpBuf)) != -1) {
                    bOut.write(tmpBuf, 0, read);
                }
                in.close();
                bOut.close();
                jobResult.response = bOut.toByteArray();
                switch (jobResult.responseCode) {
                case 200:
                    jobResult.parse(xmlValidator);
                    in = new ByteArrayInputStream(jobResult.response);
                    jobResult.job = Job.unmarshall(in);
                    in.close();
                    jobResult.status = ResultStatus.OK;
                    break;
                case 404:
                    jobResult.status = ResultStatus.NOT_FOUND;
                    break;
                case 500:
                    jobResult.status = ResultStatus.INTERNAL_ERROR;
                    break;
                default:
                    jobResult.status = ResultStatus.NO_RESPONSE;
                    break;
                }
            } else {
                jobResult.status = ResultStatus.NO_RESPONSE;
            }
        } catch (NoHttpResponseException e) {
            jobResult.status = ResultStatus.OFFLINE;
            jobResult.t = e;
        } catch (ClientProtocolException e) {
            jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
            jobResult.t = e;
        } catch (IOException e) {
            jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
            jobResult.t = e;
        } catch (JAXBException e) {
            jobResult.status = ResultStatus.JAXB_EXCEPTION;
            jobResult.t = e;
        } catch (XMLStreamException e) {
            jobResult.status = ResultStatus.XML_EXCEPTION;
            jobResult.t = e;
        }
        return jobResult;
    }
623873
public FetchObjectResponse fetchObject(FetchObjectRequest request) {
        checkNotNull(request, "request should not be null.");
        assertStringNotNullOrEmpty(request.getSourceUrl(), "source should not be null or empty");

        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST);
        internalRequest.addParameter("fetch", null);

        internalRequest.addHeader(Headers.BCE_FETCH_SOURCE, request.getSourceUrl());
        if (request.getMode() != null) {
            internalRequest.addHeader(Headers.BCE_FETCH_MODE, request.getMode());
        }
        if (request.getStorageClass() != null) {
            internalRequest.addHeader(Headers.BCE_STORAGE_CLASS, request.getStorageClass());
        }
        this.setZeroContentLength(internalRequest);

        FetchObjectResponse response = this.invokeHttpClient(internalRequest, FetchObjectResponse.class);
        return response;
    }
563430
public <T extends ApiObject> EntityResponse<T> query(Request<T> request)
    {
        return executeRequest(request, objectMapper.getTypeFactory()
                .constructParametrizedType(EntityResponse.class, EntityResponse.class, request.getEntityType()));
    }
1316291
public RequestFuture<T> setRequest(Request<T> request) {
        this.request = request;
        this.request.addErrorListener(this);
        this.request.addResponseListener(this);
        return this;
    }
670254
@Override
	public void handleRequest(final Request request) {
		super.handleRequest(request);

		WComponent visibleDialog = getVisible();

		if (visibleDialog != null) {
			visibleDialog.serviceRequest(request);
		}
	}