throws IOException {
final String JSON_CONTENT_TYPE = "application/json";
final String JAVASCRIPT_CONTENT_TYPE = "text/javascript"; // *YES*, shoul be "application/javascript", but then there is IE, and the fact that this is really cross-browser (sigh!)
final String HTML_CONTENT_TYPE = "text/html";
RequestRouter processor = getProcessor();
switch( type ) {
case FORM_SIMPLE_POST:
response.setContentType(JSON_CONTENT_TYPE);
processor.processSimpleFormPostRequest( request.getReader(), response.getWriter() );
break;
case FORM_UPLOAD_POST:
response.setContentType(HTML_CONTENT_TYPE); // MUST be "text/html" for uploads to work!
processUploadFormPost(request, response);
break;
case JSON:
response.setContentType(JSON_CONTENT_TYPE);
processor.processJsonRequest( request.getReader(), response.getWriter() );
break;
case POLL:
response.setContentType(JSON_CONTENT_TYPE);
processor.processPollRequest( request.getReader(), response.getWriter(), request.getPathInfo() );
break;
case SOURCE:
response.setContentType(JAVASCRIPT_CONTENT_TYPE);
processor.processSourceRequest( request.getReader(), response.getWriter(), request.getPathInfo());
break;
}
}