private String getClusterName(String token){
      int pos = token.indexOf('?');
      if(pos > 0) { //cluster name requires to have at least one alphanumeric letter
        return token.substring(0, pos);
      } else {
        return token;
      }
    }
Get cluster name
Remove query paramter string if there is any

@param token
@return String
ambari-server/src/main/java/org/apache/ambari/server/api/resources/RequestResourceDefinition.java