ParameterAccessor.PARAM_REPORT_DOCUMENT ) )
ParameterAccessor.PARAM_REPORT_DOCUMENT ) && !ParameterAccessor.isReportParameterExist( request, ParameterAccessor.PARAM_REPORT ) )
	protected IViewerReportDesignHandle getDesignHandle(			HttpServletRequest request )	{		IViewerReportDesignHandle design = null;		IReportRunnable reportRunnable = null;		// check if document file path is valid		boolean isValidDocument = ParameterAccessor				.isValidFilePath( this.reportDocumentName );		if ( isValidDocument )		{			IReportDocument reportDocumentInstance = ReportEngineService					.getInstance( ).openReportDocument( this.reportDesignName,							this.reportDocumentName,							this.getModuleOptions( request ) );			if ( reportDocumentInstance != null )			{				reportRunnable = reportDocumentInstance.getReportRunnable( );				// in frameset mode, parse parameter values from document file				// if the path is frameset, copy the parameter value from				// document				// to run the report. If the _document parameter from url is not				// null, means user wants to preview the document, copy the				// parameter from the document to do the preview.				if ( IBirtConstants.SERVLET_PATH_FRAMESET						.equalsIgnoreCase( request.getServletPath( ) ) )				{					this.parameterMap = reportDocumentInstance							.getParameterValues( );				}				if ( ParameterAccessor.getParameter( request,						ParameterAccessor.PARAM_REPORT_DOCUMENT ) != null )					this.documentInUrl = true;				reportDocumentInstance.close( );			}		}		// if report runnable is null, then get it from design file		if ( reportRunnable == null )		{			// if set __document parameter, throw exception directly			if ( ParameterAccessor.isReportParameterExist( request,					ParameterAccessor.PARAM_REPORT_DOCUMENT ) )			{				if ( isValidDocument )					this.exception = new ViewerException(							ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_FILE_ERROR,							new String[]{this.reportDocumentName} );				else					this.exception = new ViewerException(							ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_ACCESS_ERROR,							new String[]{this.reportDocumentName} );				return design;			}			// check if the report file path is valid			if ( !ParameterAccessor.isValidFilePath( this.reportDesignName ) )			{				this.exception = new ViewerException(						ResourceConstants.GENERAL_EXCEPTION_REPORT_ACCESS_ERROR,						new String[]{this.reportDesignName} );			}			else			{				try				{					// check the design file if exist					File file = new File( this.reportDesignName );					if ( file.exists( ) )					{						reportRunnable = ReportEngineService.getInstance( )								.openReportDesign( this.reportDesignName,										this.getModuleOptions( request ) );					}					else if ( !ParameterAccessor.isWorkingFolderAccessOnly( ) )					{						// try to get resource from war package, when						// WORKING_FOLDER_ACCESS_ONLY set as false						this.reportDesignName = ParameterAccessor.getParameter(								request, ParameterAccessor.PARAM_REPORT );						InputStream is = request.getSession( )								.getServletContext( ).getResourceAsStream(										this.reportDesignName );						reportRunnable = ReportEngineService.getInstance( )								.openReportDesign( is,										this.getModuleOptions( request ) );					}					else					{						this.exception = new ViewerException(								ResourceConstants.GENERAL_EXCEPTION_REPORT_FILE_ERROR,								new String[]{this.reportDesignName} );					}				}				catch ( EngineException e )				{					this.exception = e;				}			}		}		if ( reportRunnable != null )		{			design = new BirtViewerReportDesignHandle(					IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT,					reportRunnable );		}		return design;	}