The actual data can be sent to the equanda generated application using a servlet. Alternatively a web page can be provided (and by default it is), where you can cut and past the import file.
The servlet can be called with code like the following :
// Set connection parameters
// write the request
Writer out=new BufferedWriter(new OutputStreamWriter(cnx.getOutputStream()));
// write the data
// now read the response
BufferedInputStream in=new BufferedInputStream(cnx.getInputStream());
// handle the reply
If the data file starts with "data=ï¿½ then this is removed from the data (this is done to allow the data to come from a form).
The servlet send a short replies with "OK" if the file was processed properly.
If there was a problem during the import, the reply is "FAILED " followed by a human readable reason of failure.
If your servlet is secured (it should be), then it is best to use the org.equanda.client.ImportClient class.
This will handle the login both in case of BASIC and FORM based authentication.
The actual servlet can be generated with a ant task like the following :
<attribute name="ejb-package" value="test"/>
Note that "importï¿½ is a reserved word in Java and thus cannot be used as package name.
To use the servlet, a definition like the example which follows has to be added to your web.xml file in your web archive.
Obviously, this servlet also has to be mapped to a URL, but thatï¿½s all there is to it.
On the servlet connection, it is possible to indicate the character encoding which is used in the communication.
This can be modified as needed on the client side to match the charset for the text file.