반응형

아이폰 APNS와 같이 Android 도 Push 사용을 위해서는 방화벽을 열어야 한다.~

 

 

GCM 방화벽 포트는

 

- DNS

android.googleapis.com 443, 5228,5229,5230

 

 

깔끔하지 근데 도메인 오픈이 안된다고 한다면?

X되는거지~ 그럼 IP목록 줄테니 열어줘~ 하고 다음 목록을 던저 주면 된다.

 

 

- IP

대상 IP

Description

1.0.0.0/24

Research prefix for APNIC Labs Australia

1.1.1.0/24

Research prefix for APNIC Labs Australia

1.2.3.0/24

APNIC Debogon Project Australia

8.8.4.0/24

Google Inc. United States

8.8.8.0/24

Google Inc. United States

8.34.208.0/21

Google Inc. United States

8.34.216.0/21

Google Inc. United States

8.35.192.0/21

Google Inc. United States

8.35.200.0/21

Google Inc. United States

23.236.48.0/20

Google Inc. United States

23.251.128.0/19

Google Inc. United States

64.233.160.0/19

Google Inc. United States

64.233.160.0/24

Google Inc. United States

64.233.161.0/24

Google Inc. United States

64.233.162.0/24

Google Inc. United States

64.233.163.0/24

Google Inc. United States

64.233.164.0/24

Google Inc. United States

64.233.165.0/24

Google Inc. United States

64.233.166.0/24

Google Inc. United States

64.233.167.0/24

Google Inc. United States

64.233.168.0/24

Google Inc. United States

64.233.169.0/24

Google Inc. United States

64.233.171.0/24

Google Inc. United States

64.233.176.0/24

Google Inc. United States

64.233.177.0/24

Google Inc. United States

64.233.178.0/24

Google Inc. United States

64.233.179.0/24

Google Inc. United States

64.233.180.0/24

Google Inc. United States

64.233.181.0/24

Google Inc. United States

64.233.182.0/24

Google Inc. United States

64.233.183.0/24

Google Inc. United States

64.233.184.0/24

Google Inc. United States

64.233.185.0/24

Google Inc. United States

64.233.186.0/24

Google Inc. United States

64.233.187.0/24

Google Inc. United States

64.233.188.0/24

Google Inc. United States

64.233.189.0/24

Google Inc. United States

64.233.190.0/24

Google Inc. United States

64.233.191.0/24

Google Inc. United States

66.102.0.0/20

Google Inc. United States

66.102.1.0/24

Google Inc. United States

66.102.2.0/24

Google Inc. United States

66.102.3.0/24

Google Inc. United States

66.102.4.0/24

Google Inc. United States

66.102.12.0/24

Google Inc. United States

66.249.64.0/19

Google Inc. United States

66.249.68.0/24

Google Inc. United States

66.249.69.0/24

Google Inc. United States

66.249.70.0/24

Google Inc. United States

66.249.72.0/24

Google Inc. United States

66.249.78.0/24

Google Inc. United States

70.32.128.0/19

Google Inc. United States

70.32.132.0/23

Google Inc. United States

70.32.144.0/24

Google Inc. United States

70.32.148.0/23

Google Inc. United States

72.14.192.0/18

Google Inc. United States

72.14.244.0/23

Google Inc. United States

74.125.0.0/16

Google Inc. United States

74.125.0.0/18

Google Inc. United States

74.125.6.0/24

Google Inc. United States

74.125.18.0/24

Google Inc. United States

74.125.20.0/24

Google Inc. United States

74.125.21.0/24

Google Inc. United States

74.125.22.0/24

Google Inc. United States

74.125.23.0/24

Google Inc. United States

74.125.24.0/24

Google Inc. United States

74.125.25.0/24

Google Inc. United States

74.125.26.0/24

Google Inc. United States

74.125.27.0/24

Google Inc. United States

74.125.28.0/24

Google Inc. United States

74.125.29.0/24

Google Inc. United States

74.125.30.0/24

Google Inc. United States

74.125.36.0/24

Google Inc. United States

74.125.41.0/24

Google Inc. United States

74.125.42.0/24

Google Inc. United States

74.125.44.0/24

Google Inc. United States

74.125.45.0/24

Google Inc. United States

74.125.46.0/24

Google Inc. United States

74.125.47.0/24

Google Inc. United States

74.125.53.0/24

Google Inc. United States

74.125.54.0/23

