public ResolvedDevice resolve(Device device, PathSegments path, LocalParams parameters) { return resolve(device, path, parameters, resolveCapabilities(device)); }
@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()); } }
public ResolvedDevice resolve(Device device, PathSegments path) { return resolve(device, path, getParameters(), resolveCapabilities(device)); }
@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; } }
public ResolvedDevice resolve(Device device) { return resolve(device, getPath(), getParameters(), resolveCapabilities(device)); } }
/** * @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()); }
/** * @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; }