본문 바로가기

Web/Spring

[Spring] Device 체크

반응형

디바이스 체크하는법은 화면에서 체크하는 법과 백단에서 체크하는법이 있습니다.

해당 포스트에서는 Spring Mobile Device Resolution을 이용하여 백단에서 체크하는법을 포스팅합니다.

Spring Mobile Device Resolution 사용하기

1. spring Mobile Device api를 사용하기 위해 의존성 추가.

2. divice class를 사용하기위해 DeviceResolverHandlerInterceptor를 생성한후 dispatcherServlet을 설정 해줍니다.

3. DeviceUtiles.getCurrentDevice(request) 메서드를 통해 해당 유입 요청의 디바이스 정보를 사용할수 있다.

반응형