Coldfusion and WebDav

Does anyone have any experience with coldfusion and webdav services? I cant seem to find any information on the web any where…I’d love to be able to find something like sabredav (php, .net)

I’d like to be able to have my users open a file from the browser and have it loaded into OpenOffice. Then, once they make changes and go to save the file, it uses webdav to save the fileback to the webdav internet directory.

I cant seem to find any working solutions on this issue.

Any help would be greatly appreciated!

Thanks!

Well, I’ve decided to document this for anyone else that runs into the problem.

Solution…JAVA!

I wrote this java applet that will load OpenOffice from the clients computer with the location of the file in the webdav repository. You’ll have to pass two parameters into the applet…Filename to open, and path to open office.


/*
 *  OpenOffice Applet
 *  July 06, 2011
 *  Quintin Bressler
 *  
 *  This applet will take 2 paramters from an html file and use them to open up openoffice for file saving via OpenOffice.
 *  This file will also lock the document once it's opened so only one person can edit the document.
 */

import java.io.*;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
import java.awt.*;

public class appFinal extends javax.swing.JApplet {

	String filename;
	int number;
	String program;

	public void init() {

		filename = getParameter("filename"); // Grab filename from control file
		program = getParameter("program"); // Grab the path to open office

	}

	// private static final long serialVersionUID = 1L;

	public void paint(Graphics screen) {
		System.out.println("Loading OpenOffice");
		try {
			File file = new File(filename);
			FileChannel channel = new RandomAccessFile(file, "rw").getChannel();
			FileLock lock = channel.lock();
			try {
				lock = channel.tryLock();
			} catch (OverlappingFileLockException e) {
				// Should be locked by now...hopefully
			}
			try {
		
				Runtime rt = Runtime.getRuntime();
				Process pr = rt.exec(program + filename);
	
				BufferedReader input = new BufferedReader(new InputStreamReader(
						pr.getInputStream()));
	
				String line = null;
	
				while ((line = input.readLine()) != null) {
					System.out.println(line);
				}
	
				int exitVal = pr.waitFor();
				System.out.println("Exited with error code " + exitVal);
	
			} catch (Exception e) {
				System.out.println(e.toString());
				e.printStackTrace();
			}
			lock.release();
			channel.close();
		} catch (Exception e) {
			
		}
	}

}


and the html for that applet:


    <applet code="appFinal.class" archive="SappFinal.jar" width="200" height="200">
        <param name="filename" value="<cfoutput>#url.filename#</cfoutput>" />
        <param name="program" value="path/to/program">
    </applet>

Now, when the users clicks on the ODT file from the web app, Open Office will load and when the user clicks on save from openoffice, the file automatically saves back to the webdav repository.