Check out the latest documentation.

Servlet Data Update - Version 3

Java websites that are built upon the FiftyOneDegreesServlet can make use of automatic data updates simply by specifying a data file path in web.xml (BINARY_FILE_PATH) and placing a .lic file provided by 51Degrees in the WEB-INF folder.

New data will be automatically downloaded which will then be used to update the servlet dataset.

Update events and errors are logged. See the Logging page for more information.

Enable Automatic Updates in the Webapp Package - Version 2

If your java page extends the FiftyOneServlet from the webapp project then automatic updates can be achieved by changing the Listener class's source code. The Listener class can also be found in webapp and extends the Factory class which enables automatic updates to the core. The licence key needs to be added to the contextInitialized method:

										
										/**
										
										
										     * Initialises the 51Degrees.mobi factory with a provider and auto update
										
										
										     * settings to enable servlets to be able to access properties of the 
										
										
										     * requesting device.
										
										
										     * 
										
										
										     * @param contextEvent 
										
										
										     */
										
										
										@Override
										
										
										public
										
										
										void
										
										
										contextInitialized
										
										
										(
										
									ServletContextEvent contextEvent
										
										)
										
										
										{
										
										
										try
										
										
										{
										
										
										// first try to get premium data
										
									
        initialize
										
										(
										
									
            contextEvent
										
										.
										
										
										getServletContext
										
										
										().
										
										
										getRealPath
										
										
										(
										
									Constants
										
										.
										
										
										DEFAULT_DATA_FILE_PATH
										
										
										),
										
										
										"LICENCE_KEY_HERE"
										
										
										);
										
										
										// by default this parameter is null
										
										
										}
										
										
										catch
										
										
										(
										
									Exception ex
										
										)
										
										
										// failed, now get lite data
										
										
										{
										
									
            initialize
										
										();
										
										
										}
										
									
        contextEvent
										
										.
										
										
										getServletContext
										
										
										().
										
										
										setAttribute
										
										
										(
										
									Constants
										
										.
										
										
										FACTORY_KEY
										
										
										,
										
										
										this
										
										
										);
										
									
        logger
										
										.
										
										
										info
										
										
										(
										
										
										"51Degrees.mobi Listener initialised"
										
										
										);
										
										
										}