Java Code Examples for cn.hutool.core.io.file.FileWriter#write()

The following examples show how to use cn.hutool.core.io.file.FileWriter#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThemeController.java    From stone with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 保存修改模板
 *
 * @param tplName    模板名称
 * @param tplContent 模板内容
 *
 * @return JsonResult
 */
@PostMapping(value = "/editor/save")
@ResponseBody
public JsonResult saveTpl(@RequestParam("tplName") String tplName,
                          @RequestParam("tplContent") String tplContent) {
    if (StrUtil.isBlank(tplContent)) {
        return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.edit.no-content"));
    }
    try {
        //获取项目根路径
        final File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
        //获取主题路径
        final StrBuilder themePath = new StrBuilder("templates/themes/");
        themePath.append(BaseController.THEME);
        themePath.append("/");
        themePath.append(tplName);
        final File tplPath = new File(basePath.getAbsolutePath(), themePath.toString());
        final FileWriter fileWriter = new FileWriter(tplPath);
        fileWriter.write(tplContent);
    } catch (Exception e) {
        log.error("Template save failed: {}", e.getMessage());
        return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.save-failed"));
    }
    return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.save-success"));
}
 
Example 2
Source File: ThemeController.java    From blog-sharon with Apache License 2.0 6 votes vote down vote up
/**
 * 保存修改模板
 *
 * @param tplName    模板名称
 * @param tplContent 模板内容
 * @return JsonResult
 */
@PostMapping(value = "/editor/save")
@ResponseBody
public JsonResult saveTpl(@RequestParam("tplName") String tplName,
                          @RequestParam("tplContent") String tplContent) {
    if (StrUtil.isBlank(tplContent)) {
        return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.theme.edit.no-content"));
    }
    try {
        //获取项目根路径
        File basePath = new File(ResourceUtils.getURL("classpath:").getPath());
        //获取主题路径
        File tplPath = new File(basePath.getAbsolutePath(), new StringBuffer("templates/themes/").append(BaseController.THEME).append("/").append(tplName).toString());
        FileWriter fileWriter = new FileWriter(tplPath);
        fileWriter.write(tplContent);
    } catch (Exception e) {
        log.error("Template save failed: {}", e.getMessage());
        return new JsonResult(ResultCodeEnum.FAIL.getCode(), localeMessageUtil.getMessage("code.admin.common.save-failed"));
    }
    return new JsonResult(ResultCodeEnum.SUCCESS.getCode(), localeMessageUtil.getMessage("code.admin.common.save-success"));
}
 
Example 3
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Generate links/index.html.
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateLink() throws IOException, TemplateException {
    log.info("Generate links.html");

    if (!themeService.templateExists("links.ftl")) {
        log.warn("links.ftl not found,skip!");
        return;
    }

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate(themeService.renderWithSuffix("links"));
    String html = FreeMarkerTemplateUtils.processTemplateIntoString(template, null);
    FileWriter fileWriter = new FileWriter(getPageFile("links/index.html"), "UTF-8");
    fileWriter.write(html);

    log.info("Generate links.html succeed.");
}
 
Example 4
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Generate categories/index.html.
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateCategories() throws IOException, TemplateException {
    log.info("Generate categories.html");

    ModelMap model = new ModelMap();

    if (!themeService.templateExists("categories.ftl")) {
        log.warn("categories.ftl not found,skip!");
        return;
    }

    model.addAttribute("is_categories", true);
    Template template = freeMarkerConfigurer.getConfiguration().getTemplate(themeService.renderWithSuffix("categories"));
    String html = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
    FileWriter fileWriter = new FileWriter(getPageFile("categories/index.html"), "UTF-8");
    fileWriter.write(html);

    List<Category> categories = categoryService.listAll();
    for (Category category : categories) {
        generateCategory(1, category);
    }

    log.info("Generate categories.html succeed.");
}
 
Example 5
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Generate tags/index.html.
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateTags() throws IOException, TemplateException {
    log.info("Generate tags.html");

    ModelMap model = new ModelMap();

    if (!themeService.templateExists("tags.ftl")) {
        log.warn("tags.ftl not found,skip!");
        return;
    }

    model.addAttribute("is_tags", true);
    Template template = freeMarkerConfigurer.getConfiguration().getTemplate(themeService.renderWithSuffix("tags"));
    String html = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
    FileWriter fileWriter = new FileWriter(getPageFile("tags/index.html"), "UTF-8");
    fileWriter.write(html);

    log.info("Generate tags.html succeed.");

    List<Tag> tags = tagService.listAll();
    for (Tag tag : tags) {
        generateTag(1, tag);
    }
}
 
