现有的maven工程,集成birt(及birt的参数配置详解)

简介: 现有的maven工程,集成birt(及birt的参数配置详解)从官网下载新的birt-runtime下载地址为:http://download.eclipse.org/birt/downloads/解压zip格式文件后如图:配置目录结构将上图中WebViewerExample中的文件,按如下图进...

现有的maven工程,集成birt(及birt的参数配置详解)
从官网下载新的birt-runtime
下载地址为:http://download.eclipse.org/birt/downloads/
解压zip格式文件后如图:

配置目录结构
将上图中WebViewerExample中的文件,按如下图进行目录结构的配置:

根目录下新建reportFiles文件夹(放报表文件);
webcontent文件夹直接从WebViewerExample里拿;
WEB-INF下的lib和tlds文件夹直接从WebViewerExample里拿;
在WEB-INF下新建report-engine文件夹,在eport-engine文件夹下新建documents images logs scriptlib四个文件夹;
jrun.web.xml server-config.wsdd viewer.properties 三个文件直接从WebViewerExample里拿;
将WebViewerExample里web.xml里的内容拷到你工程里的web.xml。
web.xml的代码片

<context-param>
    <param-name>BIRT_VIEWER_LOCALE</param-name>
    <param-value>en-US</param-value>
</context-param>

<!-- Default timezone setting. Examples: "Europe/Paris", "GMT+1". Defaults 
    to the container's timezone. -->
<context-param>
    <param-name>BIRT_VIEWER_TIMEZONE</param-name>
    <param-value></param-value>
</context-param>

<!-- Report resources directory for preview. Defaults to ${birt home} -->
<context-param>
    <param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
    <param-value>reportFiles</param-value>
</context-param>

<!-- Temporary document files directory. Defaults to ${birt home}/documents -->
<context-param>
    <param-name>BIRT_VIEWER_DOCUMENT_FOLDER</param-name>
    <param-value>WEB-INF/report-engine/documents</param-value>
</context-param>

<!-- Flag whether the report resources can only be accessed under the working 
    folder. Defaults to true -->
<context-param>
    <param-name>WORKING_FOLDER_ACCESS_ONLY</param-name>
    <param-value>true</param-value>
</context-param>

<!-- Settings for how to deal with the url report path. e.g. "http://host/repo/test.rptdesign". 
    Following values are supported: <all> - All paths. <domain> - Only the paths 
    with host matches current domain. Note the comparison is literal, "127.0.0.1" 
    and "localhost" are considered as different hosts. <none> - URL paths are 
    not supported. Defaults to "domain". -->
<context-param>
    <param-name>URL_REPORT_PATH_POLICY</param-name>
    <param-value>domain</param-value>
</context-param>

<!-- Temporary image/chart directory. Defaults to ${birt home}/report/images -->
<context-param>
    <param-name>BIRT_VIEWER_IMAGE_DIR</param-name>
    <param-value>WEB-INF/report-engine/images</param-value>
</context-param>

<!-- Engine log directory. Defaults to ${birt home}/logs -->
<context-param>
    <param-name>BIRT_VIEWER_LOG_DIR</param-name>
    <param-value>WEB-INF/report-engine/logs</param-value>
</context-param>

<!-- Report engine log level -->
<context-param>
    <param-name>BIRT_VIEWER_LOG_LEVEL</param-name>
    <param-value>WARNING</param-value>
</context-param>

<!-- Directory where to store all the birt report script libraries (JARs). 
    Defaults to ${birt home}/scriptlib -->
<context-param>
    <param-name>BIRT_VIEWER_SCRIPTLIB_DIR</param-name>
    <param-value>WEB-INF/report-engine/scriptlib</param-value>
</context-param>

<!-- Resource location directory. Defaults to ${birt home} -->
<context-param>
    <param-name>BIRT_RESOURCE_PATH</param-name>
    <param-value></param-value>
</context-param>

<!-- Preview report rows limit. An empty value means no limit. -->
<context-param>
    <param-name>BIRT_VIEWER_MAX_ROWS</param-name>
    <param-value></param-value>
</context-param>

<!-- Max cube fetch levels limit for report preview (Only used when previewing 
    a report design file using the preview pattern) -->
