在TOMCAT上的HTML模式下没有图像

时间:2012-11-29 16:39:20

标签: gwt tomcat jasper-reports

exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, "images/jasper_tmp/");
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "/images/jasper_tmp/");

我在GWT项目中使用jasper报告 我的PROD平台是Win2003上的TOMCAT 5.5 我也尝试过TOMCAT 7 / Windows 7。

这些行是在servlet中从应用程序的服务器端调用的。所以我不能使用com.google.gwt.core.client.GWT中的静态方法。

我的问题似乎与jasper reports with HTML Format

类似

在DEV模式下,在Eclipse中,每件事都可以。当我以HTML格式获取jasperreport时,将显示所有图像。

在我的PROD环境中,它是一个TOMCAT服务器,jasper报告中的图像不以HTML格式显示。在PROD服务器上,exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, "images/jasper_tmp/");在%TOMCAT_HOME%中生成images/jasper_tmp/,而不是在我的应用的部署目录中。
在文件系统上,我%TOMCAT_HOME%/images/jasper_tmp/,我希望%TOMCAT_HOME%/webapps/my_project/images/jasper_tmp/

我如何将图像作为参数传递?(如果可能的话)......如答案所示。
我是否需要安装Apache Web Server才能制作任何重写规则?我的PROD服务器只有TOMCAT。

感谢。

1 个答案:

答案 0 :(得分:0)

请使用Firefox with Firebug PluginChrome with Chrome Dev Tool或IE8开发工具调查其image pathcssjavascript错误,并更新详细信息。

Firebug - getfirebug.com

Chrome - https://developers.google.com/chrome-developer-tools/docs/overview

IE8 - http://blogs.msdn.com/b/ie/archive/2008/03/07/improved-productivity-through-internet-explorer-8-developer-tools.aspx

1)除非提供静态资源的性能要求,否则不需要使用重写规则进行apache代理。

2)您可以使用GWT.isProdModel,GWT.getHostPageBaseURL(),GWT.getModuleName()或getModuleBaseForStaticFiles()

调整DevMode和生产模式的图像路径
if (com.google.gwt.core.shared.GWT.isProdMode()){
 //Path Used in production mode
} else {
 //Path Used in dev mode
}

修改 以上信息有助于客户端。在服务器端,Jetty服务器上下文路径与您在服务器(如tomcat)中的Web应用程序部署不同。您可以按照此处https://groups.google.com/d/topic/google-web-toolkit/a8OsRmMSaMg/discussion

中提到的说明将其修复为与tomcat相同
<?xml version="1.0"  encoding="UTF-8"?> 
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" 
"http://jetty.mortbay.org/configure.dtd"> 
<Configure class="org.mortbay.jetty.webapp.WebAppContext"> 

        <Set name="contextPath">/myapp</Set> 

</Configure>