Thanks but I am NOT looking to pass a File to the putMethod, I already can do that with the WebDAVClient, but rather a byte[] that contains XML that I am generating in my program but wish to "PUT" to Slide WITHOUT writing it to a File first. I don't want the overhead of a temporary file.
sorry Michael,
I was too precipitated...
here is what I do in one of my servlets, and it works all right. You could pass a ByteArrayInputStream...
boolean succeeded = resource.putMethod(appContext + newResource, file.getInputStream());
Stan.
Michael Oliver CTO/Matrix Intermedia 7391 S. Bullrider Ave. Tucson, AZ 85747 Office (520)574-1150 Cell (518)378-6154
Stan Pinte said: > At 11:52 12/08/2003 -0400, Michael Oliver wrote: > >>I would like to do a PUT of a byte[] that contains an XML "File" >> without first writing it to an actual File. The slide DAV client only >> accepts a File in the putMethod(srcFile, DestPathStr) and as I see this >> is just a wrapper for the httpClient putMethod, that too doesn't seem >> to allow for a virtual "File". >> >>I am guessing that I can subclass File into my own virtualFile and then >> I can populate the content programmatically, but that's a lot of work, >> so I was looking to see first if anyone has a better suggestion. > > > I have a working sample here: > > public URI addFile(String path) throws MalformedURLException, > HttpException, > IOException, > URISyntaxException > { > File file = new File(path); > //InputStream stream = new FileInputStream(path); > String fileName = file.getName(); > WebdavResource resource = getResource(); > > if (!file.exists()) > { > throw new IOException("file does not exist: " + file); > } > > //resource.setDebug(8); > System.out.println("adding: [" + davPath + fileName + "]"); > //boolean succeeded = resource.putMethod(fileName, "test > data...\n"); boolean succeeded = resource.putMethod(davPath + > fileName, file); if (!succeeded) > { > throw new IOException(resource.getStatusMessage()); > } > return new URI(hostPort + davPath + fileName); > } > > private WebdavResource getResource() throws MalformedURLException, > HttpException, > IOException > { > HttpURL url = new HttpURL(hostPort + davPath); > //HttpURL url = new > HttpURL("http:://localhost:8086/slide/files/octa/"); > url.setUserInfo(user, password); > return new WebdavResource(url); > } > > I am using the latest slide stable version. As you see, the putMethod() > can take a file argument. > > Stan. > > >>Michael Oliver >>CTO/Matrix Intermedia >>7391 S. Bullrider Ave. >>Tucson, AZ 85747 >>Office (520)574-1150 >>Cell (518)378-6154 >> >> >> >> >> >> >>--------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] For >> additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >>--- >>Incoming mail is certified Virus Free. >>Checked by AVG anti-virus system (http://www.grisoft.com). >>Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
