public Log getLogger() {
return LogFactory.getLog( ActionSequenceContentGenerator.class );
}
public void createContent( OutputStream outputStream ) throws Exception {
IParameterProvider requestParams = getRequestParameters();
IParameterProvider pathParams = getPathParameters();
if ( ( requestParams != null ) && ( requestParams.getStringParameter( "path", null ) != null ) ) //$NON-NLS-1$
{
//So far the decode that used to be here is not necessary and breaks files with special characters.
// Leaving commented code here in case it shows up later
//path = URLDecoder.decode( requestParams.getStringParameter( "path", "" ), "UTF-8" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
path = requestParams.getStringParameter( "path", "" );
} else if ( ( pathParams != null ) && ( pathParams.getStringParameter( "path", null ) != null ) ) { //$NON-NLS-1$
path = URLDecoder.decode( pathParams.getStringParameter( "path", "" ), "UTF-8" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if ( ( requestParams != null ) && ( requestParams.getStringParameter( "contentType", null )
!= null ) ) { //$NON-NLS-1$
contentType = requestParams.getStringParameter( "contentType", TEXT_HTML ); //$NON-NLS-1$
} else if ( ( pathParams != null ) && ( pathParams.getStringParameter( "contentType", null )
!= null ) ) { //$NON-NLS-1$
contentType = pathParams.getStringParameter( "contentType", TEXT_HTML ); //$NON-NLS-1$
}
if ( path != null && path.length() > 0 ) {
IUnifiedRepository unifiedRepository = PentahoSystem.get( IUnifiedRepository.class, null );
RepositoryFile file = unifiedRepository.getFile( path );
HttpServletRequest httpRequest = (HttpServletRequest) pathParams.getParameter( "httprequest" ); //$NON-NLS-1$
HttpServletResponse httpResponse = (HttpServletResponse) pathParams.getParameter( "httpresponse" ); //$NON-NLS-1$
String buffer =
XactionUtil.execute( contentType, file, httpRequest, httpResponse, PentahoSessionHolder.getSession(),
outputHandler.getMimeTypeListener() );