Example 6
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Generate rss.xml and feed.xml
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateRss() throws IOException, TemplateException {
    log.info("Generate rss.xml/feed.xml");

    ModelMap model = new ModelMap();

    model.addAttribute("posts", buildPosts(buildPostPageable(optionService.getRssPageSize())));

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate("common/web/rss.ftl");
    String xml = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
    FileWriter rssWriter = new FileWriter(getPageFile("rss.xml"), "UTF-8");
    rssWriter.write(xml);

    FileWriter feedWriter = new FileWriter(getPageFile("feed.xml"), "UTF-8");
    feedWriter.write(xml);

    log.info("Generate rss.xml/feed.xml succeed.");
}
 
Example 7
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate README.md.
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateReadme() throws IOException, TemplateException {
    log.info("Generate readme.md");

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate("common/web/readme.ftl");
    String txt = FreeMarkerTemplateUtils.processTemplateIntoString(template, null);
    FileWriter fileWriter = new FileWriter(getPageFile("README.md"), "UTF-8");
    fileWriter.write(txt);

    log.info("Generate readme.md succeed.");
}
 
Example 8
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate robots.txt
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateRobots() throws IOException, TemplateException {
    log.info("Generate robots.txt");

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate("common/web/robots.ftl");
    String txt = FreeMarkerTemplateUtils.processTemplateIntoString(template, null);
    FileWriter fileWriter = new FileWriter(getPageFile("robots.txt"), "UTF-8");
    fileWriter.write(txt);

    log.info("Generate robots.txt succeed.");
}
 
Example 9
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate sitemap.xml
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateSiteMapXml() throws IOException, TemplateException {
    log.info("Generate sitemap.xml");

    ModelMap model = new ModelMap();

    model.addAttribute("posts", buildPosts(buildPostPageable(optionService.getRssPageSize())));

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate("common/web/sitemap_xml.ftl");
    String xml = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
    FileWriter fileWriter = new FileWriter(getPageFile("sitemap.xml"), "UTF-8");
    fileWriter.write(xml);

    log.info("Generate sitemap.xml succeed.");
}
 
Example 10
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate archives/{slug}/index.html.
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generatePost() throws IOException, TemplateException {

    if (!themeService.templateExists("post.ftl")) {
        log.warn("post.ftl not found,skip!");
        return;
    }

    List<Post> posts = postService.listAllBy(PostStatus.PUBLISHED);

    for (Post post : posts) {
        log.info("Generate archives/{}/index.html", post.getSlug());
        ModelMap model = new ModelMap();

        AdjacentPostVO adjacentPostVO = postService.getAdjacentPosts(post);
        adjacentPostVO.getOptionalPrevPost().ifPresent(prevPost -> model.addAttribute("prevPost", prevPost));
        adjacentPostVO.getOptionalNextPost().ifPresent(nextPost -> model.addAttribute("nextPost", nextPost));

        List<Category> categories = postCategoryService.listCategoriesBy(post.getId());
        List<Tag> tags = postTagService.listTagsBy(post.getId());
        List<PostMeta> metas = postMetaService.listBy(post.getId());

        model.addAttribute("is_post", true);
        model.addAttribute("post", postService.convertToDetailVo(post));
        model.addAttribute("categories", categories);
        model.addAttribute("tags", tags);
        model.addAttribute("metas", postMetaService.convertToMap(metas));

        Template template = freeMarkerConfigurer.getConfiguration().getTemplate(themeService.renderWithSuffix("post"));
        String html = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);

        FileWriter fileWriter = new FileWriter(getPageFile("archives/" + post.getSlug() + "/index.html"), "UTF-8");
        fileWriter.write(html);
        log.info("Generate archives/{}/index.html succeed.", post.getSlug());
    }
}
 
