private void sendFile ( final YokeRequest request , final String file , final FileProps props ) { // write content type String contentType = MimeType . getMime ( file ) ; String charset = MimeType . getCharset ( contentType ) ; request . response ( ) . setContentType ( contentType , charset ) ; request . response ( ) . putHeader ( "Content-Length" , Long . toString ( props . size ( ) ) ) ; // head support if ( HttpMethod . HEAD . equals ( request . method ( ) ) ) { request . response ( ) . end ( ) ; } else { request . response ( ) . sendFile ( file ) ; } }
Write a file into the response body