Code example for JSONArray

Methods: length, optString

     * @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 an HTTP 
     * multipart request. 
     * @param file      Full path of the file on the file system 
     * @param server        URL of the server to receive the file 
     * @param fileKey       Name of file request parameter 
     * @param fileName      File name to be used on server