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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -