File tree Expand file tree Collapse file tree
spring-mobile/src/main/java/com/baeldung Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77public class Application {
88
99 public static void main (String [] args ) {
10- SpringApplication .run (Application .class , args );
10+ SpringApplication .run (Application .class , args );
1111 }
1212
13- }
13+ }
14+
Original file line number Diff line number Diff line change 88
99@ Controller
1010public class IndexController {
11-
11+
1212 private final static Logger LOGGER = Logger .getLogger (IndexController .class .getName ());
1313
1414 @ GetMapping ("/" )
15- public String greeting (Device device ) {
16-
15+ public String greeting (Device device ) {
16+
1717 String deviceType = "browser" ;
1818 String platform = "browser" ;
19-
20- if (device .isNormal ()) {
21- deviceType = "browser" ;
22- } else if (device .isMobile ()) {
23- deviceType = "mobile" ;
24- } else if (device .isTablet ()) {
25- deviceType = "tablet" ;
26- }
27-
28- platform = device .getDevicePlatform ().name ();
29-
30- if (platform .equalsIgnoreCase ("UNKNOWN" )) {
31- platform = "browser" ;
19+
20+ if (device .isNormal ()) {
21+ deviceType = "browser" ;
22+ } else if (device .isMobile ()) {
23+ deviceType = "mobile" ;
24+ } else if (device .isTablet ()) {
25+ deviceType = "tablet" ;
3226 }
33-
34- LOGGER .info ("Client Device Type: " + deviceType +", Platform: " + platform );
35-
36-
37- return "index" ;
38- }
39-
27+
28+ platform = device .getDevicePlatform ().name ();
29+
30+ if (platform .equalsIgnoreCase ("UNKNOWN" )) {
31+ platform = "browser" ;
32+ }
33+
34+ LOGGER .info ("Client Device Type: " + deviceType + ", Platform: " + platform );
35+
36+ return "index" ;
37+ }
38+
4039}
You can’t perform that action at this time.
0 commit comments