import javax.servlet.http.HttpServletRequest;
//...
@Autowiredเรียกใช้ตามนี้ครับ : _isLocalhost()==true? ... : ...
public HttpServletRequest request;
public boolean _isLocalhost() {
String[] _host = null;
boolean _localhost;
try {
_host = (request.getHeader("referer")).split("/");
} catch (Exception e) {
// TODO: handle exception
}
if (_host[2].equals("localhost")) {
_localhost = true ;
} else {
_localhost = false;
}
return _localhost;
}
ความคิดเห็น
แสดงความคิดเห็น