Google Inc. United States

74.125.58.0/24

Google Incorporated United States

74.125.68.0/24

Google Inc. United States

74.125.69.0/24

Google Inc. United States

74.125.70.0/24

Google Inc. United States

74.125.71.0/24

Google Inc. United States

74.125.72.0/24

Google Inc. United States

74.125.73.0/24

Google Inc. United States

74.125.74.0/24

Google Inc. United States

74.125.75.0/24

Google Inc. United States

74.125.80.0/24

Google Inc. United States

74.125.88.0/23

Google Inc. United States

74.125.90.0/23

Google Inc. United States

74.125.117.0/24

Google Incorporated United States

74.125.118.0/24

Google Incorporated United States

74.125.119.0/24

Google Incorporated United States

74.125.127.0/24

Google Inc. United States

74.125.128.0/24

Google Inc. United States

74.125.129.0/24

Google Inc. United States

74.125.130.0/24

Google Inc. United States

74.125.133.0/24

Google Inc. United States

74.125.134.0/24

Google Inc. United States

74.125.135.0/24

Google Inc. United States

74.125.136.0/24

Google Inc. United States

74.125.139.0/24

Google Inc. United States

74.125.140.0/24

Google Inc. United States

74.125.141.0/24

Google Inc. United States

74.125.142.0/24

Google Inc. United States

74.125.143.0/24

Google Inc. United States

74.125.144.0/24

Google Inc. United States

74.125.176.0/24

Google Inc. United States

74.125.177.0/24

Google Inc. United States

74.125.181.0/24

Google Inc. United States

74.125.183.0/24

Google Inc. United States

74.125.186.0/24

Google Inc. United States

74.125.187.0/24

Google Inc. United States

74.125.190.0/24

Google Inc. United States

74.125.193.0/24

Google Inc. United States

74.125.194.0/24

Google Inc. United States

74.125.195.0/24

Google Inc. United States

74.125.196.0/24

Google Inc. United States

74.125.198.0/24

Google Inc. United States

74.125.200.0/24

Google Inc. United States

74.125.201.0/24

Google Inc. United States

74.125.202.0/24

Google Inc. United States

74.125.203.0/24

Google Inc. United States

74.125.204.0/24

Google Inc. United States

74.125.205.0/24

Google Inc. United States

74.125.206.0/24

Google Inc. United States

74.125.207.0/24

Google Inc. United States

74.125.224.0/24

Google Inc. United States

74.125.225.0/24

Google Inc. United States

74.125.226.0/24

Google Inc. United States

74.125.227.0/24

Google Inc. United States

74.125.228.0/24

Google Inc. United States

74.125.229.0/24

Google Inc. United States

74.125.230.0/24

Google Inc. United States

74.125.231.0/24

Google Inc. United States

74.125.232.0/24

Google Inc. United States

74.125.233.0/24

Google Inc. United States

74.125.234.0/24

Google Inc. United States

74.125.235.0/24

Google Inc. United States

74.125.236.0/24

Google Inc. United States

74.125.237.0/24

Google Inc. United States

74.125.238.0/24

Google Inc. United States

74.125.239.0/24

Google Inc. United States

104.135.128.0/18

Google Incorporated United States

104.154.0.0/15

Google Inc. United States

104.196.0.0/14

Google Inc. United States

107.167.160.0/19

Google Inc. United States

107.178.192.0/18

Google Inc. United States

108.59.80.0/20

Google Inc. United States

108.170.192.0/18

Google Inc. United States

108.177.0.0/17

Google Inc. United States

108.177.2.0/24

Google Inc. United States

108.177.4.0/23

Google Inc. United States

108.177.11.0/24

Google Inc. United States

108.177.12.0/24

Google Inc. United States

108.177.13.0/24

Google Inc. United States

130.211.0.0/16

Google Inc. United States

142.250.0.0/15

Google Inc. United States

146.148.0.0/17

Google Inc. United States

162.216.148.0/22

Google Inc. United States

162.222.176.0/21

Google Inc. United States

172.102.8.0/21

Google Inc. United States

172.102.8.0/24

Google Inc. United States

172.102.9.0/24

Google Inc. United States

172.102.10.0/24

Google Inc. United States

172.102.12.0/24

Google Inc. United States

172.102.13.0/24

Google Inc. United States

172.102.14.0/24

Google Inc. United States

172.102.15.0/24

Google Inc. United States

