Given a request, returns the name of the target App.

Example:
Call to 34.23.34.54:3000/api-2
Will return 'api-2'

@param req The request to be analysed
@returns {string|null} The name of the app, or null if not found.
355270
function reqToAppName(req) {
  var targetName = null;
  try {
    targetName = req.url.split('/').pop();
  } catch (e) {}
  return targetName || null;
}
1364176
function guessAppName (compilerWorkingDirectory) {
  var packageJson = path.resolve(compilerWorkingDirectory, 'package.json');
  if (!fs.existsSync(packageJson)) {
    packageJson = path.resolve(compilerWorkingDirectory, '../package.json');
    if (!fs.existsSync(packageJson)) {
      return 'Webpack App';
    }
  }
  return JSON.parse(fs.readFileSync(packageJson)).name;
}
142276
function(callback)
    {
        var params = util.extend({count:1}, this.params);        
        this.api.doRequest("GET", this.path, params, function(err, res) {
            if (err)
            {
                return callback(err);
            }                    
            callback(null, res.count);
        });
    }
593657
function getType(key, req) {
  var val = this.getKey(key, req);
  if(val === undefined) return undefined;
  return val.rtype || TYPE_NAMES.STRING;
}
962709
private static String lookupStorageServiceByApp(RESTClient restClient, String applicationName) {
        Utils.require(applicationName != null, "Missing application name");
        if (applicationName != null) {
            ApplicationDefinition appDef =  Command.getAppDef(restClient, applicationName);
            Utils.require(appDef != null, "Unknown application: %s", applicationName);
            return appDef.getStorageService();
        }
        return null;
    }
93103
protected String getSelectedDashboard(HttpServletRequest req) throws APIException{
		String dashboardName = req.getParameter("dashboard");
		if (dashboardName!=null)
			return dashboardName;
		return getDashboardAPI().getDefaultDashboardName();
	}
306780
private String getUrlPrefix( HttpServletRequest req )
    {
        StringBuilder url = new StringBuilder();
        String scheme = req.getScheme();
        int port = req.getServerPort();
        url.append( scheme );        // http, https
        url.append( "://" );
        url.append( req.getServerName() );
        if ( ( scheme.equals( "http" ) && port != 80 ) || ( scheme.equals( "https" ) && port != 443 ) )
        {
            url.append( ':' );
            url.append( req.getServerPort() );
        }
        return url.toString();
    }
883149
function getname(req, res) {
  res.send(null, req.conn.client.name);
}
295988
def detect_appname(target)
      return "app.rb" if File.exist?(File.join(self.target, "app.rb"))
      return "application.rb" if File.exist?(File.join(self.target, "application.rb"))
      file_array = Dir.glob(File.join("#{target}", "*.rb"))
      return file_array[0] if ! file_array.nil? and file_array.count == 1
      return "" # gracefully failure
    end
913534
public String getBrowser(HttpServletRequest req)
    {
        String strAgent = req.getHeader("user-agent");
        if (strAgent == null)
            return OTHER;
        strAgent = strAgent.toUpperCase();
        for (int i = 0; i < BROWSER.length; i++)
        {
            if (strAgent.indexOf(BROWSER[i][1]) != -1)
                return BROWSER[i][0];
        }
        return OTHER;
    }
447266
public static String getSessionID(HttpServletRequest req) {
        String sessionID = null;
        final HttpServletRequest f_req = req;

        try {
            sessionID = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
                @Override
                public String run() throws Exception {
                    HttpSession session = f_req.getSession();
                    if (session != null) {
                        return session.getId();
                    } else {
                        return null;
                    }
                }
            });
        } catch (PrivilegedActionException e) {
            if ((e.getException()) instanceof com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException) {
                if (!req.isRequestedSessionIdFromCookie()) {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getSession().getId();
                        }
                    });
                } else {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getRequestedSessionId();
                        }
                    });
                }

            }
        } catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException e) {
            try {
                if (!req.isRequestedSessionIdFromCookie()) {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getSession().getId();
                        }
                    });
                } else {
                    sessionID = AccessController.doPrivileged(new PrivilegedAction<String>() {
                        @Override
                        public String run() {
                            return f_req.getRequestedSessionId();
                        }
                    });
                }

            } catch (java.lang.NullPointerException ee) {
                sessionID = "UnauthorizedSessionRequest";
            } catch (com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException ue) {
                sessionID = "UnauthorizedSessionRequest";
            }

        }
        return sessionID;
    }
247903
function(url) {
		var query = getQueryString(url);
		for (var name in query) {
			if (query[name] === '?') {
				return name;
			}
		}
		return null;
	}
137341
protected String getAppName() {
        if (appName == null && FrameworkUtil.isInitialized()) {
            setAppName(FrameworkUtil.getAppName());
        }
        
        return appName;
    }
1055159
public String getApplicationName()
    {
        return ivApplicationDisplayName != null ? ivApplicationDisplayName :
                        ivJ2eeName != null ? ivJ2eeName.getApplication() : null;
    }
417069
public static String getAppName() {
		String appName=System.getProperty(JKContextConstants.JK_APP_NAME);
		if (appName == null) {
			String mainClassName = JKDebugUtil.getMainClassName();
			return mainClassName.substring(0, mainClassName.lastIndexOf("."));
		}
		return appName;
	}
1230963
function viewAppByName(appName, callback, success) {
  jitsu.apps.view(appName, function (err, app) {
    return err ? callback(err) : success(null, app);
  });
}
458735
function app(bidderRequest) {
  const pubId = bidderRequest && bidderRequest.length > 0 ? bidderRequest[0].params.cp : '0';
  const appParams = bidderRequest[0].params.app;
  if (appParams) {
    return {
      publisher: {
        id: pubId.toString(),
      },
      bundle: appParams.bundle,
      storeurl: appParams.storeUrl,
      domain: appParams.domain,
    }
  }
  return null;
}