use of com.github.hakko.musiccabinet.parser.lastfm.AuthSessionParserImpl in project musiccabinet by hakko.
the class LastFmService method identifyLastFmUser.
public LastFmUser identifyLastFmUser(String token) throws ApplicationException {
LOG.debug("identifyLastFmUser(" + token + ")");
WSResponse wsResponse = authSessionClient.getAuthSession(token);
if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
AuthSessionParser authSessionParser = new AuthSessionParserImpl(stringUtil.getInputStream());
return authSessionParser.getLastFmUser();
} else {
LOG.debug("wsResponse: " + wsResponse.getResponseBody());
throw new ApplicationException("Could not get session key for user! (code " + wsResponse.getErrorCode() + ", " + wsResponse.getErrorMessage() + ")");
}
}
Aggregations