public String getParameter(final String parameter) { String value = null; for (final String str : responseStr) { if (str.startsWith(parameter + '=')) { value = InternalStringUtil.split(str, "=")[1].trim(); break; } } return value; }
private void parseGetParameters(final String url, final List<HttpParameter> signatureBaseParams) { final int queryStart = url.indexOf("?"); if (-1 != queryStart) { final String[] queryStrs = InternalStringUtil.split(url.substring(queryStart + 1), "&"); try { for (final String query : queryStrs) { final String[] split = InternalStringUtil.split(query, "="); if (split.length == 2) { signatureBaseParams.add( new HttpParameter( URLDecoder.decode(split[0], "UTF-8"), URLDecoder.decode(split[1], "UTF-8"))); } else { signatureBaseParams.add(new HttpParameter(URLDecoder.decode(split[0], "UTF-8"), "")); } } } catch (final UnsupportedEncodingException ignore) { } } }
OAuthToken(final String string) { responseStr = InternalStringUtil.split(string, "&"); tokenSecret = getParameter("oauth_token_secret"); token = getParameter("oauth_token"); }