BundleHeaders

public class BundleHeaders

A convenience class for reading bundle headers.

Fields

BLUEPRINT_ENABLED

public static final String BLUEPRINT_ENABLED

CONTEXT_PATH

public static final String CONTEXT_PATH

RESOURCE_PATH

public static final String RESOURCE_PATH

Constructors

BundleHeaders

public BundleHeaders(BundleContext bundleContext)

Constructs this class using a bundle from which the given bundle context from.

Parameters:
  • bundleContext – the context of the bundle for which we want to read headers

BundleHeaders

public BundleHeaders(Bundle bundle)

Constructs this class using a given bundle.

Parameters:
  • bundle – the bundle for which we want to read headers

Methods

get

public Object get(Object key)

Retrieves the header value for a given key.

Parameters:
  • key – the key for the header
Returns:

the value of the header

getContextPath

public String getContextPath()

Returns the header representing the http path under which the servlet for this bundle should be published.

Returns:the Context-Path header

getName

public String getName()

Reads the name of the bundle.

Returns:the Bundle-Name header

getResourcePath

public String getResourcePath()

Returns the header representing the http path under which the static resources (from the /webapp directory) for this bundle should be published.

Returns:the Resource-Path header

getStringValue

public String getStringValue(String key)

Gets the header value after casting it to a String.

Parameters:
  • key – the key for which the header should be retrieved
Returns:

the header value as a String

getSymbolicName

public String getSymbolicName()

Reads the symbolic name of the bundle.

Returns:the Bundle-SymbolicName header

getVersion

public String getVersion()

Reads the version of the bundle.

Returns:the Bundle-Version header

isBluePrintEnabled

public boolean isBluePrintEnabled()

Checks if the bundle is Blueprint enabled, meaning its “Blueprint-Enabled” header is set to true

Returns:true if the bundle is Blueprint enabled, false otherwise