posted 15 years ago
I think it's advisable to separate the two parts - saving offline to work for later synchronization, and actually sending it to the server later.
Saving could take any number of forms, depending on the data (or Java objects) you need to store. One of the easiest is probably to use serialization, either of the javax.xml.XMLEncoder shape if the objects are JavaBeans, or of the binary variety (using ObjectOutputStream) if they are not. You could also use a flat file if the data items are simple.
As to sending the data to the server, all kinds of routes are possible: email, JMS, HTTP, sockets, web services... It depends on what the server supports, and makes sense for the data in question. Email and JMS send unformatted data, so the server would need to interpret/parse it in some fashion. HTTP allows to send name/value pairs, which is a step up. Web services have a notion of data types, so that's at an even higher level. Without knowing anything about the application in question, I'd probably go with an HTTP or web service solution.
One issue you need to think about is synchronization. After the user's last server access the data on the server may have changed, which could impact whether the changes the user is about to upload are still valid, or whether they should be rejected. It's possible that your application doesn't need to worry about that, though.