<context-param>
    <param-name>BIRT_VIEWER_MAX_CUBE_ROWLEVELS</param-name>
    <param-value></param-value>
</context-param>
<context-param>
    <param-name>BIRT_VIEWER_MAX_CUBE_COLUMNLEVELS</param-name>
    <param-value></param-value>
</context-param>

<!-- Memory size in MB for creating a cube. -->
<context-param>
    <param-name>BIRT_VIEWER_CUBE_MEMORY_SIZE</param-name>
    <param-value></param-value>
</context-param>

<!-- Defines the BIRT viewer configuration file -->
<context-param>
    <param-name>BIRT_VIEWER_CONFIG_FILE</param-name>
    <param-value>WEB-INF/viewer.properties</param-value>
</context-param>

<!-- Flag whether to allow server-side printing. Possible values are "ON" 
    and "OFF". Defaults to "ON". -->
<context-param>
    <param-name>BIRT_VIEWER_PRINT_SERVERSIDE</param-name>
    <param-value>ON</param-value>
</context-param>

<!-- Flag whether to force browser-optimized HTML output. Defaults to true -->
<context-param>
    <param-name>HTML_ENABLE_AGENTSTYLE_ENGINE</param-name>
    <param-value>true</param-value>
</context-param>

<!-- Filename generator class/factory to use for the exported reports. -->
<context-param>
    <param-name>BIRT_FILENAME_GENERATOR_CLASS</param-name>
    <param-value>org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator</param-value>
</context-param>
AI 代码解读
<!-- Viewer Servlet Context Listener -->
<listener>
    <listener-class>org.eclipse.birt.report.listener.ViewerServletContextListener</listener-class>
</listener>

<!-- Viewer HttpSession Listener -->
<listener>
    <listener-class>org.eclipse.birt.report.listener.ViewerHttpSessionListener</listener-class>
</listener>
AI 代码解读
<!-- Viewer Filter used to set the request character encoding to UTF-8. -->
<filter>
    <filter-name>ViewerFilter</filter-name>
    <filter-class>org.eclipse.birt.report.filter.ViewerFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>ViewerFilter</filter-name>
    <servlet-name>ViewerServlet</servlet-name>
</filter-mapping>
<filter-mapping>
    <filter-name>ViewerFilter</filter-name>
    <servlet-name>EngineServlet</servlet-name>
</filter-mapping>
AI 代码解读
<!-- Viewer Servlet, Supports SOAP -->
<servlet>
    <servlet-name>ViewerServlet</servlet-name>
    <servlet-class>org.eclipse.birt.report.servlet.ViewerServlet</servlet-class>
</servlet>
<!-- Engine Servlet -->
<servlet>
    <servlet-name>EngineServlet</servlet-name>
    <servlet-class>org.eclipse.birt.report.servlet.BirtEngineServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>ViewerServlet</servlet-name>
    <url-pattern>/frameset</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>ViewerServlet</servlet-name>
    <url-pattern>/run</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/preview</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/download</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/parameter</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/document</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/output</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>EngineServlet</servlet-name>
    <url-pattern>/extract</url-pattern>
</servlet-mapping>
AI 代码解读
<jsp-config>
    <taglib>
        <taglib-uri>/birt.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/birt.tld</taglib-location>
    </taglib>
</jsp-config>
AI 代码解读

运行
访问连接:http://localhost:8080/report/preview?__report=test.rptdesign
访问后如图,那么恭喜你,成功了:

birt参数配置

  1. Servlet模式说明
    查看BIRT Viewer自带的web.xml文件,可以看到有以下几个pattern:

frameset ---- 采用Ajax框架,可以显示工具条,导航条和TOC面板,实现复杂的操作,如分页处理,导出数据,导出报表,打印等等。该模式下会自动生成report document文件(预览report design文件)到特定的目录(用户可以用参数指定,也可以定义在web.xml里)。采用Ajax,速度较慢。

run ---- 也采用Ajax框架,但不实现frameset的复杂功能,不会生成临时的report document文件(预览report design文件),也不支持分页,这个主要是应用在BIRT Designer里的preview tab里,可以支持cancel操作,其它不怎么常用。采用Ajax,速度较慢。

