request.setReserveName(name);
request.setContactPhone(phone);
request.setHour(hour);
Token requestToken = manager.getRequestToken(callback, request);
if (requestToken == null) {
return redirectToFailureHandler(NO_OAUTH_REQUEST_TOKEN);
}
request.setRequestToken(requestToken);
String userName = sc.getUserPrincipal().getName();
synchronized (requests) {
Map<String, ReservationRequest> userRequests = requests.get(userName);
if (userRequests == null) {
userRequests = new HashMap<String, ReservationRequest>();
requests.put(userName, userRequests);
}
userRequests.put(requestToken.getToken(), request);
}
LOG.info("Persisting the reservation details and redirecting"
+ " the current user to OAuth Authorization endpoint");
// Create a request token request and redirect
return Response.seeOther(manager.getAuthorizationServiceURI(requestToken.getToken())).build();
}