172.110.32.0/21

YouTube, LLC United States

172.217.0.0/16

Google Inc. United States

172.253.0.0/16

Google Inc. United States

173.194.0.0/16

Google Inc. United States

173.194.7.0/24

Google Inc. United States

173.194.32.0/24

Google Inc. United States

173.194.33.0/24

Google Inc. United States

173.194.34.0/24

Google Inc. United States

173.194.35.0/24

Google Inc. United States

173.194.36.0/24

Google Inc. United States

173.194.37.0/24

Google Inc. United States

173.194.38.0/24

Google Inc. United States

173.194.39.0/24

Google Inc. United States

173.194.40.0/24

Google Inc. United States

173.194.41.0/24

Google Inc. United States

173.194.42.0/24

Google Inc. United States

173.194.43.0/24

Google Inc. United States

173.194.44.0/24

Google Inc. United States

173.194.45.0/24

Google Inc. United States

173.194.46.0/24

Google Inc. United States

173.194.47.0/24

Google Inc. United States

173.194.53.0/24

Google Inc. United States

173.194.63.0/24

Google Inc. United States

173.194.64.0/24

Google Inc. United States

173.194.65.0/24

Google Inc. United States

173.194.67.0/24

Google Inc. United States

173.194.70.0/24

Google Inc. United States

173.194.71.0/24

Google Inc. United States

173.194.72.0/24

Google Inc. United States

173.194.74.0/24

Google Inc. United States

173.194.75.0/24

Google Inc. United States

173.194.77.0/24

Google Inc. United States

173.194.79.0/24

Google Inc. United States

173.194.90.0/24

Google Inc. United States

173.194.93.0/24

Google Inc. United States

173.194.99.0/24

Google Inc. United States

173.194.112.0/24

Google Inc. United States

173.194.113.0/24

Google Inc. United States

173.194.117.0/24

Google Inc. United States

173.194.118.0/24

Google Inc. United States

173.194.119.0/24

Google Inc. United States

173.194.120.0/24

Google Inc. United States

173.194.121.0/24

Google Inc. United States

173.194.124.0/24

Google Inc. United States

173.194.125.0/24

Google Inc. United States

173.194.126.0/24

Google Inc. United States

173.194.127.0/24

Google Inc. United States

173.194.132.0/24

Google Inc. United States

173.194.136.0/24

Google Inc. United States

173.194.140.0/24

Google Inc. United States

173.194.141.0/24

Google Inc. United States

173.194.142.0/24

Google Inc. United States

173.194.192.0/24

Google Inc. United States

173.194.193.0/24

Google Inc. United States

173.194.194.0/24

Google Inc. United States

173.194.195.0/24

Google Inc. United States

173.194.196.0/24

Google Inc. United States

173.194.197.0/24

Google Inc. United States

173.194.199.0/24

Google Inc. United States

173.194.200.0/24

Google Inc. United States

173.194.201.0/24

Google Inc. United States

173.194.202.0/24

Google Inc. United States

173.194.203.0/24

Google Inc. United States

173.194.204.0/24

Google Inc. United States

173.194.205.0/24

Google Inc. United States

173.194.206.0/24

Google Inc. United States

173.194.207.0/24

Google Inc. United States

173.194.208.0/24

Google Inc. United States

173.194.209.0/24

Google Inc. United States

173.194.210.0/24

Google Inc. United States

173.194.211.0/24

Google Inc. United States

173.194.212.0/24

Google Inc. United States

173.194.213.0/24

Google Inc. United States

173.194.214.0/24

Google Inc. United States

173.194.215.0/24

Google Inc. United States

173.194.216.0/24

Google Inc. United States

173.194.217.0/24

Google Inc. United States

173.194.218.0/24

Google Inc. United States

173.194.219.0/24

Google Inc. United States

173.194.220.0/24

Google Inc. United States

173.194.222.0/24

Google Inc. United States

173.194.223.0/24

Google Inc. United States

173.255.112.0/20

Google Inc. United States

185.25.28.0/22

Google Switzerland GmbH Switzerland

192.104.160.0/23

Google Inc. United States

192.158.28.0/22

Google Inc. United States

192.178.0.0/15

Google Inc. United States

199.192.112.0/22

Google Inc. United States

199.223.232.0/21

Google Inc. United States

207.223.160.0/20

Google Inc. United States

209.85.128.0/17

Google Inc. United States

209.85.145.0/24

