I am developing an Eclipse RAP web application and would like to keep resource files (configuration etc.) in WEB-INF and load them with something like this:
Properties properties = new Properties();
properties.load(getServletContext().getResourceAsStream("/WEB-INF/foo.properties"));
The WAR is created with a Gradle build and that looks OK when deploying to a standalone Tomcat.
What I would like to do is getting this to work in my development cycle inside Eclipse. I.e. launch the project with a RAP or RWT launch configuration and have all contents in WEB-INF deployed to Jetty, too.
The following instructions have helped me to at least have my own web.xml in the runtime directory used by Jetty:
http://wiki.eclipse.org/RAP/FAQ#How_do_I_develop_an_RWT_standalone_application_with_RAP_.3E.3D_1.5
..\my_workspace\.metadata\.plugins\org.eclipse.rap.tools.launch.rwt\my.rap.app\web-app\WEB-INF\web.xml
But I cannot find a way for any other files under WEB-INF to be deployed when launching inside Eclipse. What I am hoping to achieve is this:
..\my_workspace\.metadata\.plugins\org.eclipse.rap.tools.launch.rwt\my.rap.app\web-app\WEB-INF\foo.properties
Does anybody know whether this is possible with an RWT or RAP launch configuration in Eclipse?
Is there a better approach to comfortably develop and debug a RAP application that loads resources from WEB-INF in Eclipse?
Unfortunately, a feature to copy resources to the WEB-INF directory never made it into the RWT launcher code base.
Since this would be a useful extension of the RWT launcher you may want to file an enhancement request.
I cannot think of a workaround other than putting the properties file on the class path and reading from there:
Properties properties = new Properties();
properties.load( getClass().getResourceAsStream( "foo.properties" ) );
If the resources meant to be located in the WEB-INF directory aren't changing much you could also try to copy them manually to my_workspace\.metadata\.plugins\org.eclipse.rap.tools.launch.rwt\my.rap.app\web-app\WEB-INF