IT 자료

java http인지 https인지 확인하는 법

성곤 2016. 12. 15. 10:16
반응형

java http인지 https인지 확인하는 법

 

request.isSecure() 를 이용하면 https는 true를 뱉어낸다.

if( request.isSecure() ) {

  //https

} else {

  //http
}

// 줄여서 이렇게 삼항연산자를 이용해서 프로토콜을 확인할 수도 있다.
String protocol = request.isSecure() ? "https://" : "http://";

 

반응형