I have developed a comprehesive Election Manager app that I plan to open source. Substantially everything is working great, except I got kicked in the gonads during final
testing, apparently by a bug in the embedded HTTP server I am using.
I fell into using com.sun.net.httpserver since it is (loosely) included in the JDK and it was pretty simple to get working. By design, my swing clients use only the http post command to initiate each contact with the server. Clients send XML representations of objects to the server and the server returns XML representations of other object(s). During development, clients were run mostly on the same host as the server; never a problem. Of course, during final testing, clients are run on other hosts connecting over the network; never a problem as long as the strings being posted to the server are less than 1460 characters in length. However, if the client is connecting over the network from a different host AND the XML
String is longer than 1460 characters, the HTTP server hiccups every couple of hundred posts or so by truncating the XML to its first 1460 characters. The characters in the String do not seem to matter, only its length. A test posting the same 3200-character (or other length) String repeatedly will work fine hundreds of times, then truncate, then work fine some more before truncating again. It smells like a hard-to find thread/timing bug.
I am hoping someone will have some good advice as to the best way out of this. I prefer to spend my time developing election software rather than standard parts that are supposed to work. It appears that com.sun.new.httpserver is not widely used. I'm looking at swapping it out for jetty, but that involves another learning curve at the very least.
1. Any general advice regarding this problem?
2. Is jetty the best choice to replace com.sun.net.httpserver?
3. Is there any sample code for an embedded jetty (or some better option) receiving posted strings and returning string responses?
4. Client-side sample code for posting strings to jetty and receiving string responses?
I will hugely appreciate any help that anyone can offer! TIA.
Roy Minet