preview — 没有用到Ajax框架,直接调用底层Engine API对报表进行render,把生成的报表内容直接输出到浏览器。这种模式和run模式调用的是相同的Engine API,唯一区别在于run采用Ajax获取报表内容,而preview直接输出到浏览器。如果要支持分页,用户需要在URL上定义__page和 __pagerange参数,这两个参数也会在后面详细说明。需要特别说明的是,在这几种预览模式中,preview的速度是最快的。

document — 该模式主要是为了从report design文件生成report document文件。用户可以在URL上提定document文件生成存放的路径(存放在server端),如果未指定,会直接生成 rptdocument发送到客户端浏览器,用户可以下载到客户端。

output — 该模式类似于frameset,会自动生成report document文件(预览report design文件),区别在于output不采用Ajax,而是将生成的报表内容直接输出到浏览器。

parameter — 该模式主要用于生成一个参数对话框,一般用户不常用,用户可以直接通过提供的JSP Tag–parameterPage去实现参数对话框,不需要直接调用。

download — 用于导出报表数据为CSV格式,当你使用frameset工具条里的导出数据功能时,会用到这个模式。

  1. web.xml里的参数设置
    web.xml文件里有许多参数,用户应该根据自已的需求出发对这些参数有一个深入的了解。下面我会对这些参数一一做以说明。

[BIRT_VIEWER_LOCALE]
设置默认的Locale信息,暂时没有太大意义。因为Locale的信息,首先以URL上定义的__locale为准,如果没有定义,会找到当前浏览器的Locale信息,最后才会用到这里定义的信息。

[BIRT_VIEWER_WORKING_FOLDER]
设置BIRT Viewer的工作目录。用户可以把report design或是report document文件存放在这个目录下,这样就可以在URL上采用相对路径去预览这些报表文件了。默认是当前根目录。
当前支持三种形式:
相对路径 — 这个相对当前的WEB应用的context root.
绝对路径
JAVA系统变量 — 可以在启动服务器时,定义JVM的系统变量,如java –Dmyworkingfolder=D:/reports。这样就可以在web.xml中用${myworkingfolder}进行引用了。

[BIRT_VIEWER_DOCUMENT_FOLDER]
设置生成的document文件的存放路径。默认是documents目录。路径设置同上。

[WORKING_FOLDER_ACCESS_ONLY]
简单的报表访问限制控制实现,如果设为true,哪就只能预览存放在工作目录下的报表文件。默认值是false。

[BIRT_VIEWER_IMAGE_DIR]
设置生成的临时图片的存放路径。默认是report/images目录。路径设置同工作目录设置。

[BIRT_VIEWER_LOG_DIR]
设置生成的日志文件存放路径。默认是logs目录。路径设置同工作目录设置。

[BIRT_VIEWER_LOG_LEVEL]
设置日志的level,可选的值有:ALL|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST|OFF。级别由高到低。

[BIRT_VIEWER_SCRIPTLIB_DIR]
设置用户script lib文件的存放目录( 在报表中用到的Java Event Handler Class )。默认值是scriptlib。路径设置同工作目录设置。

[BIRT_RESOURCE_PATH]
设置用户资源存放路径,这些资源包括library文件,image文件等。默认是当前根目录。路径设置同工作目录设置。

[BIRT_VIEWER_MAX_ROWS]
设置获取dataset的最大记录数。主要应用于设计报表的时候,预览报表如果记录数太多,会花费很多的时间,也可能会引起out of memory问题。默认是不限制。

[BIRT_VIEWER_MAX_CUBE_LEVELS]
设置CUBE查询的最大级数。和前面的参数作用类似。默认是不限制。

[BIRT_VIEWER_CUBE_MEMORY_SIZE]
设置在生成CUBE时,可以写在memory中的最大值,单位是MB。可以提高效率,写在内存会比直接写在硬盘快很多。但同时也要注意内存占用的问题。

[BIRT_OVERWRITE_DOCUMENT]
该参数主要用于frameset/output模式,它们会生成临时的document文件上。如果设为true,则每次刷新页面时,都会重新去生成document文件,如果为false,则不会重新生成,只会用原来的document文件去生成报表内容。

[BIRT_VIEWER_CONFIG_FILE]
定义properties文件的路径,不可以修改。