Google Inc. United States

209.85.146.0/24

Google Inc. United States

209.85.147.0/24

Google Inc. United States

216.58.192.0/19

Google Inc. United States

216.58.208.0/24

Google Inc. United States

216.58.209.0/24

Google Inc. United States

216.58.210.0/24

Google Inc. United States

216.58.211.0/24

Google Inc. United States

216.58.212.0/24

Google Inc. United States

216.58.213.0/24

Google Inc. United States

216.58.214.0/24

Google Inc. United States

216.58.215.0/24

Google Inc. United States

216.58.216.0/24

Google Inc. United States

216.58.217.0/24

Google Inc. United States

216.58.218.0/24

Google Inc. United States

216.58.219.0/24

Google Inc. United States

216.58.220.0/24

Google Inc. United States

216.58.221.0/24

Google Inc. United States

216.58.222.0/24

Google Inc. United States

216.58.223.0/24

Google Inc. United States

216.239.32.0/19

Google Inc. United States

216.239.32.0/24

Google Inc. United States

216.239.33.0/24

Google Incorporated United States

216.239.34.0/24

Google Inc. United States

216.239.35.0/24

Google Incorporated United States

216.239.36.0/24

Google Inc. United States

216.239.38.0/24

Google Inc. United States

216.239.39.0/24

Google Incorporated United States

216.252.220.0/22

Google Inc. United States

216.252.220.0/24

Google Inc. United States

216.252.221.0/24

Google Inc. United States

216.252.222.0/24

Google Inc.

반응형



Posted by 궁극의 java개발자
,





반응형

Push Server 또는 Push third-party구현에 있어서 확인해야 될 사항중 하나인 방화벽...

 

보통 Push third-party는 WAS에 올라가게 된다. Web Server 와 WAS Server가 보통 분리되어 있는데 APNS를 이용하기 위해서는 WAS Server 에 방화벽을 해제 해야 한다.

 

해제할 IP와 Port는

 

 

- IP

17.0.0.0/8 443,2195,2196,5223

 

- DNS
gateway.push.apple.com 2195
feedback.push.apple.com 2196

 

 

IP또는 DNS 둘중 하나를 열어야 하는데 보통 보안때문에 도메인 오픈을 잘 안해준다. ㅋㅋ 그럼 IP를 오픈해야 되는데 범위가 장난 아니쥐~ 그래도 Push를 사용할려면 오픈해야 Push가 정상적으로 전송된다.

 

근데... 오픈 못해준다고 하면 때쓴다~ 우는 소리 한다~ 그래도 안열어주면~

 

최악의 상황 ~

 

보통의 경우 WAS는 DMZ존에 있기 때문에 방화벽 오픈이 힘든 경우가 많다~ 그래서~ 그래서~ 최악의 상황에서 방법은 Web서버를 이용하는 거지...

 

살짝 어두운 그림자... 느낌상 뭔가 크게 작업을 해야하는 느낌...

 

방법

 

WAS > Web > APNS

 

ㅡㅡ; 웹 서버에 무료 톰캣 깔고 실행하게 해주는 방법밖에는 ㅋㅋ

 

그러니 프로젝트 계약할때 꼼꼼히 확인할 필요가 있다~ Push를 사용하면 WAS 방화벽 처리해주는 조건은 필수 ㅋㅋ

 

ps. 애플에서는 DNS오픈을 권장한다~ 왜? IP가 그때그때 다를수 있기 때문에~ 지네들도 장담 못한단다. 대신 17.0.0.0/8 요 범위 안에서 맘대로 바뀔수있다는 전제하에~

반응형



Posted by 궁극의 java개발자
,





반응형

웹에서 데이터를 주고 받을때 사용하는 html태그들은 한정적이다. input box, radio, selectbox, checkbox 등이 있다.

이 중에서도 checkbox의 경우 동일한 태그 이름(name, id)로 구성을 하고 다중으로 체크한뒤 전송하게 되면
받는쪽에서는 체크되어있던 값들만 전송이 된다.

위에서 말했듯이 동일한 이름이 다중으로 넘어오면 받는쪽에서도 역시 다중으로 받을수 있게 처리해줘야 한다.


일반적인 방법으로는 request.getParameterValues 를 이용하여 배열로 받으면 된다.


[보내는 쪽]

<checkbox name="type" id="type" value="M" />
<checkbox name="type" id="type" value="S" />
<checkbox name="type" id="type" value="W" />

 



