Code example for JSONArray

Methods: lengthoptString

     * @param defaultString the default to be used if the arg does not exist 
     * @return String with the retrieved value 
    private String getArgument(JSONArray args, int position, String defaultString) {
        String arg = defaultString;
        if(args.length() >= position) {
            arg = args.optString(position);
            if (arg == null || "null".equals(arg)) {
                arg = defaultString;
        return arg;
     * Uploads the specified file to the server URL provided using raw HTTP request. 
     * @param filePath      Full path of the file on the file system 
     * @param serverUri        URL of the server to receive the file 
     * @param mimeType      Describes file content type 
     * @param method        HTTP method