Hi Anca,
You don't necessarily have to have your own servlet for this, you could
attach
it to a wiki document, by posting to the "upload" action for the wiki
document,
with the appropriate field names. I'm doing this in the image plugin with
the
FileUploadForm.
You could even have your own action to post to, similar to the "upload"
only
that it would invoke the importer plugin for the uploaded file and send
back the
results, although I'm not really sure this is a good idea, as actions are
quite
a core part of the wiki, and whose changing requires changes deep down
(need to
write your action and have it on the server, need to map it in the actions
mapping file). Your servlet would require web.xml mapping too, so maybe
it's
quite the same.
Or, in order to get the output back you can:
1. upload the file to the current document and, when the upload call
returns,
make a second call to the WywisygService to import the uploaded file and
send
back (x)html.
2. upload the file to an office importer special document, transform it and
return it with the upload action result (I need to digg more on this to see
how
exactly would it be done). This solution would be hard to mix with the
uploaded
images in the file, as they won't be attached to the correct wiki document
upon
save, you'd need to move them.
Of course, you could also use solution 1. with a special OfficeImporter
document
as a repository for all files uploaded which need to be imported.
Thanks for the idea :) We could do,
1. Upload the document into XWiki.OfficeImporter (The repository)
2. Have a GWT rpc call such as;
String importDocument(String fileName, String targetPage);
Here the fileName is the name of the attachment just added to
XWiki.OfficeImporter and targetPage would be the name of the current wiki
page being edited.
As you said, the attached document itself can be deleted when the import is
complete. (+ need to workaround name collisions with multiple users, but
that's not a big issue IMO).
Or you could just leave them there (could you?), as we do for all edit
situations, as I mentioned.
Hmmmm, yes that's possible too. I was wondering if it's not that nice.
Let's see if others agree.
Thanks.
- Asiri