public interface ApplicationInfo
@Path("resource") public static class ApplicationInfoTest { @Inject Provider<ApplicationInfo> applicationInfoProvider; @GET public String getAppName() throws InterruptedException { final ApplicationInfo applicationInfo = appInfoProvider.get(); final String name = applicationInfo.getResourceConfig().getApplicationName(); return name; } }Note usage of
Provider
to retrieve application info. Info changes over time and this will
inject the latest info. In the case of singleton resources usage of Provider
is the only way how
to inject application info that are up to date.
Application info retrieved from Jersey runtime might be mutable and thanks to it might provide inconsistent data
as not all attributes are updated in the same time. To retrieve the immutable and consistent
data the method snapshot()
should be used.ApplicationEvent
,
ApplicationEventListener
,
See MonitoringStatistics class for general details about statistics.
Modifier and Type | Method and Description |
---|---|
Set<Class<?>> |
getProviders()
Get registered providers available in the runtime.
|
Set<Class<?>> |
getRegisteredClasses()
Get resource classes registered by the user in the current application.
|
Set<Object> |
getRegisteredInstances()
Get resource instances registered by the user in the current application.
|
ResourceConfig |
getResourceConfig()
Get the resource config.
|
Date |
getStartTime()
Get the start time of the application.
|
ApplicationInfo |
snapshot()
Get the immutable consistent snapshot of the application info.
|
ResourceConfig getResourceConfig()
Date getStartTime()
Set<Class<?>> getRegisteredClasses()
ModelProcessor
.
User resources are resources that
were explicitly registered by the configuration, discovered by the class path scanning or that
constructs explicitly registered programmatic resource
.Set<Object> getRegisteredInstances()
ModelProcessor
.
User resources are resources that
were explicitly registered by the configuration, discovered by the class path scanning or that
constructs explicitly registered programmatic resource
.Set<Class<?>> getProviders()
filters
,
reader
and writer
interceptors which are explicitly registered by configuration, or annotated by
@Provider
or registered in META-INF/services. The
set does not include providers that are by default built in Jersey.ApplicationInfo snapshot()
Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.