public ResolvedDevice resolve(Device device) { return resolve(device, getPath(), getParameters(), resolveCapabilities(device)); } }
public ResolvedDevice resolve(Device device, PathSegments path, LocalParams parameters) { return resolve(device, path, parameters, resolveCapabilities(device)); }
public ResolvedDevice resolve(Device device, PathSegments path) { return resolve(device, path, getParameters(), resolveCapabilities(device)); }
/** * @see com.isotrol.impe3.api.DeviceResolver#resolveDevice(com.isotrol.impe3.api.DeviceResolutionParams) */ public ResolvedDevice resolveDevice(DeviceResolutionParams params) { final DevicesInPortal dips = params.getPortal().getDevices(); final PathSegments path = params.getPath(); Device d = dips.findDeviceByFirstSegment(path); if (d != null) { return params.resolve(d, path.consume()); } d = dips.findDeviceByLastSegment(path); if (d != null) { return params.resolve(d, path.consumeLast()); } d = dips.findDeviceByLastSegmentExtension(path); if (d != null) { return params.resolve(d, path.removeExtension()); } return null; }
public ResolvedDevice resolveDevice(DeviceResolutionParams params) { final Portal portal = params.getPortal(); final PathSegments path = params.getPath(); DevicesInPortal dips = portal.getDevices(); if (config != null && !config.includeDefault()) { dips = dips.excludeDevice(portal.getDevice()); } final Device d = portal.getDevices().findDeviceByFirstSegment(path); if (d != null) { return new ResolvedDevice(path.consume(), d, new DefaultDeviceCapabilities(d), params.getParameters()); } return null; } }
/** * @see com.isotrol.impe3.api.DeviceResolver#resolveDevice(com.isotrol.impe3.api.DeviceResolutionParams) */ public ResolvedDevice resolveDevice(DeviceResolutionParams params) { ResolvedDevice rd = DeviceNameUseDeviceResolver.get().resolveDevice(params); if (rd != null) { return rd; } return params.resolve(params.getPortal().getDevice()); }
@Override ResolvedDevice resolve(DeviceResolutionParams params, Iterable<DeviceInPortal> devices) { if (devices == null) { return null; } final List<String> uas = params.getHeaders().getRequestHeader(HttpHeaders.USER_AGENT); if (uas == null || uas.isEmpty()) { return null; } final String ua = uas.get(0); for (DeviceInPortal dip : devices) { final Device device = dip.getDevice(); if (device.matchesUA(ua)) { return params.resolve(device); } } return null; } }
@Override ResolvedDevice resolve(DeviceResolutionParams params, Iterable<DeviceInPortal> devices) { final DeviceCapabilities caps = params.getCapabilities(); if (caps == null || devices == null) { return null; } List<DeviceInPortal> ordered = ORDER.sortedCopy(Iterables.filter(devices, WITH_WIDTH)); if (ordered == null || ordered.isEmpty()) { return null; } int width = caps.getWidth(); for (DeviceInPortal dip : ordered) { if (width <= dip.getDevice().getWidth()) { return params.resolve(dip.getDevice()); } } return params.resolve(ordered.get(ordered.size() - 1).getDevice()); } }
/** * @see com.isotrol.impe3.api.DeviceResolver#resolveDevice(com.isotrol.impe3.api.DeviceResolutionParams) */ public final ResolvedDevice resolveDevice(DeviceResolutionParams params) { DevicesInPortal dips = params.getPortal().getDevices(); if (!uses) { dips = dips.filterByUse(DeviceNameUse.NONE); } return resolve(params, Iterables.filter(dips.values(), filter)); }
private DeviceCapabilities resolveCapabilities(Device d) { return resolveCapabilities(d, null); }
public ResolvedDevice resolve(Device device, PathSegments path, LocalParams parameters, DeviceCapabilities capabilities) { return new ResolvedDevice(path, device, resolveCapabilities(device, capabilities), parameters); }