Exemple #1
0
  public static String jsFunction_getContentType(
      Context cx, Scriptable thisObj, Object[] args, Function funObj) throws ScriptException {
    String functionName = "getContentType";
    int argsCount = args.length;
    if (argsCount != 0) {
      HostObjectUtil.invalidNumberOfArgs(hostObjectName, functionName, argsCount, false);
    }
    FileHostObject fho = (FileHostObject) thisObj;

    if (!mimeMapLoaded) {
      FileTypeMap.setDefaultFileTypeMap(loadMimeMap());
      mimeMapLoaded = true;
    }

    return fho.file.getContentType();
  }