[BIRT_VIEWER_PRINT_SERVERSIDE]
在frameset工具条上,提供有后台服务器打印的功能,该参数可以设置是打开还是关闭后台打印的功能。默认是打开。可选值为: ON 和 OFF。

[HTML_ENABLE_AGENTSTYLE_ENGINE]
这个参数是会传递给Engine的,主要用于一些CSS的兼容性方面的问题。默认值是true。

  1. viewer.properties参数设置
    viewer.properties文件主要是定义一些扩展的参数。

configurable variable for JSP base href. Please uncomment the below line.

base_url=http://127.0.0.1:8080

该设置主要应用于代理服务器的情况下,在使用代理服务器后,从request里获取的URI并非真正的URI,需要在这里定义。

[EXTENSION SETTING]

viewer.extension.html=html
viewer.extension.pdf=pdf
viewer.extension.postscript=ps
viewer.extension.doc=doc
viewer.extension.xls=xls
viewer.extension.ppt=ppt
定义输出的报表文件的后缀名,和format相关联。

[OUTPUT FORMAT LABEL NAME]

viewer.label.html=HTML
viewer.label.pdf=PDF
viewer.label.postscript=PostScript
viewer.label.doc=Word
viewer.label.xls=Excel
viewer.label.ppt=PowerPoint
定义导出报表对话框里的报表格式列表,和format相关联,这样名字会更有意义。

[CSV SEPARATOR]

viewer.sep.0=,
viewer.sep.1=;
viewer.sep.2=:
viewer.sep.3=|
viewer.sep.4=t
支持多种CSV分隔符,用户也可以增加新的分隔符(只支持char,而不是string)。但同时需要修改JSP文件和Messages.properties文件。

[VIEWING SESSION CONFIGURATION]

The BIRT viewing session is a sub-session of the HTTP session.

An HTTP session can have multiple BIRT viewing sessions.

Each time a new viewer is opened, a new viewing session is created.

The following parameters are used to configure the viewing session

management.

If the matching HTTP session expires, all the viewing sessions

attached to it will expire as well.

Timeout value in seconds after which a viewing session will expire.

The value 0 means that a session will never expire, and the cached files

will never be cleant unless the belonging HTTP session expires.

viewer.session.timeout=1800

Defines a session count threshold after which the cleanup process

will try to clean up expired sessions.

viewer.session.minimumThreshold=500

Load factor to recalculate the minimum threshold value based on the remaining

session count after cleanup.

viewer.session.loadFactor=0.75

Maximum number of simultaneous viewing sessions that can be open at the

same time, to prevent cache overflowing through multiple requests.

A value of 0 means no limit.

viewer.session.maximumSessionCount=0

Behavior that must be used once the maximum session count is reached

(if different than 0):

- A value of 0 will use the “Discard new session” policy that will show

an error message for all the newer sessions.

- A value of 1 will use the “Discard the oldest session” policy that will

try to discard the oldest session, even if it has not expired yet.

Note that “busy” sessions (for example downloading results) won’t be

cleant by this mechanism.

viewer.session.maximumSessionCountPolicy=1

[LOGGERS]

“logger.”+class=level

if no level is specified or the text “DEFAULT”,

then the default level from the web.xml will be used

logger.org.eclipse.datatools.connectivity.oda=DEFAULT

logger.org.eclipse.datatools.enablement.oda=DEFAULT

作者:Fly_maxiaotiao
来源:CSDN
原文:https://blog.csdn.net/Fly_maxiaotiao/article/details/94734771
版权声明:本文为博主原创文章,转载请附上博文链接!

