}
public boolean handle(HttpServletRequest request, HttpServletResponse response)
throws IOException
{
UrlEncodedParameterMap params = new UrlEncodedParameterMap();
int status = parse(request, params);
if(status==200)
{
String consumerKey = params.get(Constants.OAUTH_CONSUMER_KEY);
if(consumerKey==null)
{
response.setStatus(400);
return false;
}
if(_checkTimestamp)
{
try
{
if(System.currentTimeMillis()/1000 < Long.parseLong(params.get(
Constants.OAUTH_TIMESTAMP)))
{
response.setStatus(401);
return false;
}
}
catch(Exception e)
{
response.setStatus(401);
return false;
}
}
String requestToken = params.get(Constants.OAUTH_TOKEN);
return requestToken==null ? handleTokenRequest(params, consumerKey, request, response) :
handleTokenExchange(params, consumerKey, requestToken, request, response);
}
response.setStatus(status);