Multi-part Data Example (cont.)
public String parseFormData(Vector students, HttpServletRequest req) {
String contentType = req.getContentType() ;
String boundary = “--” + contentType.substring( . . . ) ;
//Extract part boundary from content type header
BufferedReader in = new BufferedReader(req.getReader()) ;
String line = in.readLine() ;
while(! line.equals(boundary + “--”)) ) {
String header = in.readLine() ;
String name = header.substring( . . . ) ;
//Extract parameter name from content disposition header
if(name.equals(“course”)) {
else if(name.equals(“students”))
if(line.startsWith(boundary)) break ;
students.addElement(line) ;