Magnus Timmerby wrote: > Hi, > > I'd like to contribute one feature to OO, also I need some advice on the > best way to do it. I checked the SDK docs and my conclusion is that there > is no provision in the SDK, i.e. I need to work on the source. Suggestions > are welcome. > > I want to add a "custom export" feature that typically would: > - export the current doc to the chosen target file format > - NOT bring up the file save dialog > - but instead send the file with a HTTP POST to a web application > > Configuration for the web targets would include: > - URL to target web server > - optional POST parameters (used for metadata) > > I think it's getting more common with this type of integration. We have a > few web applications that support receiving files via POST in this way, > and with the correct parameters, the resulting effect is that you can > "push" any doc into the target application into the right place, without > going via file. Today we manually export and import PDFs 50 times per day > so it would simplify our workflow immensely. > > Would this be of interest? And can you please help with some starting > points in the SDK and/or the source?
OOo allows you to store a document to a stream, use the storeToURL() method of the document and provide on OutputStream to it in the arguments (Sequence of PropertyValue) of the call. If you have a stream that both implements com.sun.star.io.XInputStream and com.sun.star.io.XOutputStream (so preferably an object that implements com.sun.star.io.XStream) you then can immediately use the stream as PostData for a post request to your server. It should be possible to use the com.sun.star.ucb.SimpleFileAccess service to create such a stream. If you don't want to use Basic for your implementation you can also use the com.sun.star.io.TempFile" service that directly implements a com.sun.star.io.XStream interface based on a temporary file (a bug prevents using it in Basic currently). The simplest way to post content given by a com.sun.star.io.XInputStream to a server is to open(!) the URL of the server via Dispatch API. The server is expected to return some HTML content, but I think it works even without this. I haven't any code here at hand, but maybe it gives you some guidance. You can read more about storeToURL(), PostData and Dispatch API in chapter 6 of our Developers Guide. All interfaces and services should be documented in the API Reference documentation. Both are part of the SDK. BTW: are you sure that using WebDAV to store the document directly one the server isn't the better choice? Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
