Perfect and my code is also in a shared client that is called from the Beans behind Struts Actions. I am attempting to use Slide as an XML persistance mechanism behind Beans for Struts components. The XML then can be easily repurposed and the Slide Content Server can be easily accessed by multiple Struts User Access servers to provide scalability and distributability.
Individual Bean performance isn't as fast as J2EE CMP, BUT I can more than make up for that by scaling other aspects of the user experience with multiple Struts servers. If I can eliminate the overhead of writing the XML to files before passing to Slide, it might even be as fast as J2EE CMP of the XML which I need for repurposing.
why don't you use directly an XMLdb?
Michael Oliver CTO/Matrix Intermedia 7391 S. Bullrider Ave. Tucson, AZ 85747 Office (520)574-1150 Cell (518)378-6154
Stan Pinte said: > At 13:08 12/08/2003 -0400, you wrote: > >>Stan, thanks that looks like the solution, could you include a little >> more of the code for context? > > > no problem: > > It is a method in a Servlet-like environment (actually a struts Action). > > /** > * Stores the document and returns its file name > */ > private void storeDocument(String id, String extension, > DocumentForm > form) throws Exception > { > FormFile file = form.getFile(); > WebdavResource resource = getResource(); > String newResource = davPath + id + extension; > log.debug("resource: [" + resource + "]"); > log.info("adding: [" + newResource + "] in document > repository"); > boolean succeeded = resource.putMethod(appContext + > newResource, > file.getInputStream()); > if (!succeeded) > { > throw new IOException(resource.getStatusMessage()); > } > log.info("succeeded."); > } > > private WebdavResource getResource() throws MalformedURLException, > HttpException, > IOException > { > HttpURL url = new HttpURL(hostPort + appContext + davPath); > url.setUserInfo(user, password); > return new WebdavResource(url); > } > > Is this allright for you? > > 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 12:23 12/08/2003 -0400, Michael Oliver wrote: >> > >> >>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 >> >> >> >> >>--------------------------------------------------------------------- >> 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]
