What exactly are you implementing?? A wrapper class which will lie on server?? Or client of the service available on the server??
If it is wrapper on the server which will be deployed on server only then you don't have to bother about the boundary at all, it would be sent to you by client.
If you are writing a client, then you need to understand what exactly a boundary is-
Boundary is a pattern (a pattern made of different characters, don't get confused with design pattern here) which is used as terminator for multiple parts of a request, & is assumed that the parts of request will never contain that pattern. You can have your own pattern (which can even differ for every request), just make sure that it never appears inside your file. you can use ones generated by any browser or modify them as per your interest and/or need.
Joined: Jul 20, 2008
Thanks Anurag for the response. The implementation is for the client of the service. I understand the concept of the boundary, and that it acts more like a delimiter. However, would you know of the exact steps of how to get the boundary from the browser (or how to generate a boundary)?? I could not find any example (set of steps) that has this info.
You can write a testservlet which prints all the headers on console for every request received & can have a sample html page having one form with one file upload input & a submit button, action of the form should be targetting to this servlet. upload the file, have all contents on the console.
Second way is ....have (or find) a web page where a file upload control exists. start tracking it with HttpFox plugin of firefox (no ad intended), upload a file & see the request headers. Copy your boundary value from there.