context.finalize( );  String target = "pages/common/Error.jsp"; request.setAttribute( "error", context.getBean( ).getException( ) ); RequestDispatcher rd = request.getRequestDispatcher( target ); rd.include( request, response );
if ( context.getBean( ).getException( ) != null ) { context.finalize( );  String target = "pages/common/Error.jsp"; request.setAttribute( "error", context.getBean( ).getException( ) ); RequestDispatcher rd = request .getRequestDispatcher( target ); rd.include( request, response ); } else { try { engine.service( request, response ); } catch ( BirtException e ) { String target = "pages/common/Error.jsp"; request.setAttribute( "error", e ); RequestDispatcher rd = request .getRequestDispatcher( target ); rd.include( request, response ); } finally { context.finalize( ); } }
	public void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException	{		ReportEngineService.getInstance().setEngineContext( getServletContext( ), request );		BirtContext context = new BirtContext( request );				if ( "/download".equalsIgnoreCase( request.getServletPath( ) ) ) //$NON-NLS-1$		{			if ( context.getBean( ).getException( ) != null )			{				context.finalize( );								String target = "pages/common/Error.jsp"; //$NON-NLS-1$				request.setAttribute( "error", context.getBean( ).getException( ) ); //$NON-NLS-1$				RequestDispatcher rd = request.getRequestDispatcher( target );				rd.include( request, response );			}			else			{				try				{					engine.service( request, response );				}				catch ( BirtException e )				{					String target = "pages/common/Error.jsp"; //$NON-NLS-1$					request.setAttribute( "error", e ); //$NON-NLS-1$					RequestDispatcher rd = request.getRequestDispatcher( target );					rd.include( request, response );				}				finally				{					context.finalize( );				}			}		}		else		{			super.doPost( request, response );			context.finalize( );		}	}