Hi Martin!
Thanks a lot for your help! However, i'm really a rookie and i need some
clarification to understand :)
How should i modify my web.xml(below)? Should i just add the
<context-param>- and <listener>-part to the web.xml?
I do not fully understand what to do with the listener and how to do it...
where do i put the listener?
Im not really used to Java, so all of this is sort of new to me.
web-app>
<!-- Servlets -->
<servlet>
<servlet-name>Fop</servlet-name>
<servlet-class>org.apache.fop.servlet.FopServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>FopPrint</servlet-name>
<servlet-class>org.apache.fop.servlet.FopPrintServlet</servlet-class>
</servlet>
<!-- Servlet mappings -->
<servlet-mapping>
<servlet-name>Fop</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FopPrint</servlet-name>
<url-pattern>/fopprint</url-pattern>
</servlet-mapping>
</web-app>
Martin Jacobson wrote:
This is what I would do...
0) move the config file to be part of the war file, inside WEB-INF
1) web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.dtd">
<web-app>
<display-name>cartoWeb - vector map server</display-name>
<context-param>
<param-name>configuration-file</param-name>
<param-value>WEB-INF/fop.xconf</param-value>
</context-param>
<listener>
<listener-class>com.emc.carto.web.servlet.WebAppInitializer</listener-class>
</listener>
...
2) Listener
public class WebAppInitializer implements ServletContextListener
{
ServletContext ctx = null;
public void contextInitialized(ServletContextEvent sce)
{
ctx = sce.getServletContext();
String configFileName =
ctx.getInitParameter("configuration-file");
String realConfigFile = ctx.getRealPath(configFileName);
try {
fopFactory.setUserConfig(new File(realConfigFile));
}
etc.
HTH
Martin
--
View this message in context:
http://old.nabble.com/Relative-paths-when-running-FOP-as-servlet-%28Tomcat%29-tp29531194p29533202.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]