이클립스 코드 네비게이션 단축키

* 새로 만들기 Ctrl+N
* Quick Access Ctrl+3
* 코드 자동완성 Ctrl+Space
* import 정리 Ctrl+Shift+O
* 빨리 수정 Ctrl+1
* 한 줄 삭제 Ctrl+D
* 코드 정렬 Ctrl+Shift+F

* 선언한 곳으로 F3 또는 Ctrl+클릭
* 이전 위치로 Alt+←
* 파일 아웃라인 Ctrl+O
* 상속 구조 Ctrl+T
* 선택 문자 찾기 Ctrl+K
* 행번호로 이동 Ctrl+L
* 파일명으로 찾기 Ctrl+Shift+R
* 프로젝트 텍스트 검색 Ctrl+H

* 실행 Ctrl+F11
* 단축키 목록 Ctrl+Shift+L
* 단축키 설정 Ctrl+Shift+L 두 번




아프리카 방송 시작한지 100시간이 지났습니다.

http://afreeca.com/kenuheo


1,000시간 넘기는 때가 오겠죠.


외부의 오픈API가 callback을 지원하지 않으면 JSONP방식을 사용할 수 없습니다.

이런 경우 로컬의 도메인으로 세탁해주는 기능이 필요하고, 이 방식을 Proxy라고 얘기합니다.


간단한 샘플코드입니다.


package net.okjsp.ajax;


import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.MalformedURLException;

import java.net.URL;

import java.net.URLConnection;


public class Proxy {

public static void main(String[] args) throws Exception {

String sb = Proxy.getSource("http://okjsp.tistory.com/rss");

System.out.println(sb);

}


public static String getSource(String string) throws MalformedURLException,

IOException {

URL url = new URL(string);

URLConnection yc = url.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(

yc.getInputStream()));

String inputLine;

StringBuilder sb = new StringBuilder();

while ((inputLine = in.readLine()) != null) {

sb.append(inputLine).append("\n");

}

in.close();

return sb.toString();

}


}


proxy.jsp 입니다.

<%@page import="net.okjsp.ajax.Proxy"

%><%@ page contentType="text/plain; charset=utf-8"

    pageEncoding="UTF-8"

%><% 

String url = request.getQueryString();

%><%= Proxy.getSource(url) %>


이것을 호출하는 javascript입니다.

<!DOCTYPE html>

<html>

<head>

<title>AjaxProxy</title>

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

<script type="text/javascript">

$(function() {

$.ajax({

/* url : "http://www.marinetraffic.com/map/getjson/sw_x:125.62/sw_y:36.52/ne_x:128.02/ne_y:37.14/zoom:10/fleet:/station:0/id:null", 

*/

url : "proxy.jsp?http://www.marinetraffic.com/map/getjson/?",

dataType : "json",

data : {

sw_x : 125.62,

sw_y : 36.52,

ne_x : 128.02,

ne_y : 37.14,

zoom : 10,

station : 0,

id : 'null'

},

success : function(vessel) {

$.each(vessel, function(key, value) {

$("#result").append(value + '\n');

})

},

error : function(xhr, status, error) {

$("#result").append(error);

            }

});

});

</script>

</head>

<body>

<pre id="result"></pre>

</body>

</html>


간단한 이클립스 프로젝트 첨부합니다.

ajaxproxy.zip


+ Recent posts