net.daum.dna.util
Class APIUtils

java.lang.Object
  extended by net.daum.dna.util.APIUtils

public class APIUtils
extends java.lang.Object

Author:
DAUM

Field Summary
static java.lang.String _API_COMMON_EXCEPTION_MESSAGE
          The Constant _API_COMMON_EXCEPTION_MESSAGE.
static int _API_OK_RESPONSE_CODE
          The api ok response_code.
static java.lang.String _BLOG_CATEGORY_LIST_URL
          The Constant _BLOG_CATEGORY_LIST_URL.
static java.lang.String _BLOG_COMMENT_LIST_URL
          The Constant _BLOG_COMMENT_LIST_URL.
static java.lang.String _BLOG_COMMENT_WRITE_URL
          The Constant _BLOG_COMMENT_WRITE_URL.
static java.lang.String _BLOG_INFO_BLOG_URL
          The Constant _BLOG_INFO_BLOG_URL.
static java.lang.String _BLOG_INFO_MYACTIVITY_URL
          The Constant _BLOG_INFO_MYACTIVITY_URL.
static java.lang.String _BLOG_POST_LIST_URL
          The Constant _BLOG_POST_LIST_URL.
static java.lang.String _BLOG_POST_MODIFY_URL
          The Constant _BLOG_POST_MODIFY_URL.
static java.lang.String _BLOG_POST_READ_URL
          The Constant _BLOG_POST_READ_URL.
static java.lang.String _BLOG_POST_WRITE_URL
          The Constant _BLOG_POST_WRITE_URL.
static java.lang.String _BLOG_RSS_LIST_URL
          The Constant _BLOG_RSS_LIST_URL.
static java.lang.String _CAFE_ALIMIS_URL
          The Constant _CAFE_ALIMIS_URL.
static java.lang.String _CAFE_ARTICLES_URL
          The Constant _CAFE_ARTICLES_URL.
static java.lang.String _CAFE_BOARDS_URL
          The Constant _CAFE_BOARDS_URL.
static java.lang.String _CAFE_FAVORITE_CAFE_URL
          The Constant _CAFE_FAVORITE_CAFE_URL.
static java.lang.String _CAFE_RECENT_ARTICLE_URL
          The Constant _CAFE_RECENT_ARTICLE_URL.
static java.lang.String _CAFE_WRITE_ARTICLE_URL
          The Constant _CAFE_WRITE_ARTICLE_URL.
static java.lang.String _HTTP_REQUEST_GET
          The Constant _HTTP_REQUEST_GET.
static java.lang.String _HTTP_REQUEST_POST
          The Constant _HTTP_REQUEST_POST.
static java.lang.String _XML
          The Constant _DATA_FORMAT_FORM_XML.
static java.lang.String _YOZM_ARTICLE_LIST_URL
          The Constant _YOZM_ARTICLE_LIST_URL.
static java.lang.String _YOZM_JOIN_INFO_URL
          The Constant _YOZM_JOIN_INFO_URL.
static java.lang.String _YOZM_JOIN_YOZM_URL
          The Constant _YOZM_JOIN_YOZM_URL.
static java.lang.String _YOZM_SEARCH_ARTICLES_URL
          The Constant _YOZM_SEARCH_ARTICLES_URL.
static java.lang.String _YOZM_SHOW_USER_INFO_URL
          The Constant _YOZM_SHOW_USER_INFO_URL.
static java.lang.String _YOZM_SPECIFIC_ARTICLES_URL
          The Constant _YOZM_SHOW_USER_ARTICLE_URL.
static java.lang.String _YOZM_WRITE_MESSAGE_URL
          The Constant _YOZM_WRITE_MESSAGE_URL.
 
