java - Restlet obtaining Application -
in restlet 2.3 recommended way of obtaining application?
the docs suggest there static method application.getcurrent() implies possible obtain executing application. however, requires call made executing application.
say had several applications , running:
public class applicationa extends application {...} public class applicationb extends application {...} is possible obtain application applicationa applicationb?
it depends on way configured restlet "application" since define routing based on application instances, inject 1 other one, described below:
component c = new component(); (...) myapplication1 app1 = new myapplication1(); c.getdefaulthost().attach("/app1", app1); myapplication1 app2 = new myapplication2(app1); c.getdefaulthost().attach("/app1", app2); (...) you can notice can introspect application @ runtime. apispark extension of restlet that. see class org.restlet.ext.apispark.internal.introspection.application.componentintrospector , org.restlet.ext.apispark.internal.introspection.application.componentintrospector.
why need such feature in application? sure give right answer ;-)
edited
you can reach sample application use case @ address https://github.com/templth/restlet-stackoverflow/tree/master/restlet/test-restlet-application-manager.
hope helps you, thierry
Comments
Post a Comment