We've Apache on the top of JBoss serving either web or mobile application. We're presently using Apache mod-rewrite to determine where you can forward the consumer to web or mobile (and mod-jk to mount to JBoss), according to regular expressions matching of user-agent, but that's imprecise and error prone.
You want to make use of a servlet or jsp on JBoss included in determining whether or not to serve the net or mobile application (the servlet inspections the consumer-agent in WURFL to ascertain if this can be a mobile phone or perhaps a internet browser).
How do i create a rewrite-condition determined by the effect of a servlet/jsp ?
(I already considered redirecting the jsp to two possible Web addresses and continue the rewrite-rule logic after that, but this will get complicated with passing URL parameters backwards and forwards)
One conceptually simple way is by using a course-type rewritemap to call your EE-based plan to check a U-A, presuming this program could not just carry out the check itself (if you have only got a bit of canned java interface into that DB)
Once you uncover the UA, you should use the [cde] method, eg:
sendRedirect
Thus, a response.sendRedirect("http://mobile.example.com");
message is going to be send to the browser, redirecting it towards the correct URL.
Hope it will help.