}
protected boolean doBackgroundExecution( final HttpServletRequest request, final HttpServletResponse response,
final IPentahoSession userSession ) throws ServletException, IOException {
if ( "true".equals( request.getParameter( "background" ) ) ) { //$NON-NLS-1$ //$NON-NLS-2$
IBackgroundExecution backgroundExecutionHandler = PentahoSystem.get( IBackgroundExecution.class, userSession );
if ( backgroundExecutionHandler != null ) {
HttpRequestParameterProvider parameterProvider = new HttpRequestParameterProvider( request );
String intro = ""; //$NON-NLS-1$
String footer = ""; //$NON-NLS-1$
IUITemplater templater = PentahoSystem.get( IUITemplater.class, userSession );
if ( templater != null ) {
String[] sections = templater.breakTemplate( "template-dialog.html", "", userSession ); //$NON-NLS-1$ //$NON-NLS-2$
if ( ( sections != null ) && ( sections.length > 0 ) ) {
intro = sections[0];
}
if ( ( sections != null ) && ( sections.length > 1 ) ) {
footer = sections[1];
}
} else {
intro = Messages.getInstance().getString( "ViewAction.ERROR_0002_BAD_TEMPLATE_OBJECT" ); //$NON-NLS-1$
}
response.getWriter().print( intro );
String backgroundResponse = null;
try {
backgroundResponse = backgroundExecutionHandler.backgroundExecuteAction( userSession, parameterProvider );
} catch ( BackgroundExecutionException bex ) {
backgroundResponse = bex.getLocalizedMessage();
response.getWriter().print( backgroundResponse );
response.getWriter().print( footer );
error(