Example 11
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate s/{slug}/index.html.
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateSheet() throws IOException, TemplateException {
    if (!themeService.templateExists("sheet.ftl")) {
        log.warn("sheet.ftl not found,skip!");
        return;
    }

    List<Sheet> sheets = sheetService.listAllBy(PostStatus.PUBLISHED);
    for (Sheet sheet : sheets) {
        log.info("Generate s/{}/index.html", sheet.getSlug());
        ModelMap model = new ModelMap();

        SheetDetailVO sheetDetailVO = sheetService.convertToDetailVo(sheet);
        model.addAttribute("sheet", sheetDetailVO);
        model.addAttribute("post", sheetDetailVO);
        model.addAttribute("is_sheet", true);

        String templateName = "sheet";

        if (themeService.templateExists(ThemeService.CUSTOM_SHEET_PREFIX + sheet.getTemplate() + HaloConst.SUFFIX_FTL)) {
            templateName = ThemeService.CUSTOM_SHEET_PREFIX + sheet.getTemplate();
        }

        Template template = freeMarkerConfigurer.getConfiguration().getTemplate(themeService.renderWithSuffix(templateName));
        String html = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);

        FileWriter fileWriter = new FileWriter(getPageFile("s/" + sheet.getSlug() + "/index.html"), "UTF-8");
        fileWriter.write(html);

        log.info("Generate s/{}/index.html succeed.", sheet.getSlug());
    }
}
 
Example 12
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate atom.xml
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateAtom() throws IOException, TemplateException {
    log.info("Generate atom.xml");

    ModelMap model = new ModelMap();

    model.addAttribute("posts", buildPosts(buildPostPageable(optionService.getRssPageSize())));

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate("common/web/atom.ftl");
    String xml = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
    FileWriter fileWriter = new FileWriter(getPageFile("atom.xml"), "UTF-8");
    fileWriter.write(xml);

    log.info("Generate atom.xml succeed.");
}
 
Example 13
Source File: StaticPageServiceImpl.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Generate sitemap.html
 *
 * @throws IOException       IOException
 * @throws TemplateException TemplateException
 */
private void generateSiteMapHtml() throws IOException, TemplateException {
    log.info("Generate sitemap.html");

    ModelMap model = new ModelMap();

    model.addAttribute("posts", buildPosts(buildPostPageable(optionService.getRssPageSize())));

    Template template = freeMarkerConfigurer.getConfiguration().getTemplate("common/web/sitemap_html.ftl");
    String html = FreeMarkerTemplateUtils.processTemplateIntoString(template, model);
    FileWriter fileWriter = new FileWriter(getPageFile("sitemap.html"), "UTF-8");
    fileWriter.write(html);

    log.info("Generate sitemap.html succeed.");
}
 
Example 14
Source File: BackupServiceImpl.java    From halo with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BackupDTO exportData() {
    Map<String, Object> data = new HashMap<>();
    data.put("version", HaloConst.HALO_VERSION);
    data.put("export_date", DateUtil.now());
    data.put("attachments", attachmentService.listAll());
    data.put("categories", categoryService.listAll());
    data.put("comment_black_list", commentBlackListService.listAll());
    data.put("journals", journalService.listAll());
    data.put("journal_comments", journalCommentService.listAll());
    data.put("links", linkService.listAll());
    data.put("logs", logService.listAll());
    data.put("menus", menuService.listAll());
    data.put("options", optionService.listAll());
    data.put("photos", photoService.listAll());
    data.put("posts", postService.listAll());
    data.put("post_categories", postCategoryService.listAll());
    data.put("post_comments", postCommentService.listAll());
    data.put("post_metas", postMetaService.listAll());
    data.put("post_tags", postTagService.listAll());
    data.put("sheets", sheetService.listAll());
    data.put("sheet_comments", sheetCommentService.listAll());
    data.put("sheet_metas", sheetMetaService.listAll());
    data.put("tags", tagService.listAll());
    data.put("theme_settings", themeSettingService.listAll());
    data.put("user", userService.listAll());

    try {
        String haloDataFileName = HaloConst.HALO_DATA_EXPORT_PREFIX +
            DateTimeUtils.format(LocalDateTime.now(), DateTimeUtils.HORIZONTAL_LINE_DATETIME_FORMATTER) +
            IdUtil.simpleUUID().hashCode() + ".json";

        Path haloDataPath = Files.createFile(Paths.get(haloProperties.getDataExportDir(), haloDataFileName));

        FileWriter fileWriter = new FileWriter(haloDataPath.toFile(), CharsetUtil.UTF_8);
        fileWriter.write(JsonUtils.objectToJson(data));

        return buildBackupDto(DATA_EXPORT_BASE_URI, haloDataPath);
    } catch (IOException e) {
        throw new ServiceException("导出数据失败", e);
    }
}
 
