@SuppressWarnings("unchecked") private void registerRoute(Buffer buffer){
  JsonObject storageObject=new JsonObject(buffer.toString());
  String requestUrl=storageObject.getString(REQUESTURL);
  String routedUrl=getRoutedUrlSegment(requestUrl);
  log.debug("Register route to  " + routedUrl);
  JsonObject jsonHook=storageObject.getJsonObject(HOOK);
  JsonArray jsonMethods=jsonHook.getJsonArray("methods");
  HttpHook hook=new HttpHook(jsonHook.getString("destination"));
  if (jsonMethods != null) {
    hook.setMethods(jsonMethods.getList());
  }
  if (jsonHook.getInteger(EXPIRE_AFTER) != null) {
    hook.setExpireAfter(jsonHook.getInteger(EXPIRE_AFTER));
  }
 else {
    hook.setExpireAfter(DEFAULT_HOOK_LISTENERS_EXPIRE_AFTER_TIME);
  }
  if (jsonHook.getInteger(QUEUE_EXPIRE_AFTER) != null) {
    hook.setQueueExpireAfter(jsonHook.getInteger(QUEUE_EXPIRE_AFTER));
  }
  extractAndAddStaticHeadersToHook(jsonHook,hook);
  String expirationTimeExpression=storageObject.getString(EXPIRATION_TIME);
  if (expirationTimeExpression != null) {
    try {
      hook.setExpirationTime(ExpiryCheckHandler.parseDateTime(expirationTimeExpression));
    }
 catch (    Exception e) {
      log.warn("Route " + routedUrl + " has an invalid expiration time "+ expirationTimeExpression+ " and will not be registred!");
      return;
    }
  }
 else {
    log.warn("Route " + routedUrl + " has no expiration time and will not be registred!");
    return;
  }
  boolean fullUrl=storageObject.getBoolean(FULL_URL,false);
  hook.setFullUrl(fullUrl);
  routeRepository.addRoute(routedUrl,createRoute(routedUrl,hook));
}

@ SuppressWarnings ( "unchecked" ) private void registerRoute ( Buffer buffer ) { JsonObject storageObject = new JsonObject ( buffer . toString ( ) ) ; String requestUrl = storageObject . getString ( REQUESTURL ) ; String routedUrl = getRoutedUrlSegment ( requestUrl ) ; log . debug ( "Register route to  " + routedUrl ) ; JsonObject jsonHook = storageObject . getJsonObject ( HOOK ) ; JsonArray jsonMethods = jsonHook . getJsonArray ( "methods" ) ; HttpHook hook = new HttpHook ( jsonHook . getString ( "destination" ) ) ; if ( jsonMethods != null ) { hook . setMethods ( jsonMethods . getList ( ) ) ; } if ( jsonHook . getInteger ( EXPIRE_AFTER ) != null ) { hook . setExpireAfter ( jsonHook . getInteger ( EXPIRE_AFTER ) ) ; } else { hook . setExpireAfter ( DEFAULT_HOOK_LISTENERS_EXPIRE_AFTER_TIME ) ; } if ( jsonHook . getInteger ( QUEUE_EXPIRE_AFTER ) != null ) { hook . setQueueExpireAfter ( jsonHook . getInteger ( QUEUE_EXPIRE_AFTER ) ) ; } extractAndAddStaticHeadersToHook ( jsonHook , hook ) ; String expirationTimeExpression = storageObject . getString ( EXPIRATION_TIME ) ; if ( expirationTimeExpression != null ) { try { hook . setExpirationTime ( ExpiryCheckHandler . parseDateTime ( expirationTimeExpression ) ) ; } catch ( Exception e ) { log . warn ( "Route " + routedUrl + " has an invalid expiration time " + expirationTimeExpression + " and will not be registred!" ) ; return ; } } else { log . warn ( "Route " + routedUrl + " has no expiration time and will not be registred!" ) ; return ; } boolean fullUrl = storageObject . getBoolean ( FULL_URL , false ) ; hook . setFullUrl ( fullUrl ) ; routeRepository . addRoute ( routedUrl , createRoute ( routedUrl , hook ) ) ; }
registers or updates an already existing route and creates the necessary forwarder depending on the hook resource .
