How would one go about using the Java API without implementing it inside a servlet (as in all the examples). We want to integrate it as a pure Java solution into our existing web applications. In other words, we simple want to instantiate the correct classes and be able to do the lookups.
Would one only need to use the GeneralWURFLEngine for this?
Using the Java API outside a servlet
-
- Posts: 38
- Joined: Tue Jan 31, 2012 10:27 am
Re: Using the Java API outside a servlet
Of course.AdDynamo wrote:Would one only need to use the GeneralWURFLEngine for this?
The method
Code: Select all
public Device GeneralWURFLEngine.getDeviceForRequest(HttpServletRequest request)
The servlet example provided with the Java API has one only HttpServlet, hence it owns all the code for simplicity.
Nevertheless, it already shows how to instantiate a GeneralWURFLEngine at initialization time, and share it to all servlets belonging to the web application through the ServletContext, so that the device matching can be performed by one single (though quite cumbersome) line of code:
Code: Select all
Device device = ((GeneralWURFLEngine)getServletContext().getAttribute(WurflWebConstants.WURFL_HOLDER_KEY_PARAM)).getDeviceForRequest(request);
If I did not answered your question, maybe I did not understand what you mean by
Just please describe what you would like to avoid in each Servlet, and I will be glad to help you further.AdDynamo wrote:without implementing it inside a servlet (as in all the examples)
Regards,
Fulvio
Re: Using the Java API outside a servlet
No, this is 100%. Thank you very much
Who is online
Users browsing this forum: No registered users and 2 guests