@Override public URL create(Entity entity, Tenant tenant, URLType type) { Preconditions.checkNotNull(entity, "Cannot create URL for a null entity"); // Check against CM if there is a entity URL factory registered with the type reference of // EntityURLFactory<EntityClass>, if not, use the "generic" (in the sense of default) // URL creation provided by super.create() try { EntityURLFactory urlFactory = this.componentManager.getInstance(entityURLFactoryOf(entity.getClass()).getType()); if (urlFactory != null) { return urlFactory.create(entity, tenant, type); } } catch (ComponentLookupException e) { // Ignore, will return later } return super.create(entity, tenant, type); }
String uri = urlFactory.create(image.getAttachment()).getPath();
if (attachment != null) { Map<String, Object> imageMap = Maps.newHashMap(); imageMap.put("url", entityURLFactory.create(attachment, tenant)); imageMap.put("title", attachment.getTitle()); imageMap.put("extension", attachment.getExtension()); source.put("url", entityURLFactory.create(entity, tenant).toString()); source.put("api_url", entityURLFactory.create(entity, tenant, URLType.API).toString()); source.put("slug", entity.getSlug());
final String collectionPath = urlFactory.create(localized).getPath();