public OAuthParams.OAuthParamsBuilder parseRequest(Request request, List<KeyValueHandler> kvHandlers) { // use an oAuthParamsBuilder instance to accumulate key/values from // the query string, the request body (if the appropriate Content-Type), // and the Authorization header, if any. OAuthParams.OAuthParamsBuilder oAuthParamsBuilder = new OAuthParams.OAuthParamsBuilder(helper); // parse the header, if present parseHeader(request.authHeader(), oAuthParamsBuilder.headerHandler); // If it is an oAuth2 we do not need to process any further if (!oAuthParamsBuilder.isOAuth2()) { // add our handlers to the passed-in handlers, to which // we'll only send non-oauth key/values. ArrayList<KeyValueHandler> queryHandlers = new ArrayList<KeyValueHandler>(kvHandlers.size() + 1); queryHandlers.add(queryParamKeyValueHandler(oAuthParamsBuilder.queryHandler)); queryHandlers.addAll(kvHandlers); ArrayList<KeyValueHandler> bodyParamHandlers = new ArrayList<KeyValueHandler>(kvHandlers.size() + 1); bodyParamHandlers.add(bodyParamKeyValueHandler(oAuthParamsBuilder.queryHandler)); bodyParamHandlers.addAll(kvHandlers); // parse the GET query string queryParser.parse(request.queryString(), queryHandlers); // parse the request body if the Content-Type is appropriate. Use the // same set of KeyValueHandlers that we used to parse the query string. if (request.contentType() != null && request.contentType().startsWith(WWW_FORM_URLENCODED)) { queryParser.parse(request.body(), bodyParamHandlers); } } // now we just return the accumulated parameters and OAuthParams return oAuthParamsBuilder; }