Example 15
Source File: DocumentBrowser.java    From book118-downloader with MIT License 4 votes vote down vote up
private void writeDownloadedPage(String sDocumentId, int nPage) {
    String filePath = String.format(FILE_DOWNLOAD_PAGE, sDocumentId);
    FileWriter fileWriter = new FileWriter(filePath);
    fileWriter.write(String.valueOf(nPage));
}
 
Example 16
Source File: SignatureApplicationTests.java    From signature with MIT License 4 votes vote down vote up
void creatUDIDMobileconfig(long id) throws IOException, InterruptedException {
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
            "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" +
            "<plist version=\"1.0\">\n" +
            "    <dict>\n" +
            "        <key>PayloadContent</key>\n" +
            "        <dict>\n" +
            "            <key>URL</key>\n" +
            "            <string>"+ Config.udidURL +"/udid/getUDID?id="+ id +"</string> <!--接收数据的接口地址-->\n" +
            "            <key>DeviceAttributes</key>\n" +
            "            <array>\n" +
            "                <string>SERIAL</string>\n" +
            "                <string>MAC_ADDRESS_EN0</string>\n" +
            "                <string>UDID</string>\n" +
            "                <string>IMEI</string>\n" +
            "                <string>ICCID</string>\n" +
            "                <string>VERSION</string>\n" +
            "                <string>PRODUCT</string>\n" +
            "            </array>\n" +
            "        </dict>\n" +
            "        <key>PayloadOrganization</key>\n" +
            "        <string>" + Config.payloadOrganization +"</string>  <!--组织名称-->\n" +
            "        <key>PayloadDisplayName</key>\n" +
            "        <string>" + Config.payloadDisplayName + "</string>  <!--安装时显示的标题-->\n" +
            "        <key>PayloadVersion</key>\n" +
            "        <integer>1</integer>\n" +
            "        <key>PayloadUUID</key>\n" +
            "        <string>"+ UUID.randomUUID().toString().replace("-", "") +"</string>  <!--自己随机填写的唯一字符串-->\n" +
            "        <key>PayloadIdentifier</key>\n" +
            "        <string>online.iizvv.profile-service</string>\n" +
            "        <key>PayloadDescription</key>\n" +
            "        <string>"+Config.payloadDescription+"</string>   <!--描述-->\n" +
            "        <key>PayloadType</key>\n" +
            "        <string>Profile Service</string>\n" +
            "    </dict>\n" +
            "</plist>";
    ClassLoader classLoader = this.getClass().getClassLoader();
    String name = "udid_"+id;
    String filePath = name + ".mobileconfig";
    FileWriter writer = new FileWriter(filePath);
    writer.write(xml);
    String serverKey = classLoader.getResource("server.key").getPath();
    String ca = classLoader.getResource("ca.crt").getPath();
    String serverCrt = classLoader.getResource("server.crt").getPath();
    String filePath2 = name+"_"+id +".mobileconfig";
    String com = "openssl smime -sign -in " + filePath +" -out "+ filePath2 + " -signer "+serverCrt+" -inkey "+serverKey+"  -certfile "+ca+" -outform der -nodetach";
    System.out.println(filePath2);
    Shell.run(com);
}
 
Example 17
Source File: PackageController.java    From signature with MIT License 4 votes vote down vote up
/**
  * create by: iizvv
  * description: 创建获取UDID所用证书
  * create time: 2019-07-04 11:01

  * @return 证书名称
  */
