HttpContextFactory

public final class HttpContextFactory

This factory is responsible for creating org.osgi.service.http.HttpContext decorator objects for bundles. If dynamic resource loading is set for a given bundle, meaning the ENVIRONMENT variable is set to DEVELOPMENT and variable with an underscored version of the bundle symbolic name is defined, an instance of org.motechproject.osgi.web.ext.FileSystemAwareUIHttpContext will be created for the bundle. In other cases the provided contex is unchaged.

Methods

getHttpContext

public static HttpContext getHttpContext(HttpContext httpContext, Bundle bundle)

Decorates the given HttpContext with a @{link FileSystemAwareUIHttpContext} if dynamic resource loading is set up.

Parameters:
  • httpContext – the default http context for a given bundle
  • bundle – the bundle for which this http context will be registered
Returns:

the decorated instance of the provided context if dynamic loading was set up, the original instance otherwise