* servlet response
*/
protected void processRequest( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
IOException {
IReadAccess systemAccess = CdfEngine.getPluginSystemReader( null );
String resource = request.getParameter( Parameter.RESOURCE ); //$NON-NLS-1$
if ( StringUtils.isEmpty( resource ) ) {
error( Messages.getErrorString( "GetResource.ERROR_0001_RESOURCE_PARAMETER_MISSING" ) ); //$NON-NLS-1$
response.setStatus( HttpServletResponse.SC_SERVICE_UNAVAILABLE );
return;
}
if ( !systemAccess.fileExists( resource ) ) {
error( Messages.getErrorString( "GetResource.ERROR_0003_RESOURCE_MISSING", resource ) ); //$NON-NLS-1$
response.setStatus( HttpServletResponse.SC_SERVICE_UNAVAILABLE );
return;
}
InputStream in = systemAccess.getFileInputStream( resource );
String mimeType = MimeTypes.getMimeType( resource );
if ( StringUtils.isEmpty( mimeType ) ) {
// Hard coded to PNG because BIRT does not give us a mime type at all...
response.setContentType( MimeTypes.PNG );