相关文章
|
2月前
|
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的配置
本文介绍了在Spring Boot中配置Swagger2的方法。通过创建一个配置类,添加`@Configuration`和`@EnableSwagger2`注解,使用Docket对象定义API文档的详细信息,包括标题、描述、版本和包路径等。配置完成后,访问`localhost:8080/swagger-ui.html`即可查看接口文档。文中还提示了可能因浏览器缓存导致的问题及解决方法。
84 0
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的配置
微服务——SpringBoot使用归纳——Spring Boot集成 Swagger2 展现在线接口文档——Swagger2 的 maven 依赖
在项目中使用Swagger2工具时,需导入Maven依赖。尽管官方最高版本为2.8.0,但其展示效果不够理想且稳定性欠佳。实际开发中常用2.2.2版本,因其稳定且界面友好。以下是围绕2.2.2版本的Maven依赖配置,包括`springfox-swagger2`和`springfox-swagger-ui`两个模块。
47 0
(网页系统集成CAD功能)在线CAD中配置属性的使用教程
本文介绍了Mxcad SDK在线预览和编辑CAD图纸的功能及配置方法。通过Vite、CDN或Webpack实现集成,用户可自定义设置以满足项目需求。主要内容包括:1)`createMxCad()`方法的初始属性配置,如画布ID、WASM文件路径、字体加载路径等;2)`MxFun.setIniset()`方法提供的更多CAD初始配置;3)`McObject`对象API用于动态调整视图背景色、浏览模式等。此外,还提供了在线Demo(https://demo2.mxdraw3d.com:3000/mxcad/)供用户测试实时效果。
springcloud/springboot集成NACOS 做注册和配置中心以及nacos源码分析
通过本文,我们详细介绍了如何在 Spring Cloud 和 Spring Boot 中集成 Nacos 进行服务注册和配置管理,并对 Nacos 的源码进行了初步分析。Nacos 作为一个强大的服务注册和配置管理平台,为微服务架构提供
596 14
微服务——SpringBoot使用归纳——Spring Boot集成MyBatis——MyBatis 介绍和配置
本文介绍了Spring Boot集成MyBatis的方法,重点讲解基于注解的方式。首先简述MyBatis作为持久层框架的特点,接着说明集成时的依赖导入,包括`mybatis-spring-boot-starter`和MySQL连接器。随后详细展示了`properties.yml`配置文件的内容,涵盖数据库连接、驼峰命名规范及Mapper文件路径等关键设置,帮助开发者快速上手Spring Boot与MyBatis的整合开发。
119 0
微服务——SpringBoot使用归纳——Spring Boot集成Thymeleaf模板引擎——依赖导入和Thymeleaf相关配置
在Spring Boot中使用Thymeleaf模板,需引入依赖`spring-boot-starter-thymeleaf`,并在HTML页面标签中声明`xmlns:th=&quot;http://www.thymeleaf.org&quot;`。此外,Thymeleaf默认开启页面缓存,开发时建议关闭缓存以实时查看更新效果,配置方式为`spring.thymeleaf.cache: false`。这可避免因缓存导致页面未及时刷新的问题。
53 0
2022最新版超详细的Maven下载配置教程、IDEA中集成maven(包含图解过程)、以及导入项目时jar包下载不成功的问题解决
这篇文章是一份关于Maven的安装和配置指南,包括下载、环境变量设置、配置文件修改、IDEA集成Maven以及解决jar包下载问题的方法。
2022最新版超详细的Maven下载配置教程、IDEA中集成maven(包含图解过程)、以及导入项目时jar包下载不成功的问题解决
Jenkins集成Maven
通过以上步骤,可以在Jenkins中成功集成Maven,实现自动化构建和部署。通过定时构建、SCM轮询等方式,可以确保代码库中的最新变更能够及时构建和测试,提高开发效率和代码质量。这种集成方式在实际项目中具有广泛的应用前景,能够显著提升团队的协作效率。
79 8
【前端学java】全网最详细的maven安装与IDEA集成教程!
【8月更文挑战第12天】全网最详细的maven安装与IDEA集成教程!
188 2
【前端学java】全网最详细的maven安装与IDEA集成教程!
利用 Jenkins 实现持续集成与持续部署-代码拉取终端的配置
【8月更文挑战第30天】在Jenkins服务器中,git和Gitee是常用的代码拉取终端。Git作为分布式版本控制系统,具备出色的灵活性和可扩展性;而Gitee则在国内网络环境下表现更佳,适合团队协作。Git配置包括安装、设置用户信息及生成SSH密钥等步骤;Gitee配置也类似,需注册账号、创建仓库、配置基本信息并设置远程仓库地址。开发人员提交代码后,可通过Webhook、定时轮询或事件监听等方式触发Jenkins动作,确保持续集成和部署高效运行。正确配置这些触发机制并通过测试验证其有效性至关重要。
111 2

热门文章

最新文章

推荐镜像

更多
目录
目录
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等