Search in sources :

Example 1 with MultiApplicationUrlResolver

use of com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver in project xp by enonic.

the class ApplicationFactoryTest method createUrlResolver_dev_with_source.

@Test
public void createUrlResolver_dev_with_source() throws Exception {
    final Bundle bundle = deploy("app1", true, true);
    final ApplicationUrlResolver resolver = new ApplicationFactory(RunMode.DEV).createUrlResolver(bundle);
    assertNotNull(resolver);
    assertTrue(resolver instanceof MultiApplicationUrlResolver);
}
Also used : MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) ApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver) Bundle(org.osgi.framework.Bundle) TinyBundle(org.ops4j.pax.tinybundles.core.TinyBundle) MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver) Test(org.junit.jupiter.api.Test)

Example 2 with MultiApplicationUrlResolver

use of com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver in project xp by enonic.

the class ApplicationFactory method createUrlResolver.

ApplicationUrlResolver createUrlResolver(final Bundle bundle) {
    final ApplicationUrlResolver bundleUrlResolver = new BundleApplicationUrlResolver(bundle);
    if (this.runMode != RunMode.DEV) {
        return bundleUrlResolver;
    }
    final List<String> sourcePaths = ApplicationHelper.getSourcePaths(bundle);
    if (sourcePaths.isEmpty()) {
        return bundleUrlResolver;
    }
    final ApplicationUrlResolver classLoaderUrlResolver = createClassLoaderUrlResolver(sourcePaths);
    return new MultiApplicationUrlResolver(classLoaderUrlResolver, bundleUrlResolver);
}
Also used : MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) ApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver) ClassLoaderApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.ClassLoaderApplicationUrlResolver) BundleApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver) MultiApplicationUrlResolver(com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver)

Aggregations

ApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.ApplicationUrlResolver)2 BundleApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.BundleApplicationUrlResolver)2 MultiApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.MultiApplicationUrlResolver)2 ClassLoaderApplicationUrlResolver (com.enonic.xp.core.impl.app.resolver.ClassLoaderApplicationUrlResolver)1 Test (org.junit.jupiter.api.Test)1 TinyBundle (org.ops4j.pax.tinybundles.core.TinyBundle)1 Bundle (org.osgi.framework.Bundle)1