public OAuthParameters readRequest(OAuthRequest request) {

        // read supported parameters from query string or request body (lowest preference)
        for (String param : request.getParameterNames()) {
            if (!param.startsWith("oauth_")) {
                continue;
            }
            List values = request.getParameterValues(param);
            if (values == null) {
                continue;
            }
            Iterator<String> i = values.iterator();
            if (!i.hasNext()) {
                continue;
            }
            put(param, i.next());
        }

        // read all parameters from authorization header (highest preference)
        List<String> headers = request.getHeaderValues(AUTHORIZATION_HEADER);
        if (headers == null) { return this; }

        for (String header : headers) {
            if (!header.regionMatches(true, 0, SCHEME_SPACE, 0, SCHEME_SPACE.length())) {
                continue;
            }
            for (String param : header.substring(SCHEME_SPACE.length()).trim().split(",(?=(?:[^\"]*\"[^\"]*\")+$)")) {
                String[] nv = param.split("=", 2);
                if (nv.length != 2) {
                    continue;
                }
                put(URLCodec.decode(nv[0].trim()), URLCodec.decode(dequote(nv[1].trim())));
            }
        }

        return this;
    }