if (loader != null) { FileUtil.unzip(srcDir + '/' + applicationWarName, contextDir); FileUtil.moveFile(srcDir + '/' + applicationWarName, webappsDir + '/' + application + ".war"); ServiceUtils.invokeOnConnection(conn, "onAlert", new Object[] { String.format("Application %s will not be available until container is restarted", application) }); } catch (IOException e) {
public static void copyFile(String source, String dest) throws IOException { copyFile(new File(source), new File(dest)); }
/** * Deletes a directory and its contents. This will fail if there are any file locks or if the directory cannot be emptied. * * @param directory * directory to delete * @throws IOException * if directory cannot be deleted * @return true if directory was successfully deleted; false if directory did not exist */ public static boolean deleteDirectory(String directory) throws IOException { return deleteDirectory(directory, false); }
/** * Create a directory. * * @param directory * directory to make * @return whether a new directory was made * @throws IOException * if directory does not already exist or cannot be made */ public static boolean makeDirectory(String directory) throws IOException { return makeDirectory(directory, false); }
std = stdOut(p);
copy(in, fout); in.close(); fout.close();
String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), applicationName); log.debug("Webapp context directory (full path): {}", webappContextDir);
log.debug("Unwaring and starting..."); FileUtil.unzip(webappFolder + '/' + applicationWarName, contextDir);
/** * Initialize SWF verification data. * * @param swfFilePath path to the swf file or null */ public void initSwfVerification(String swfFilePath) { log.info("Initializing swf verification for: {}", swfFilePath); byte[] bytes = null; if (swfFilePath != null) { File localSwfFile = new File(swfFilePath); if (localSwfFile.exists() && localSwfFile.canRead()) { log.info("Swf file path: {}", localSwfFile.getAbsolutePath()); bytes = FileUtil.readAsByteArray(localSwfFile); } else { bytes = "Red5 is awesome for handling non-accessable swf file".getBytes(); } } else { bytes = new byte[42]; } calculateHMAC_SHA256(bytes, 0, bytes.length, GENUINE_FP_KEY, 30, swfHash, 0); swfSize = bytes.length; log.info("Verification - size: {}, hash: {}", swfSize, Hex.encodeHexString(swfHash)); }
public static void copyFile(String source, String dest) throws IOException { copyFile(new File(source), new File(dest)); }
/** * Deletes a directory and its contents. This will fail if there are any file locks or if the directory cannot be emptied. * * @param directory * directory to delete * @throws IOException * if directory cannot be deleted * @return true if directory was successfully deleted; false if directory did not exist */ public static boolean deleteDirectory(String directory) throws IOException { return deleteDirectory(directory, false); }
/** * Create a directory. * * @param directory * directory to make * @return whether a new directory was made * @throws IOException * if directory does not already exist or cannot be made */ public static boolean makeDirectory(String directory) throws IOException { return makeDirectory(directory, false); }
copy(in, fout); in.close(); fout.close();
String webappContextDir = FileUtil.formatPath(webappRoot, applicationName);
public static void moveFile(String source, String dest) throws IOException { copyFile(source, dest); File src = new File(source); if (src.exists() && src.canRead()) { if (src.delete()) { log.debug("Source file was deleted"); } else { log.debug("Source file was not deleted, the file will be deleted on exit"); src.deleteOnExit(); } } else { log.warn("Source file could not be accessed for removal"); } src = null; }
String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName); Context ctx = null; if ("/root".equals(dirName) || "/root".equalsIgnoreCase(dirName)) {
public static void moveFile(String source, String dest) throws IOException { copyFile(source, dest); File src = new File(source); if (src.exists() && src.canRead()) { if (src.delete()) { log.debug("Source file was deleted"); } else { log.debug("Source file was not deleted, the file will be deleted on exit"); src.deleteOnExit(); } } else { log.warn("Source file could not be accessed for removal"); } src = null; }
webappFolder = FileUtil.formatPath(serverRoot, "/webapps"); String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), dirName); log.debug("Webapp context directory (full path): {}", webappContextDir); Context ctx = null;
String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), "/root"); Context ctx = embedded.addWebapp("/", webappContextDir);