String creatUDIDMobileconfig(long id) {
    System.out.println("创建获取UDID所用证书");
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
            "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" +
            "<plist version=\"1.0\">\n" +
            "    <dict>\n" +
            "        <key>PayloadContent</key>\n" +
            "        <dict>\n" +
            "            <key>URL</key>\n" +
            "            <string>"+ Config.udidURL +"/udid/getUDID?id="+ id +"</string> <!--接收数据的接口地址-->\n" +
            "            <key>DeviceAttributes</key>\n" +
            "            <array>\n" +
            "                <string>SERIAL</string>\n" +
            "                <string>MAC_ADDRESS_EN0</string>\n" +
            "                <string>UDID</string>\n" +
            "                <string>IMEI</string>\n" +
            "                <string>ICCID</string>\n" +
            "                <string>VERSION</string>\n" +
            "                <string>PRODUCT</string>\n" +
            "            </array>\n" +
            "        </dict>\n" +
            "        <key>PayloadOrganization</key>\n" +
            "        <string>" + Config.payloadOrganization +"</string>  <!--组织名称-->\n" +
            "        <key>PayloadDisplayName</key>\n" +
            "        <string>" + Config.payloadDisplayName + "</string>  <!--安装时显示的标题-->\n" +
            "        <key>PayloadVersion</key>\n" +
            "        <integer>1</integer>\n" +
            "        <key>PayloadUUID</key>\n" +
            "        <string>"+ UUID.randomUUID().toString().replace("-", "") +"</string>  <!--自己随机填写的唯一字符串-->\n" +
            "        <key>PayloadIdentifier</key>\n" +
            "        <string>online.iizvv.profile-service</string>\n" +
            "        <key>PayloadDescription</key>\n" +
            "        <string>"+Config.payloadDescription+"</string>   <!--描述-->\n" +
            "        <key>PayloadType</key>\n" +
            "        <string>Profile Service</string>\n" +
            "    </dict>\n" +
            "</plist>";
    String tempName = "udid_"+ id + "_" + UUID.randomUUID().toString().replace("-", "");
    String tempMobileconfig = tempName + ".mobileconfig";
    FileWriter writer = new FileWriter(tempMobileconfig);
    writer.write(xml);
    System.out.println("开始执行shell");
    String mobileconfig = tempName + "_.mobileconfig";
    String com = "/root/mobileconfig.sh " + writer.getFile().getAbsolutePath() + " " + mobileconfig;
    try {
        Shell.run(com);
        System.out.println("shell执行成功, 文件位置为: " + mobileconfig);
        File file = new File("/root/" + mobileconfig);
        mobileconfig = uploadMobileconfig(file);
        file.delete();
    } catch (Exception e) {
        System.out.println("shell执行失败");
        mobileconfig = uploadMobileconfig(writer.getFile());
        e.printStackTrace();
    }finally {
        writer.getFile().delete();
    }
    System.out.println("mobileconfig文件上传结束");
    return mobileconfig;
}
 
Example 18
Source File: UDIDController.java    From signature with MIT License 4 votes vote down vote up
/**
  * create by: iizvv
  * description: 下载IPA的item-service
  * create time: 2019-07-06 10:34

  * @return
  */
String software(String ipaUrl, String id, String version, String title) {
    ipaUrl = Config.aliTempHost + "/" + ipaUrl;
    System.out.println("ipaUrl: " + ipaUrl);
    String plist = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>  \n" +
            "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">  \n" +
            "<plist version=\"1.0\">  \n" +
            "<dict>  \n" +
            "    <key>items</key>  \n" +
            "    <array>  \n" +
            "        <dict>  \n" +
            "            <key>assets</key>  \n" +
            "            <array>  \n" +
            "                <dict>  \n" +
            "                    <key>kind</key>  \n" +
            "                    <string>software-package</string>  \n" +
            "                    <key>url</key>  \n" +
            "                    <string>"+ ipaUrl +"</string>  \n" +
            "                </dict>  \n" +
            "            </array>  \n" +
            "            <key>metadata</key>  \n" +
            "            <dict>  \n" +
            "                <key>bundle-identifier</key>  \n" +
            "                <string>"+ id +"</string>  \n" +
            "                <key>bundle-version</key>  \n" +
            "                <string>" + version + "</string>  \n" +
            "                <key>kind</key>  \n" +
            "                <string>software</string>  \n" +
            "                <key>title</key>  \n" +
            "                <string>" + title + "</string>  \n" +
            "            </dict>  \n" +
            "        </dict>  \n" +
            "    </array>  \n" +
            "</dict>  \n" +
            "</plist> ";
    String filePath = "itemService_" + UUID.randomUUID().toString().replace("-", "") +".plist";
    FileWriter writer = new FileWriter(filePath);
    writer.write(plist);
    String itemService = uploadItemService(writer.getFile());
    writer.getFile().delete();
    return itemService;
}