Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

how to get the path to the WEB-INF directory

Peter Olah
1 decade ago May 20, 2010 3:52pm
Dmitri Livotov
1 decade ago May 20, 2010 4:29pm

Hi Peter,

you can construct the path to a file inside the webapp folder by using WebApplicationContext, which you can get by calling getContext of your Vaadin application class instance:

WebApplicationContext context = (WebApplicationContext)getContext();
File webinfFolder = new File ( context.getHttpSession().getServletContext().getRealPath("/WEB-INF") );

Alternatively, you could want to read your config file at app startup - in this case just register your ServletContextListener and in contextInitialized(...) callback method you'll find the ServletContext as a incoming parameter

Last updated on May, 20th 2010
Peter Olah
1 decade ago May 25, 2010 3:37pm
salman farisi
1 decade ago Apr 25, 2011 9:28am
Marko Grönroos
1 decade ago Apr 25, 2011 10:14am
Dmitri Livotov
1 decade ago Apr 25, 2011 1:33pm
salman farisi
1 decade ago May 13, 2011 4:09am
Fred Fred
8 years ago Apr 25, 2014 4:34pm
Shadab Ambat
8 years ago Jul 10, 2014 10:25pm