public Template handleRequest( final HttpServletRequest request, final HttpServletResponse response, final Context context ) throws Exception {
if ( request.getParameter( "doc" ) != null ) {
DocumentCollection collection = (DocumentCollection)getServletContext().getAttribute( "collection" );
response.setContentType( request.getParameter( "m" ) );
response.setCharacterEncoding( "UTF-8" );
final Document document = collection.document( Integer.parseInt( request.getParameter( "doc" ) ) );
final DocumentFactory factory = collection.factory();
final ObjectArrayList<String> fields = new ObjectArrayList<String>();
final int numberOfFields = factory.numberOfFields();
LOGGER.debug( "ParsingFactory declares " + numberOfFields + " fields" );