Hallo, I found finally the solution: import org.geowebcache.storage.DefaultStorageFinder; import org.geowebcache.util.ApplicationContextProvider; import javax.servlet.ServletContext; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils;
....... HttpSession session = request.getSession(); ServletContext servletContext = session.getServletContext(); WebApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); ApplicationContextProvider applicationContextProvider = new ApplicationContextProvider(); applicationContextProvider.setApplicationContext(appContext); DefaultStorageFinder gwcStorageFinder = new DefaultStorageFinder(applicationContextProvider); String gwcDataDirPath = gwcStorageFinder.getDefaultPath(); File geoWebCacheXml = new File(gwcDataDirPath + "/geowebcache.xml"); Thanks anyway, Tommaso ------- Forwarded message ------- From: tommaso <tommas...@googlemail.com> To: geoserver-users@lists.sourceforge.net Cc: Subject: Find out path of geowebcache.xml Date: Tue, 03 Feb 2015 13:36:27 +0100 Hallo, I need to parse the content of geowebcache.xml from Geoserver. I tried this tutorial: http://docs.geoserver.org/2.5.x/en/developer/programming-guide/ows-services/implementing.html and my first attempt was: import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import org.vfny.geoserver.global.GeoserverDataDirectory; public class CustomCapabilities { public CustomCapabilities() {} public void getCustomCapabilities(HttpServletRequest request, HttpServletResponse response) throws ServletException { String geoserverDataDir = GeoserverDataDirectory.getGeoserverDataDirectory().getAbsolutePath(); File geoWebCacheXml = new File(geoserverDataDir + "/gwc/geowebcache.xml"); .... } } The problem is, this does not longer work if geowebcache.xml isn't in GEOSERVER_DATA_DIR/gwc/geowebcache.xml Is There a easy way to find out on runtime which geowebcache.xml is really used by Geoserver? I'm using currently Geoserver 2.3.0, which provides Geowebcache 1.4, but I could upgrade if needed (the upgrade is already on the TODO list) Thank you, Tommaso ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users