com.tobesoft.xplatform.tx
Class PlatformHttpClient

java.lang.Object
  extended bycom.tobesoft.xplatform.tx.PlatformHttpClient

public class PlatformHttpClient
extends java.lang.Object

HTTP 통신으로 데이터(PlatformData)를 송수신한다.

다음은 PlatformHttpClient을 이용하여 데이터를 송수신하는 예제이다.

 PlatformData reqData = ...;

 String url = "http://host/context/service.jsp";
 PlatformHttpClient client = new PlatformHttpClient(url, PlatformType.CONTENT_TYPE_XML);

 client.sendData(reqData);

 PlatformData resData = client.receiveData();

 client.close();
 

Author:
Choi, Jongkwan

Constructor Summary
PlatformHttpClient(java.lang.String spec)
          URL의 위치를 가지는 생성자이다.
PlatformHttpClient(java.lang.String spec, java.lang.String contentType)
          URL의 위치와 송수신 형식(contentType)을 가지는 생성자이다.
PlatformHttpClient(java.lang.String spec, java.lang.String contentType, java.lang.String charset)
          URL의 위치, 송수신 형식(contentType)과 문자셋(charset)을 가지는 생성자이다.
 
Method Summary
 void addProtocolType(java.lang.String protocolType)
          프로토콜 형식(protocolType)을 추가한다.
 void clearProtocolTypes()
          모든 프로토콜 형식(protocolType)을 삭제한다.
 void close()
          HTTP 연결을 종료한다.
 boolean containsProtocolType(java.lang.String protocolType)
          프로토콜 형식(protocolType)의 포함 여부를 검사한다.
 java.lang.String getCharset()
          문자셋(charset)을 반환한다.
 java.lang.String getContentType()
          송수신 형식(contentType)을 반환한다.
 java.lang.String getProtocolType(int index)
          프로토콜 형식(protocolType)을 반환한다.
 int getProtocolTypeCount()
          프로토콜 형식(protocolType)의 갯수를 반환한다.
 java.lang.String getStreamLogDir()
          예외발생시 수신받은 데이터(stream)를 저장할 위치를 반환한다.
 int getStreamLogMaxSize()
          isStreamLogEnabled가 "true" 인 경우 수신받을 데이터(stream)를 저장할 최대 버퍼 크기를 반환한다.
 boolean isStreamLogEnabled()
          예외발생시 수신받은 데이터(stream)의 저장 여부를 검사한다.
 boolean isVerbose()
          INFO 로그의 출력 여부를 검사한다.
 PlatformData receiveData()
          데이터(PlatformData)를 수신받는다.
 void removeProtocolType(int index)
          프로토콜 형식(protocolType)을 삭제한다.
 void removeProtocolType(java.lang.String protocolType)
          프로토콜 형식(protocolType)을 삭제한다.
 void sendData(PlatformData data)
          데이터(PlatformData)를 송신한다.
 void setCharset(java.lang.String charset)
          문자셋(charset)을 설정한다.
 void setContentType(java.lang.String contentType)
          송수신 형식(contentType)을 설정한다.
 void setStreamLogDir(java.lang.String streamLogDir)
          예외발생시 수신받은 데이터(stream)를 저장할 위치를 설정한다.
 void setStreamLogEnabled(boolean isStreamLogEnabled)
          예외발생시 수신받은 데이터(stream)의 저장 여부를 설정한다.
 void setStreamLogMaxSize(int streamLogMaxSize)
          isStreamLogEnabled가 "true" 인 경우 수신받을 데이터(stream)를 저장할 최대 버퍼 크기를 설정한다.
 void setVerbose(boolean verbose)
          INFO 로그의 출력 여부를 설정한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformHttpClient

public PlatformHttpClient(java.lang.String spec)
URL의 위치를 가지는 생성자이다.

Parameters:
spec - URL의 위치

PlatformHttpClient

public PlatformHttpClient(java.lang.String spec,
                          java.lang.String contentType)
URL의 위치와 송수신 형식(contentType)을 가지는 생성자이다.

Parameters:
spec - URL의 위치
contentType - 송수신 형식

PlatformHttpClient

public PlatformHttpClient(java.lang.String spec,
                          java.lang.String contentType,
                          java.lang.String charset)
URL의 위치, 송수신 형식(contentType)과 문자셋(charset)을 가지는 생성자이다.

Parameters:
spec - URL의 위치
contentType - 송수신 형식
charset - 문자셋
Method Detail

getContentType

public java.lang.String getContentType()
송수신 형식(contentType)을 반환한다.

Returns:
송수신 형식

setContentType

public void setContentType(java.lang.String contentType)
송수신 형식(contentType)을 설정한다.

Parameters:
contentType - 송수신 형식

getCharset

public java.lang.String getCharset()
문자셋(charset)을 반환한다.

Returns:
문자셋

setCharset

public void setCharset(java.lang.String charset)
문자셋(charset)을 설정한다.

Parameters:
charset - 문자셋

getProtocolType

public java.lang.String getProtocolType(int index)
프로토콜 형식(protocolType)을 반환한다. 프로토콜 형식은 압축, 암호화 등 데이터의 변형 형식을 의미한다.

Parameters:
index - 위치
See Also:
PlatformType.PROTOCOL_TYPE_ZLIB

