ServletContext during initialization in jax-ws
I am writing a web service using jax-ws and am having problems with initialization. My web service relies on a few auxillary files that I store under WEB-INF/. One of these files is a properties file that I would like to load before any messages are received. Unfortunately, the only way I know to load this file is to use the ServletContext to get the real path for the file before loading. There are some other files that it would be nice to handle in a similar manner before the handling messages.
For a normal servlet, the context is passed into the init method, but from within my web service, I seem to only be able to access a ServletContext from a MessageContext and therefore have to initialize on the first call. I currently have to set a flag that is checked on each call, to see if I have initialized.
What would be perfect would be the a @PostConstruct method that took an argument of a servlet context.
Is there a better way to deal with this today, or something coming in the future?