public class BaseApplicationProvider extends java.lang.Object implements ApplicationProvider
ApplicationProvider
. You
register this class as an OSGi declarative service. The service declaration
should look like:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.example.app">
<implementation class="org.restlet.ext.osgi.BaseApplicationProvider"/>
<property name="alias" type="String" value="/"/>
<reference bind="bindRouterProvider" cardinality="1..1" interface="org.restlet.ext.osgi.RouterProvider" name="RouterProvider" policy="static" unbind="unbindRouterProvider"/>
<service>
<provide interface="org.restlet.ext.osgi.ApplicationProvider"/>
</service>
</scr:component>
The service properties are:
The referenced services are:
The provided services are:
SERVLET_CONFIG_ATTRIBUTE, SERVLET_CONTEXT_ATTRIBUTE
Constructor and Description |
---|
BaseApplicationProvider() |
Modifier and Type | Method and Description |
---|---|
void |
activate(org.osgi.service.component.ComponentContext context)
Called by OSGi DS to activate the service after the router provider has
been bound
|
void |
bindRouterProvider(RouterProvider routerProvider)
Called by OSGi DS to inject the router provider service
|
Application |
createApplication(Context context) |
protected Application |
doCreateApplication(Context context)
Called to construct the actual application instance.
|
java.lang.String |
getAlias()
The alias is passed to
HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
when the servlet is registered. |
Application |
getApplication()
Accessor for the cached application instance
|
org.osgi.service.http.HttpContext |
getContext()
The context is passed to
HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
when the servlet is registered. |
java.util.Dictionary<java.lang.String,java.lang.Object> |
getInitParms()
The parameters are passed to
HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
when the servlet is registered. |
void |
unbindRouterProvider(RouterProvider routerProvider)
Called by OSGi DS to un-inject the router provider service
|
public void activate(org.osgi.service.component.ComponentContext context)
context
- the OSGi component contextpublic void bindRouterProvider(RouterProvider routerProvider)
routerProvider
- the router provider servicepublic Application createApplication(Context context)
createApplication
in interface ApplicationProvider
protected Application doCreateApplication(Context context)
context
- the Restlet application contextpublic java.lang.String getAlias()
ApplicationProvider
HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
when the servlet is registered.getAlias
in interface ApplicationProvider
public Application getApplication()
public org.osgi.service.http.HttpContext getContext()
ApplicationProvider
HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
when the servlet is registered.getContext
in interface ApplicationProvider
public java.util.Dictionary<java.lang.String,java.lang.Object> getInitParms()
ApplicationProvider
HttpService.registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context)
when the servlet is registered.getInitParms
in interface ApplicationProvider
public void unbindRouterProvider(RouterProvider routerProvider)
routerProvider
- the router provider serviceCopyright © 2005-2020 Restlet.