addProtocolType

public void addProtocolType(java.lang.String protocolType)
프로토콜 형식(protocolType)을 추가한다. 프로토콜 형식은 압축, 암호화 등 데이터의 변형 형식을 의미한다.

Parameters:
protocolType - 프로토콜 형식
Throws:
java.lang.IllegalArgumentException - 프로토콜 형식(protocolType) 중복 추가시
See Also:
PlatformType.PROTOCOL_TYPE_ZLIB

removeProtocolType

public void removeProtocolType(int index)
프로토콜 형식(protocolType)을 삭제한다.

Parameters:
index - 위치

removeProtocolType

public void removeProtocolType(java.lang.String protocolType)
프로토콜 형식(protocolType)을 삭제한다.

Parameters:
protocolType - 프로토콜 형식

containsProtocolType

public boolean containsProtocolType(java.lang.String protocolType)
프로토콜 형식(protocolType)의 포함 여부를 검사한다.

Parameters:
protocolType - 프로토콜 형식
Returns:
프로토콜 형식의 포함 여부

clearProtocolTypes

public void clearProtocolTypes()
모든 프로토콜 형식(protocolType)을 삭제한다.


getProtocolTypeCount

public int getProtocolTypeCount()
프로토콜 형식(protocolType)의 갯수를 반환한다.

Returns:
프로토콜 형식의 갯수

isVerbose

public boolean isVerbose()
INFO 로그의 출력 여부를 검사한다. 기본값은 "false" 이며, 로깅 컴퍼넌트의 INFO 로그가 출력되도록 설정되어 있고, verbose가 "true" 인 경우에만 로그가 출력된다.

Returns:
INFO 로그의 출력 여부
See Also:
setVerbose(boolean)

setVerbose

public void setVerbose(boolean verbose)
INFO 로그의 출력 여부를 설정한다.

Parameters:
verbose - INFO 로그의 출력 여부
See Also:
isVerbose()

isStreamLogEnabled

public boolean isStreamLogEnabled()
예외발생시 수신받은 데이터(stream)의 저장 여부를 검사한다. Debug 용으로 메모리를 많이 사용하므로, 필요한 경우에만 사용한다.

Returns:
저장 여부
See Also:
setStreamLogEnabled(boolean), getStreamLogDir()

setStreamLogEnabled

public void setStreamLogEnabled(boolean isStreamLogEnabled)
예외발생시 수신받은 데이터(stream)의 저장 여부를 설정한다. 수신받은 데이터(stream)의 저장을 원하는 경우 반드시 설정되어야 한다. Debug 용으로 메모리를 많이 사용하므로, 필요한 경우에만 사용한다.

Parameters:
isStreamLogEnabled - 저장 여부
See Also:
isStreamLogEnabled(), getStreamLogDir()

getStreamLogDir

public java.lang.String getStreamLogDir()
예외발생시 수신받은 데이터(stream)를 저장할 위치를 반환한다. Debug 용으로 메모리를 많이 사용하므로, 필요한 경우에만 사용한다.

Returns:
저장 위치
See Also:
isStreamLogEnabled(), setStreamLogDir(String)

setStreamLogDir

public void setStreamLogDir(java.lang.String streamLogDir)
예외발생시 수신받은 데이터(stream)를 저장할 위치를 설정한다. 수신받은 데이터(stream)의 저장을 원하는 경우 반드시 설정되어야 한다. Debug 용으로 메모리를 많이 사용하므로, 필요한 경우에만 사용한다.

Parameters:
streamLogDir - 저장 위치
See Also:
isStreamLogEnabled(), getStreamLogDir()

getStreamLogMaxSize

public int getStreamLogMaxSize()
isStreamLogEnabled가 "true" 인 경우 수신받을 데이터(stream)를 저장할 최대 버퍼 크기를 반환한다. 기본값은 4MB 이다. Debug 용으로 메모리를 많이 사용하므로, 필요한 경우에만 사용한다.

Returns:
최대 버퍼 크기
See Also:
isStreamLogEnabled(), setStreamLogMaxSize(int)

setStreamLogMaxSize

public void setStreamLogMaxSize(int streamLogMaxSize)
isStreamLogEnabled가 "true" 인 경우 수신받을 데이터(stream)를 저장할 최대 버퍼 크기를 설정한다. Debug 용으로 메모리를 많이 사용하므로, 필요한 경우에만 사용한다.

Parameters:
streamLogMaxSize - 최대 버퍼 크기
See Also:
isStreamLogEnabled(), getStreamLogMaxSize()

sendData

public void sendData(PlatformData data)
              throws PlatformException
데이터(PlatformData)를 송신한다. 송수신 형식(contentType)이 설정되지 않은 경우 PlatformType.DEFAULT_CONTENT_TYPE이 적용된다.

Throws:
PlatformException

receiveData

public PlatformData receiveData()
                         throws PlatformException
데이터(PlatformData)를 수신받는다. 송수신 형식(contentType)이 설정되지 않은 경우 PlatformType.DEFAULT_CONTENT_TYPE이 적용된다.

Throws:
PlatformException

close

public void close()
HTTP 연결을 종료한다.



Copyright © 2000-2011 TOBESOFT Co., Ltd.