Class RestInitializeContext

java.lang.Object
ubic.gemma.rest.context.RestInitializeContext
All Implemented Interfaces:
org.springframework.context.ApplicationContextInitializer<org.springframework.web.context.ConfigurableWebApplicationContext>

public class RestInitializeContext extends Object implements org.springframework.context.ApplicationContextInitializer<org.springframework.web.context.ConfigurableWebApplicationContext>
Standalone gemma-rest counterpart to ubic.gemma.web.context.InitializeContext (which lives in gemma-web and pulls in JSP / theme / servlet-context configuration that the REST WAR has no use for).

Responsibilities reduced to what the standalone gemma-rest.war actually needs:

  • Activate the web Spring profile so beans gated on @Profile("web") (notably AnalyticsConfig, registered via applicationContext-analytics.xml) become active. The profile name is kept as web rather than introducing a fresh rest profile so existing @Profile("web") call sites in gemma-rest do not need re-gating.
  • Delegate to SpringContextUtils.prepareContext(ApplicationContext) for the environment-profile-validation + SecurityContextHolder strategy work that every Gemma context needs.

Wired in gemma-rest/src/main/webapp/WEB-INF/web.xml via:

<context-param>
    <param-name>contextInitializerClasses</param-name>
    <param-value>ubic.gemma.rest.context.RestInitializeContext</param-value>
</context-param>

Compare ubic.gemma.web.context.InitializeContext, gemma-web's full-fat equivalent (kept in place for the legacy UI's lifecycle; both classes co-exist during the gemma-web → gemma-rest cutover).

  • Constructor Details

    • RestInitializeContext

      public RestInitializeContext()
  • Method Details

    • initialize

      public void initialize(org.springframework.web.context.ConfigurableWebApplicationContext applicationContext)
      Specified by:
      initialize in interface org.springframework.context.ApplicationContextInitializer<org.springframework.web.context.ConfigurableWebApplicationContext>