* @param oauthParams The oath parameters used to build the appropriate uri.
* @throws OAuthException Throw if there is an error build the request or if there is a problem sending the redirect.
*/
public static void redirectToOAuthProvider(HttpServletRequest req, HttpServletResponse resp, OAuthParams oauthParams) throws OAuthException {
try {
AuthenticationRequestBuilder requestBuilder = OAuthClientRequest.authorizationProvider(oauthParams.getProviderType()).setClientId(oauthParams.getClientKey()).setRedirectURI(oauthParams.getRedirectURI()).setResponseType(oauthParams.getResponseType()).setScope(oauthParams.getScope()).setState(oauthParams.getState());
oauthParams.addAdditionsParams(requestBuilder);
OAuthClientRequest request = requestBuilder.buildQueryMessage();
resp.sendRedirect(request.getLocationUri());
} catch (OAuthSystemException e) {
// Error building request
throw new OAuthException(e);
} catch (IOException e) {