Method Summary
 java.lang.String buildQueryString(Params required)
          객체로 받은 parameter 들을 queryString 형태로 만들어줍니다.
 java.lang.String buildQueryString(Params required, Params option)
          객체로 받은 parameter 들을 queryString 형태로 만들어준다.
 java.lang.String changeToString(java.io.InputStream is)
          입력받은 InputStream을 string으로 변환시켜 줍니다.
 java.net.HttpURLConnection getHttpURLConnection(java.lang.String fullURL, java.lang.String method, DaumOAuth oauth)
          query 와 method , oauth token 을 받아서 API 에 호출하는 합니다.
static APIUtils getInstance()
          Gets the single instance of APIUtils.
 boolean isAPIError(org.jdom.Element root)
          API error 발생여부를 체크합니다.
 java.lang.String toJSONString(java.lang.String xmlString)
          xml String을 json String 으로 만들어줍니다.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_API_OK_RESPONSE_CODE

public static final int _API_OK_RESPONSE_CODE
The api ok response_code.

See Also:
Constant Field Values

_API_COMMON_EXCEPTION_MESSAGE

public static final java.lang.String _API_COMMON_EXCEPTION_MESSAGE
The Constant _API_COMMON_EXCEPTION_MESSAGE.

See Also:
Constant Field Values

_HTTP_REQUEST_POST

public static final java.lang.String _HTTP_REQUEST_POST
The Constant _HTTP_REQUEST_POST.

See Also:
Constant Field Values

_HTTP_REQUEST_GET

public static final java.lang.String _HTTP_REQUEST_GET
The Constant _HTTP_REQUEST_GET.

See Also:
Constant Field Values

_XML

public static final java.lang.String _XML
The Constant _DATA_FORMAT_FORM_XML.

See Also:
Constant Field Values

_BLOG_POST_LIST_URL

public static final java.lang.String _BLOG_POST_LIST_URL
The Constant _BLOG_POST_LIST_URL.

See Also:
Constant Field Values

_BLOG_POST_WRITE_URL

public static final java.lang.String _BLOG_POST_WRITE_URL
The Constant _BLOG_POST_WRITE_URL.

See Also:
Constant Field Values

_BLOG_POST_MODIFY_URL

public static final java.lang.String _BLOG_POST_MODIFY_URL
The Constant _BLOG_POST_MODIFY_URL.

See Also:
Constant Field Values

_BLOG_POST_READ_URL

public static final java.lang.String _BLOG_POST_READ_URL
The Constant _BLOG_POST_READ_URL.

See Also:
Constant Field Values

_BLOG_CATEGORY_LIST_URL

public static final java.lang.String _BLOG_CATEGORY_LIST_URL
The Constant _BLOG_CATEGORY_LIST_URL.

See Also:
Constant Field Values

_BLOG_COMMENT_LIST_URL

public static final java.lang.String _BLOG_COMMENT_LIST_URL
The Constant _BLOG_COMMENT_LIST_URL.

See Also:
Constant Field Values

_BLOG_COMMENT_WRITE_URL

public static final java.lang.String _BLOG_COMMENT_WRITE_URL
The Constant _BLOG_COMMENT_WRITE_URL.

See Also:
Constant Field Values

_BLOG_RSS_LIST_URL

public static final java.lang.String _BLOG_RSS_LIST_URL
The Constant _BLOG_RSS_LIST_URL.

See Also:
Constant Field Values

_BLOG_INFO_BLOG_URL

public static final java.lang.String _BLOG_INFO_BLOG_URL
The Constant _BLOG_INFO_BLOG_URL.

See Also:
Constant Field Values

_BLOG_INFO_MYACTIVITY_URL

public static final java.lang.String _BLOG_INFO_MYACTIVITY_URL
The Constant _BLOG_INFO_MYACTIVITY_URL.

See Also:
Constant Field Values

_CAFE_ALIMIS_URL

public static final java.lang.String _CAFE_ALIMIS_URL
The Constant _CAFE_ALIMIS_URL.

See Also:
Constant Field Values

_CAFE_ARTICLES_URL

public static final java.lang.String _CAFE_ARTICLES_URL
The Constant _CAFE_ARTICLES_URL.

See Also:
Constant Field Values

_CAFE_BOARDS_URL

