@Override protected Application createApplication(Context context) { Application application = super.createApplication(context); /* Retrieve the application context in order to populate it with relevant variables. */ Context applicationContext = application.getContext(); /* Retrieve the component manager and make it available in the restlet application context. */ ComponentManager componentManager = (ComponentManager) getServletContext().getAttribute("org.xwiki.component.manager.ComponentManager"); applicationContext.getAttributes().put(Constants.XWIKI_COMPONENT_MANAGER, componentManager); /* Set the object factory for instantiating components. */ if (application instanceof XWikiRestletJaxRsApplication) { XWikiRestletJaxRsApplication jaxrsApplication = (XWikiRestletJaxRsApplication) application; jaxrsApplication.setObjectFactory(new ComponentsObjectFactory(componentManager)); } else { log("The Restlet application is not an instance of XWikiRestletJaxRsApplication. Please check your web.xml"); } return application; }
result = createApplication(getComponent() .getContext()); getServletContext().setAttribute(