Alternative to spring-mobile
Asked Answered
B

0

6

I have a requirement where in all controllers I need to understand device type (desktop, mobile, tablet) and based on that I may need to send request to a different view. Right now, I have littered my controllers with duplicate code that does following:

  1. Get User-Agent from HttpServletRequest
  2. Find device type by matching User Agent string containing multiple pre-defined keywords in an array.
  3. Use if/else statement to forward request to different view based on detected device type

To fix this I found out that spring-mobile is able to help with this. But unfortunately it looks like this project is abandoned. I am looking for a better alternative as a dependency or maybe a better design pattern to handle this problem.

Babette answered 4/5, 2022 at 5:41 Comment(2)
I am facing the same problem. Have you found any solution?Vagrant
how do you find Device type with HttpServletRequest. As you have mentioned in second step that you matched User-Agent containing pre-defined keywords. What are those Keywords?Vagrant

© 2022 - 2024 — McMap. All rights reserved.