if ( request.getParameter( "m" ) != null && request.getParameter( "doc" ) != null ) {
DocumentCollection collection = (DocumentCollection)getServletContext().getAttribute( "collection" );
if ( collection == null ) LOGGER.fatal( "The servlet context does not contain a document collection." );
response.setContentType( request.getParameter( "m" ) );
response.setCharacterEncoding( "UTF-8" );
InputStream rawContent = collection.stream( Integer.parseInt( request.getParameter( "doc" ) ) );
for( int i = skip; i-- != 0; ) rawContent.reset();
IOUtils.copy( rawContent, response.getOutputStream() );
}
} catch( RuntimeException e ) {
e.printStackTrace();