public JsonValue handleCallbacks(HttpServletRequest request,HttpServletResponse response,Callback[] callbacks) throws RestAuthException {
  List<Object> jsonCallbacks=new ArrayList<>();
  int callbackIndex=0;
  boolean handledInternally=handleCallbacksInternally(request,response,callbacks);
  if (!handledInternally) {
    logger.message("Cannot handle callbacks internally. Converting to JSON instead.");
    for (    Callback callback : callbacks) {
      callbackIndex++;
      RestAuthCallbackHandler restAuthCallbackHandler=restAuthCallbackHandlerFactory.getRestAuthCallbackHandler(callback.getClass());
      JsonValue jsonCallback=restAuthCallbackHandler.convertToJson(callback,callbackIndex);
      jsonCallbacks.add(jsonCallback.getObject());
    }
  }
  return new JsonValue(jsonCallbacks);
}

public JsonValue handleCallbacks ( HttpServletRequest request , HttpServletResponse response , Callback [ ] callbacks ) throws RestAuthException { List < Object > jsonCallbacks = new ArrayList < > ( ) ; int callbackIndex = 0 ; boolean handledInternally = handleCallbacksInternally ( request , response , callbacks ) ; if ( ! handledInternally ) { logger . message ( "Cannot handle callbacks internally. Converting to JSON instead." ) ; for ( Callback callback : callbacks ) { callbackIndex ++ ; RestAuthCallbackHandler restAuthCallbackHandler = restAuthCallbackHandlerFactory . getRestAuthCallbackHandler ( callback . getClass ( ) ) ; JsonValue jsonCallback = restAuthCallbackHandler . convertToJson ( callback , callbackIndex ) ; jsonCallbacks . add ( jsonCallback . getObject ( ) ) ; } } return new JsonValue ( jsonCallbacks ) ; }
handles callbacks by either updating them with their required values from the headers and request or converting them to json representations to be sent back to the client .