[받는쪽]

String[] type = request.getParameterValues("type") ;

 




위와같이 작성하면 체크한 값들만 전송되므로 해당 값들을 이용하여 다음 로직들을 작성하면 된다.


만약 위 소스처럼 받아온 값들이 어떠한 순서를 가지고 있고, 그 순서대로 값이 들어오길 바란다면 해당 방법은 사용 안하는게 좋다.

위에서 전송되는 순서는 사실 순서보장이 될 수도 있고, 보장이 되지 않을수도 있다.
순서가 100번 보장이 된다하더라도 단 1번 안되면 그것은 오류로 연결되므로 문제가 있다.

체크박스의 값들이 순서대로 전송이 되느냐 아니냐는 예전부터 많은 이야기가 있었다.
해당 내용에대한 명백한 결론은 없지만, 개발자들 사이에서 내린 결론은 순서를 보장해야 하는 경우

체크박스나 다른 전송되는 type의 태그 이름을 동일한 이름(name, id)로 처리하지 말자였다.

위에서 말했듯이 100번중에 1번 잘못 전송되면 오류다.

조그마한 확률이라도 오류가 발생하면 문제가 되는만큼 애초에 걱정할거리를 없애는게 맞다.


나 같은경우 순서가 보장되어야 하는 경우 보통은 아래처럼 개발한다.



[보내는 쪽]

<checkbox name="type_0" id="type_0" value="M" />
<checkbox name="type_1" id="type_1" value="S" />
<checkbox name="type_2" id="type_2" value="W" />

 



[받는쪽]

ArrayList arrType = new Arraylist();
for(int i=0; i < 3; i++){
String tmpType = request.getParameter("type_" + i);

if(tmpType != null && !"".equals(tmpType)
arrType.put(tmpType);
}

 




결국은 순서가 보장되어야 하는 태그 이름뒤에 순차적으로 숫자를 부여한 후 받는쪽에서 값이 있는 녀석들만 arrayList 같은곳에 담아 사용하면 된다.

위 두가지의 케이스는 상황에 따르게 적절하게 사용해야 한다.

순서가 보장이 안되도 상관없는 일반적인 상황이라면 request.getParameterValues 를 사용하는게 좋다.
불필요한 코드를 추가할 필요도 없으며 편하게 사용이 가능하니까 말이다.

반응형



Posted by 궁극의 java개발자
,





반응형

특정 문자열에서 원하는 문자가 포함되어 있는지 확인해야 될 때가 있다.
주로 문자열 포함 여부에 따라서 if문과 같은 분기문을 작성하거나 할때가 그러한데, Java에서는 여러가지 방법으로 문자열 검색이 가능하다.

그중에서도 오늘은 contains, indexOf, matches를 이용하여 문자열을 검색하는 방법을 포스팅 하겠다.

[예제]

public class StringFinder {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		
		
		String txt1 = "가나다라" ;
		String txt2 = "해당 내용은 테스트 입니다" ;
		String txt3 = "가격은 29,000원 입니다" ;
		
		
		
		// contains를 이용한 방법(true, false 반환)
		if(txt1.contains("나다"))
			System.out.println("문자열 있음!");
		else
			System.out.println("문자열 없음!");
		
		
		// indexOf를 이용한 방법
		if(txt2.indexOf("테스트") > -1)
			System.out.println("문자열 있음!");
		else
			System.out.println("문자열 없음!");
		
		
		// matches를 이용한 방법
		if(txt2.matches(".*테스트.*"))
			System.out.println("문자열 있음!");
		else
			System.out.println("문자열 없음!");
		
		
		// matches를 이용하여 정규 표현식으로 문자열에 숫자가 있는지 확인
		if(txt3.matches(".*[0-9].*"))
			System.out.println("숫자 있음!");
		else
			System.out.println("숫자 없음!");

	}

}


 

구분

설명

포함

미포함

contains

문자열에 검색하고자 하는 문자가 있는지 확인

true

false

indexOf

문자열에서 검색하는 문자의 위치를 반환

문자 위치

-1

matches

정규식을 이용하여 문자열을 검색한다.

특정 문자열을 검색할때 사용하기 보다는 한글, 숫자 등과 같이 해당 형태의 텍스트가 존재하는지 확인할때 사용하면 좋다

true

false

 



 

반응형



Posted by 궁극의 java개발자
,