Not intended as a public API
427187
protected static String replaceStaticString(String key) {
    String replacementString = "";
    try {
      InetAddress addr = InetAddress.getLocalHost();
      String lkey = key.toLowerCase();
      if(lkey.equals("localhost")) {

        replacementString = addr.getHostName();
      }
      else if(lkey.equals("ip")) {
          replacementString = addr.getHostAddress();
      }
      else if(lkey.equals("fqdn")) {

          replacementString = addr.getCanonicalHostName();
      }
      else {
          throw new RuntimeException("The static escape string '" + key + "'"
                  + " was provided but does not match any of (localhost,IP,FQDN)");
      }
    } catch (UnknownHostException e) {
      throw new RuntimeException("Flume wasn't able to parse the static escape "
              + " sequence '" + key + "' due to UnkownHostException.", e);
    }
    return replacementString;
  }
424083
def _wrap_public_method(self, attr):
        
        def wrapper(*args, **kwargs):
            return getattr(self.connection, attr)(*args, **kwargs)
        return wrapper
1042733
private ObjectNode makeRequest(final String api, final JsiiObjectRef objRef) {
        ObjectNode req = makeRequest(api);
        req.set("objref", objRef.toJson());
        return req;
    }
1372821
function Api(spec, options) {
  if (!(this instanceof Api)) {
    return new Api(spec, options);
  }

  if (typeof spec !== 'object') {
    throw new Error('api spec must be an object');
  }

  options = options || {};

  // path alias for both resourcePath and doc path
  if (spec.path) {
    if (!spec.resourcePath) spec.resourcePath = spec.path;
    if (!options.path) options.path = spec.path;
    delete spec.path;
  }

  // allow user to pass description in spec
  if (spec.description) {
    if (!options.description) options.description = spec.description;
    delete spec.description;
  }

  // user resourcePath for doc path if not set
  if (!options.path && spec.resourcePath) {
    options.path = spec.resourcePath;
  }

  debug('create api %s', spec.resourcePath, spec);

  this.env = new Environment();

  this.spec = spec;
  this.list = [];
  this.options = options;

  this.middleware = {};
  this.models = {};
  this.nicknames = {};
  this.resources = {};
}
901007
def http_method_not_allowed(self, *args, **kwargs):
        
        resp = super(JsonResponseMixin, self).http_method_not_allowed(*args, **kwargs)
        resp['Content-Type'] = 'application/json'

        return resp
312791
def _include_public_methods(self, connection):
        
        for attr in dir(connection):
            value = getattr(connection, attr)
            if attr.startswith('_') or not callable(value):
                continue
            self.__dict__[attr] = self._wrap_public_method(attr)
614055
function expose(obj, namespace, name) {

  var app = this.app || this;
  var req = this.req;

  app._exposed = app._exposed || {};

  // support second arg as name
  // when a string or function is given
  if ('string' === typeof obj || 'function' === typeof obj) {
    name = namespace || _name;
  } else {
    name = name || _name;
    namespace = namespace || _namespace;
  }

  // buffer string
  if ('string' === typeof obj) {
    this.js = this.js || {};
    var buf = this.js[name] = this.js[name] || [];
    buf.push(obj);
  // buffer function
  } else if ('function' === typeof obj && obj.name) {
    this.expose(obj.toString(), name);
  // buffer self-calling function
  } else if ('function' === typeof obj) {
    this.expose(';(' + obj + ')();', name);
  // buffer object
  } else {
    this.expose(renderNamespace(namespace), name);
    this.expose(renderObject(obj, namespace), name);
    this.expose('\n');
  }

  // locals
  function locals(req, res) {

    var appjs = app.exposed(name);
    var resjs = res.exposed(name);
    var js = '';

    if (appjs || resjs) {
      js += '// app: \n' + appjs;
      js += '// res: \n' + resjs;
    }

    res.locals[name] = js;

  }


  // app level locals
  if (!req && !app._exposed[name]) {
    app._exposed[name] = true;
    app.use(function(req, res, next){
      locals(req, res);
      next();
    });
  // request level locals
  } else if (req) {
    locals(req, this);
  }

  return this;
}
363617
function toText (obj) {
  if (obj instanceof Error) {
    return {
      isJSON: false,
      text: obj.message + "\n\n" + obj.stack
    };
  }
  else {
    try {
      return {
        isJSON: true,
        text: JSON.stringify(obj, null, 2)
      };
    }
    catch (e) {
      return {
        isJSON: false,
        text: "This API is valid, but it cannot be shown because it contains circular references\n\n" + e.stack
      };
    }
  }
}
917478
def public_set(option, value)
      # TODO Prevent subconfigs here
      method = "#{option}="
      respond_to?(method) ? send(method, value) : raw_set(option, value)
    end
444387
function toQuery(json, noEncode) {
    var errorMsg = 'You should not be converting nested objects as they wont encode properly. Try making it a string first.';
    var result = [];
    for (var key in json) {
      if (Object.prototype.toString.call(json[key]) === '[object Object]') {
        throw new Error(errorMsg);
      }
      if (noEncode) {
        result.push(key + '=' + json[key]);
      } else {
        result.push(encodeURIComponent(key) + '=' + encodeURIComponent(json[key]));
      }
    }
    return result.join('&');
  }
