@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
OAuth2Message requestMessage = null;
try{
requestMessage = OAuth2Servlet.getMessage(request, null);
OAuth2Client client = SampleOAuth2Provider.getClient(requestMessage);
SampleOAuth2Provider.VALIDATOR.validateRequestMessageForAuthorization(requestMessage,client);
sendToAuthorizePage(request, response, client);
} catch (Exception e){
Boolean sendBodyInJson = false;
Boolean withAuthHeader = false;
if (e instanceof OAuth2ProblemException){
OAuth2ProblemException problem = (OAuth2ProblemException) e;
problem.setParameter(OAuth2.REDIRECT_URI,OAuth2.decodePercent(requestMessage.getParameter(OAuth2.REDIRECT_URI)));
problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(302));
/* it can be removed at here */
if(requestMessage.getParameter(OAuth2.STATE)!=null){
problem.setParameter(OAuth2.STATE, requestMessage.getParameter(OAuth2.STATE));
}
}
SampleOAuth2Provider.handleException(e, request, response, sendBodyInJson, withAuthHeader);
}