class RouterWebServices implements RMWebServiceProtocol {

  @VisibleForTesting
  protected RESTRequestInterceptor createRequestInterceptorChain() {

    List<String> interceptorClassNames = getInterceptorClassNames(conf);

    RESTRequestInterceptor pipeline = null;
    RESTRequestInterceptor current = null;
    for (String interceptorClassName : interceptorClassNames) {
      try {
        Class<?> interceptorClass = conf.getClassByName(interceptorClassName);
        if (RESTRequestInterceptor.class.isAssignableFrom(interceptorClass)) {
          RESTRequestInterceptor interceptorInstance =
              (RESTRequestInterceptor) ReflectionUtils
                  .newInstance(interceptorClass, conf);
          if (pipeline == null) {
            pipeline = interceptorInstance;
            current = interceptorInstance;
            continue;
          } else {
            current.setNextInterceptor(interceptorInstance);
            current = interceptorInstance;
          }
        } else {
          throw new YarnRuntimeException(
              "Class: " + interceptorClassName + " not instance of "
                  + RESTRequestInterceptor.class.getCanonicalName());
        }
      } catch (ClassNotFoundException e) {
        throw new YarnRuntimeException(
            "Could not instantiate RESTRequestInterceptor: "
                + interceptorClassName,
            e);
      }
    }

    if (pipeline == null) {
      throw new YarnRuntimeException(
          "RequestInterceptor pipeline is not configured in the system");
    }
    return pipeline;
  }

  @Inject public  RouterWebServices(final Router router, Configuration conf);

}