we want to use the WURFL/ScientiaMobile API within a plain Java application, without ServletContext and without Spring. We use the API as follows to build the WURFLEngine manually:
Code: Select all
// setup WURFL engine
InputStream in = WurflRawClassifier.class.getResourceAsStream("/path/to/wurfl.xml");
WURFLResource resource = new XMLResource(in, "wurfl.xml");
GeneralWURFLEngine engine = new GeneralWURFLEngine(resource);
engine.setEngineTarget(EngineTarget.accuracy);
engine.setCacheProvider(new LRUMapCacheProvider());
// get device information
Device device = engine.getDeviceForRequest("Some user agent string");
String deviceId = device.getId();
String deviceRootId = device.getDeviceRootId();
String matchType = device.getMatchType().name();
Map<String, String> capabilities = device.getCapabilities();
Map<String, String> virtualCapabilities = device.getVirtualCapabilities();
Thanks,
Stefan