230171
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException
    {
        setContextPath((String)in.readObject());
        setVirtualHosts((String[])in.readObject());
        Object o= in.readObject();

        while (o instanceof HttpHandler)
        {
            addHandler((HttpHandler)o);
            o= in.readObject();
        }
        setAttributes((Map)o);
        setRedirectNullPath(in.readBoolean());
        setMaxCachedFileSize(in.readInt());
        setMaxCacheSize(in.readInt());
        setStatsOn(in.readBoolean());
        setPermissions((PermissionCollection)in.readObject());
        setClassLoaderJava2Compliant(in.readBoolean());

        _defaultsDescriptor= (String)in.readObject();
        _war= (String)in.readObject();
        _extract= in.readBoolean();
        _ignorewebjetty= in.readBoolean();
        _distributable= in.readBoolean();
        _configurationClassNames=(String[])in.readObject();
    }
131730
function Tineye (public, private) {
    var self = this;

    // Defaults
    self.public     = public;
    self.private    = private;
    self.defaults   = {
        base:       'http://api.tineye.com/rest',
        throttle:   2000,
        method:     'get',
        json:       {}
    };

    // Run in sandbox mode if no public/private keys are provided
    // https://api.tineye.com/documentation/sandbox
    if (typeof public === 'undefined' && typeof private === 'undefined') {
        self.public         = 'LCkn,2K7osVwkX95K4Oy';
        self.private        = '6mm60lsCNIB,FwOWjJqA80QZHh9BMwc-ber4u=t^';
        self.defaults.base  = 'http://api.tineye.com/sandbox';
    }

    /**
     * Register the tineye API with cork.
     */
    cork.register('tineye', self.defaults);

    /**
     * Request "signer".
     *
     * @param {Object} Request arguments.
     *
     * @return {Object}
     */
    self.sign = function (args) {
        _.extend(args, self.defaults);

        var epoch   = getEpoch();
        var nonce   = getNonce();

        var concat  = self.private;                     // Private key
        concat      += args.method.toUpperCase();       // HTTP method
        concat      += '';                              // Content-type
        concat      += '';                              // Uploaded image name
        concat      += epoch;                           // Date
        concat      += nonce;                           // Nonce
        concat      += self.defaults.base + args.uri;   // Request url

        // Query string params
        if (typeof args.qs !== 'undefined') {
            var append = encodeURIComponent(args.qs.image_url);
            concat += 'image_url=' + append;
        }

        // Return object to be appended to the query string
        return {
            'api_key':  self.public,
            'api_sig':  hmac(concat, self.private),
            'nonce':    nonce,
            'date':     epoch
        };
    };

    /**
     * Request adapter.
     *
     * @param {Object} HTTP request arguments
     *
     * @return {Object}
     */
    self.request = function (args, callback) {
        // Generate signature & request body
        var signature   = self.sign(args);
        var qs          = args.qs || Object.create(null);
        var body        = _.extend(args, {
            qs: signature
        });

        if (typeof qs.image_url !== 'undefined') {
            body.uri += '?image_url=' + encodeURIComponent(qs.image_url);
        }

        // Init request
        cork.request('tineye', body, callback);
    };
}
125410
def public(self):
        
        req = self.request(self.mist_client.uri+'/keys/'+self.id+"/public")
        public = req.get().json()
        return public
38676
private void makeAccessible(List<AccessibleObject> nonPublicAccessibleObjects) {

    if (nonPublicAccessibleObjects.size() > 0) {
      final AccessibleObject[] nonPublicAccessibles = new AccessibleObject[nonPublicAccessibleObjects.size()];
      nonPublicAccessibleObjects.toArray(nonPublicAccessibles);
      // enable reflective access that violates visibility - this will
      // fail if disallowed by security-manager.
      AccessController.doPrivileged(new PrivilegedAction<Object>() {

        @Override
        public Object run() {

          AccessibleObject.setAccessible(nonPublicAccessibles, true);
          return null;
        }
      });
    }
  }
1091726
function(apiType, data) {
            var arg = (data) ? data : {};
            var collection = null;

            if (!apiType) {
              apiType = paginationAPIType.github;
            }
            if (apiType === paginationAPIType.github) {
              collection = new paginatedCollection(arg);
              collection.setPaginationConfiguration({
                currentPageParam: "page",
                pageSizeParam: "per_page"
              });
            } else if (apiType === paginationAPIType.solr) {
              collection = new paginatedCollection(arg);
              collection.setPaginationConfiguration({
                currentPageParam: "start",
                pageSizeParam: "rows"
              });
            } else if (apiType === paginationAPIType.database) {
              collection = new paginatedCollection(arg);
              collection.setPaginationConfiguration({
                currentPageParam: "offset",
                pageSizeParam: "limit"
              });
            }
            return collection;
          }
1356988
function(api) {
        if( ! _.isObject(api) )
            throw new Error('utils.handler.buildResourceTable needs an espressojs API');

        api._resources = _( api._ids ).values().reject( _.isUndefined ).value();
    }
1192276
function(api, id, obj) {
  if(!api) {
    throw new Error('WebStorage not available.');
  }

  var rval;
  if(obj === null) {
    rval = api.removeItem(id);
  } else {
    // json-encode and base64-encode object
    obj = util.encode64(JSON.stringify(obj));
    rval = api.setItem(id, obj);
  }

  // handle potential flash error
  if(typeof(rval) !== 'undefined' && rval.rval !== true) {
    throw rval.error;
  }
}