G
G
grossws2012-04-20 17:34:10
Java
grossws, 2012-04-20 17:34:10

What are the options for passing parameters in WAR before CDI?

The web application configuration is stored on the file system. How can it be parameterized so that it is possible to deploy two identical applications with different settings?

Working options:

  • parameterization at build time (e.g. by the value of a property in a pre-selected file in CP)
  • parameterization at the deploy stage in exploded form (similar to the previous version)


But these options seem inconvenient to me. It would be desirable a normal configuration in runtime.

From what doesn't work:
  • JNDI - a full-fledged context is available after the deployment of the application, it is actually not available at the CDI stage
  • Using the context path - Servlet Listeners are launched after the deployment of the web application (similar to injecting using @ContextPath in JBoss Solder)


The deployment environment is JBoss AS7. Who has thoughts on this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
grossws, 2012-04-24
@grossws

I found a funny way, but, unfortunately, platform-specific. JBoss AS 7 uses a view URL vfs:/content/some.war/WEB-INF/some.filefor resources in a WAR.
The easiest way to get this URL is to use an annotation @Resourcefrom JBoss Solder. If you want, you can always look at the implementation to see what classloaders are used to get the URL of the resource.

V
Vladimir, 2014-02-19
@vkushni

the task is easily solved using maven profiles, different files, different context roots, source filtering, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question