Assembles the request path from root and path to authorization endpoint and sends the request.

@param path    Path to authorization endpoint
@param options BaseRequest options
@throws IOException
@throws JSONException
519948
public void sendRequest(String path, RequestOptions options) throws IOException, JSONException {
        String rootUrl;

        if (path == null) {
            throw new IllegalArgumentException("'path' parameter can't be null.");
        }

        if (path.indexOf(BMSClient.HTTP_SCHEME) == 0 && path.contains(":")) {
            // request using full path, split the URL to root and path
            URL url = new URL(path);
            path = url.getPath();
            rootUrl = url.toString().replace(path, "");
        } else {
            String MCATenantId = MCAAuthorizationManager.getInstance().getTenantId();
            if(MCATenantId == null){
                MCATenantId = BMSClient.getInstance().getBluemixAppGUID();
            }
            String bluemixRegionSuffix = MCAAuthorizationManager.getInstance().getBluemixRegionSuffix();
            if(bluemixRegionSuffix == null){
                bluemixRegionSuffix = BMSClient.getInstance().getBluemixRegionSuffix();
            }
            // "path" is a relative
			String serverHost = BMSClient.getInstance().getDefaultProtocol()
							+ "://"
							+ AUTH_SERVER_NAME
							+ bluemixRegionSuffix;

			if (overrideServerHost!=null)
				serverHost = overrideServerHost;

            rootUrl = serverHost
                    + "/"
                    + AUTH_SERVER_NAME
                    + "/"
                    + AUTH_PATH
                    + MCATenantId;
        }

        sendRequestInternal(rootUrl, path, options);
    }
699186
@Override
    public void setRootUri(String rootUri) {
        this.jsonHttpClient.setRootUri(rootUri);
        this.streamOpsgenieHttpClient.setRootUri(rootUri);
        this.restApiClient.setRootUrl(rootUri);
        this.swaggerApiClient.setBasePath(rootUri);
    }
222089
public void toFile(Path path, OpenOption... options) throws IOException {
        Files.write(path, pBytes, options);

    }
1119946
public ResolvedRequest withPath( String path ) {
        assert repositoryName != null;
        assert workspaceName != null;
        return new ResolvedRequest(request, repositoryName, workspaceName, path);
    }
824771
public String post(final String path, final byte[] jsonBytes) throws IOException, HttpException {
		return post(path, jsonBytes, false);
	}
273115
public Resource addPath(String path)
        throws IOException,MalformedURLException
    {
        if (path==null)
            return null;

        path = URI.canonicalPath(path);

        return newResource(URI.addPaths(_url.toExternalForm(),path));
    }
864834
@Override
    public void setPath ( String path ) {
        if ( path.length() > 0 && path.charAt(0) == '\\' ) {
            path = path.substring(1);
        }
        // win8.1 returns ACCESS_DENIED if the trailing backslash is included
        if ( path.length() > 1 && path.charAt(path.length() - 1) == '\\' ) {
            path = path.substring(0, path.length() - 1);
        }
        this.name = path;
    }
1201453
public static void addFolder(Path p, JsonArray succeeded, JsonArray failed) throws IOException {
    FileSystem fs = FileSystem.get(p.toUri(), PersistHdfs.CONF);
    if(!fs.exists(p)){
      JsonObject o = new JsonObject();
      o.addProperty(Constants.FILE, p.toString());
      o.addProperty(Constants.ERROR, "Path does not exist!");
      failed.add(o);
      return;
    }
    addFolder(fs, p, succeeded, failed);
  }
1366800
public Response put(String path) throws IOException, RESTException {
        return put(path, null, null);
    }
971443
public JSONObject put(String path, Map<String, Object> params) throws APIError {
        return request(Verb.PUT, path, params);
    }
1052042
void createDirectory(Path path) throws IOException {
		if (Files.exists(path) && Files.isDirectory(path)) {
			return;
		}

		if (this.readOnly) {
			throw new FileNotFoundException(
					"The requested directory \""
							+ path.toString()
							+ "\" does not exist and we are in read-only mode, so it cannot be created.");
		}

		Files.createDirectory(path);
	}
280946
public static void ensureDirectoryExists(final Path path) throws IOException {
        if (Files.exists(path)) {
            if (!Files.isDirectory(path)) {
                throw new IOException("path is not a directory: " + path);
            }
            // probably should fsync parent here just to be sure, but that might slow stuff down
        } else {
            Files.createDirectories(path);
            fsyncLineage(path.getParent());
        }
    }
1230346
@POST
    public JSONObject post(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException {
        throw new ServiceException(ServiceException.NOT_ALLOWED, "POST not implemented");
    }
709855
def request(self, request_path, data=None, do_authentication=True, is_json=True):
        
        uri = self.api_uri % request_path
        request = urllib2.Request(uri)

        # Build up the request
        if is_json:
            request.add_header("Content-Type", "application/json")
            if data is not None:
                request.add_data(json.dumps(data))
        elif data is not None:
            request.add_data(data)

        if do_authentication:
            if self.client_id is None or self.client_secret is None:
                raise Exception(u"You need to supply a client_id and client_secret to perform an authenticated request")
            basic_auth = base64.b64encode("%s:%s" % (self.client_id, self.client_secret))
            request.add_header("Authorization", "Basic %s" % basic_auth)

        try:
            response = self._make_request(request)
        except Exception as inst:
            raise # automatically re-raises the exception

        if 'status' in response:
            # Grab the status info if it exists
            self._last_status_code = response['status']['code']
            if 'message' in response['status']:
                self._last_status_message = response['status']['message']

            if 'data' in response:
                return response['data']

        return response
566983
public JSONResource json(JSONPathQuery path) throws Exception {
		Object jsonValue = path.eval(this);
		return json(jsonValue.toString());
	}
764637
public Response get(String path) throws IOException, RESTException {
        return get(path, null, null);
    }
129328
public static void fsync(final Path path) throws IOException {
        if (! Files.isDirectory(path) && ! Files.isRegularFile(path)) {
            throw new IllegalArgumentException("fsync is only supported for regular files and directories: " + path);
        }

        try (final FileChannel channel = FileChannel.open(path, StandardOpenOption.READ)) {
            channel.force(true);
        }
    }