Retrieves the value of the step variable from the given request.

@param request the request being responded to.
@return the request step present in the request, or -1 on error.
356515
public static int getRequestStep(final Request request) {
		String val = request.getParameter(Environment.STEP_VARIABLE);

		if (val == null) {
			return 0;
		}
		try {
			return Integer.parseInt(val);
		} catch (NumberFormatException ex) {
			return -1;
		}
	}
640515
public GetSessionResponse getSession(GetSessionRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SESSION,
                request.getSessionId());
        return invokeHttpClient(internalRequest, GetSessionResponse.class);
    }
665822
public String getRequestParams(Request request) {
        StringBuilder params = new StringBuilder();
        if (request != null && request.getUrlParams() != null) {
            params.append("?");
            for (String key : request.getUrlParams().keySet()) {
                params.append(key);
                params.append("=");
                params.append(String.valueOf(request.getUrlParams().get(key)));
                params.append("&");
            }
            params.deleteCharAt(params.length() - 1);
        }
        return params.toString();
    }
946602
public static int getIntParam(final HttpServletRequest request, final String name)
      throws ServletException {
    final String p = getParam(request, name);
    return Integer.parseInt(p);
  }
1174881
@Override
	public void serviceRequest(final Request request) {
		// 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 content request.");
		}

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

		// Check tokens match (both must be provided)
		if (expected == got) {
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else if (!StepCountUtil.isStepOnRequest(request) && StepCountUtil.isCachedContentRequest(request)) {  // cached content (no step on request)
			// Process Service Request
			getBackingComponent().serviceRequest(request);
		} else {  // Invalid token
			// Set an error code
			LOG.warn(
					"Wrong step detected for content request. Expected step [" + expected + "] but got step [" + got
					+ "].");
			handleError();
		}

	}
1228728
private URI getHasMemberFromRequest(final HttpServletRequest request) throws IOException {
        final String baseUri = request.getRequestURL().toString();
        final RDFReader reader;
        final String contentType = request.getContentType();
        final Lang format = contentTypeToLang(contentType);
        final Model inputModel;
        try {
            inputModel = createDefaultModel();
            reader = inputModel.getReader(format.getName().toUpperCase());
            reader.read(inputModel, request.getInputStream(), baseUri);
            final Statement st = inputModel.getProperty(null, MEMBERSHIP_RESOURCE);
            return (st != null ? URI.create(st.getObject().toString()) : null);
        } catch (final RiotException e) {
            throw new BadRequestException("RDF was not parsable: " + e.getMessage(), e);
        } catch (final RuntimeIOException e) {
            if (e.getCause() instanceof JsonParseException) {
                throw new MalformedRdfException(e.getCause());
            }
            throw new RepositoryRuntimeException(e);
        }
    }
433933
public static HttpServletRequest getHttpServletRequest(final Request request)
	{
		final WebRequest webRequest = (WebRequest)request;
		final HttpServletRequest httpServletRequest = (HttpServletRequest)webRequest
			.getContainerRequest();
		return httpServletRequest;
	}
1304187
public String getSessionId(HttpServletRequest request) {
		String sessionId = request.getParameter(ACCESSTOKEN);
		if(isBlank(sessionId)){
			sessionId = request.getHeader(ACCESSTOKEN);
		}
		if(isBlank(sessionId)){
			Cookie[] cookies = request.getCookies();
			if(cookies == null)return null;
			for (Cookie cookie : cookies) {
				if(sessionIdName.equals(cookie.getName())){
					sessionId = cookie.getValue();
					break;
				}
			}
		}
		return sessionId;
	}
583528
protected function receiveStepsFieldValueFromRequest()
    {
        $value = Doozr_Form_Service_Constant::DEFAULT_STEP_LAST;

        $requestQueryParameter = $this->getRequest()->getQueryParams();
        $requestBody           = $this->getRequest()->getParsedBody();
        $fieldname             = $this->getFieldnameSteps();

        if (true === isset($requestQueryParameter[$fieldname])) {
            $value = $requestQueryParameter[$fieldname];
        } elseif (true === isset($requestBody[$fieldname])) {
            $value = $requestBody[$fieldname];
        }

        return $value;
    }
724681
public static String findRouteOrRequestUriTransport(Request request) {
		RouteHeader route = (RouteHeader) request.getHeader(RouteHeader.NAME);
		if(route != null) {
			URI uri = route.getAddress().getURI();
			return findURITransport(uri, request.getContentLength().getContentLength());
		}
		URI ruri = request.getRequestURI();
		return findURITransport(ruri, request.getContentLength().getContentLength());
	}
103766
public static String getParameter(final HttpServletRequest request, final String name) {
		String value = request.getParameter(name);
		if (value == null) {
			return "";
		}
		return value;
	}
713922
public GetInstanceResponse getInstance(GetInstanceRequest request) {
        checkNotNull(request, "request should not be null.");
        checkNotNull(request.getInstanceId(), "request instanceId should not be null.");
        InternalRequest internalRequest = this.createRequest(
                request, HttpMethodName.GET, INSTANCE_PREFIX, request.getInstanceId());
        return this.invokeHttpClient(internalRequest, GetInstanceResponse.class);
    }
166327
public static String getParameter(final Request request, final String parameterName)
	{
		String parameterValue = request.getRequestParameters().getParameterValue(parameterName)
			.toString();
		if ((parameterValue == null) || parameterValue.isEmpty())
		{
			parameterValue = request.getPostParameters().getParameterValue(parameterName)
				.toString();
		}
		if ((parameterValue == null) || parameterValue.isEmpty())
		{
			parameterValue = request.getQueryParameters().getParameterValue(parameterName)
				.toString();
		}
		if ((parameterValue == null) || parameterValue.isEmpty())
		{
			parameterValue = request.getRequestParameters().getParameterValue(parameterName)
				.toString();
		}
		return parameterValue;
	}
504714
public static String getError(final HttpServletRequest request) {
		StringBuilder sb = (StringBuilder) request.getAttribute(ERROR_KEY);
		if (sb == null) {
			return "";
		}
		return sb.toString();
	}
145711
public int getIntParam(final HttpServletRequest request, final String name)
      throws ServletException {
    return HttpRequestUtils.getIntParam(request, name);
  }
343322
public String getEndUserAuthorizationRequestUri(final HttpServletRequest request) {

		OAuthClientRequest oauthClientRequest;

		try {

			oauthClientRequest = OAuthClientRequest
				.authorizationLocation(authorizationLocation)
				.setClientId(clientId)
				.setRedirectURI(getAbsoluteUrl(request, redirectUri))
				.setScope(getScope())
				.setResponseType(getResponseType())
				.setState(getState())
				.buildQueryMessage();

			logger.info("Authorization request location URI: {}", oauthClientRequest.getLocationUri());

			return oauthClientRequest.getLocationUri();

		} catch (OAuthSystemException ex) {
			logger.error("", ex);
		}

		return null;

	}
920433
protected String getUsernameParameterFromRequest(final HttpServletRequest request) {
        return request.getParameter(StringUtils.defaultString(configurationContext.getUsernameParameter(), "username"));
    }