public static final java.lang.String _CAFE_BOARDS_URL
The Constant _CAFE_BOARDS_URL.

See Also:
Constant Field Values

_CAFE_FAVORITE_CAFE_URL

public static final java.lang.String _CAFE_FAVORITE_CAFE_URL
The Constant _CAFE_FAVORITE_CAFE_URL.

See Also:
Constant Field Values

_CAFE_RECENT_ARTICLE_URL

public static final java.lang.String _CAFE_RECENT_ARTICLE_URL
The Constant _CAFE_RECENT_ARTICLE_URL.

See Also:
Constant Field Values

_CAFE_WRITE_ARTICLE_URL

public static final java.lang.String _CAFE_WRITE_ARTICLE_URL
The Constant _CAFE_WRITE_ARTICLE_URL.

See Also:
Constant Field Values

_YOZM_WRITE_MESSAGE_URL

public static final java.lang.String _YOZM_WRITE_MESSAGE_URL
The Constant _YOZM_WRITE_MESSAGE_URL.

See Also:
Constant Field Values

_YOZM_SHOW_USER_INFO_URL

public static final java.lang.String _YOZM_SHOW_USER_INFO_URL
The Constant _YOZM_SHOW_USER_INFO_URL.

See Also:
Constant Field Values

_YOZM_JOIN_INFO_URL

public static final java.lang.String _YOZM_JOIN_INFO_URL
The Constant _YOZM_JOIN_INFO_URL.

See Also:
Constant Field Values

_YOZM_JOIN_YOZM_URL

public static final java.lang.String _YOZM_JOIN_YOZM_URL
The Constant _YOZM_JOIN_YOZM_URL.

See Also:
Constant Field Values

_YOZM_SEARCH_ARTICLES_URL

public static final java.lang.String _YOZM_SEARCH_ARTICLES_URL
The Constant _YOZM_SEARCH_ARTICLES_URL.

See Also:
Constant Field Values

_YOZM_ARTICLE_LIST_URL

public static final java.lang.String _YOZM_ARTICLE_LIST_URL
The Constant _YOZM_ARTICLE_LIST_URL.

See Also:
Constant Field Values

_YOZM_SPECIFIC_ARTICLES_URL

public static final java.lang.String _YOZM_SPECIFIC_ARTICLES_URL
The Constant _YOZM_SHOW_USER_ARTICLE_URL.

See Also:
Constant Field Values
Method Detail

getInstance

public static APIUtils getInstance()
Gets the single instance of APIUtils.

Returns:
single instance of APIUtils

changeToString

public java.lang.String changeToString(java.io.InputStream is)
입력받은 InputStream을 string으로 변환시켜 줍니다.

Parameters:
is - inputstream
Returns:
the string

getHttpURLConnection

public java.net.HttpURLConnection getHttpURLConnection(java.lang.String fullURL,
                                                       java.lang.String method,
                                                       DaumOAuth oauth)
query 와 method , oauth token 을 받아서 API 에 호출하는 합니다.

Parameters:
fullURL - fullURL
method - the method (post or get)
oauth - the oauth
Returns:
the http url connection

isAPIError

public boolean isAPIError(org.jdom.Element root)
API error 발생여부를 체크합니다. API error이 발생했다면 true, 발생하지 않았다면 false를 반환합니다.

Parameters:
root - the root element
Returns:
true or false 반환

buildQueryString

public java.lang.String buildQueryString(Params required)
객체로 받은 parameter 들을 queryString 형태로 만들어줍니다.

Parameters:
required - 파라미터
Returns:
the query string

buildQueryString

public java.lang.String buildQueryString(Params required,
                                         Params option)
객체로 받은 parameter 들을 queryString 형태로 만들어준다.

Parameters:
required - 필수 파라미터들
option - 옵션 파라미터들
Returns:
QueryString

toJSONString

public java.lang.String toJSONString(java.lang.String xmlString)
xml String을 json String 으로 만들어줍니다.

Parameters:
xmlString - the xml string
Returns:
the Json String