Search in sources :

Example 1 with JaxRsApplication

use of org.restlet.ext.jaxrs.JaxRsApplication in project xwiki-platform by xwiki.

the class XWikiRestletServlet method createApplication.

@Override
protected Application createApplication(Context context) {
    Context applicationContext = context.createChildContext();
    /* Retrieve the component manager and make it available in the restlet application context. */
    ComponentManager componentManager = getComponentManager();
    applicationContext.getAttributes().put(Constants.XWIKI_COMPONENT_MANAGER, componentManager);
    JaxRsApplication application;
    try {
        application = componentManager.getInstance(JaxRsApplication.class);
    } catch (ComponentLookupException e) {
        log("Failed to lookup default JAX-RS Application", e);
        return null;
    }
    application.setContext(applicationContext);
    // Make the servlet available
    try {
        JaxRsServletProvider applicationProvider = componentManager.getInstance(JaxRsServletProvider.class);
        applicationProvider.setApplication(this);
    } catch (ComponentLookupException e) {
        log("Failed to lookup JaxRsApplicationProvider. Dyncamically added/removed resources won'tbe supported", e);
    }
    return application;
}
Also used : Context(org.restlet.Context) ComponentManager(org.xwiki.component.manager.ComponentManager) JaxRsApplication(org.restlet.ext.jaxrs.JaxRsApplication) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException)

Aggregations

Context (org.restlet.Context)1 JaxRsApplication (org.restlet.ext.jaxrs.JaxRsApplication)1 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 ComponentManager (org.xwiki.component.manager.ComponentManager)1