javax.microedition.io
Interface HttpsConnection
- All Superinterfaces:
- Connection, ContentConnection, HttpConnection, InputConnection, OutputConnection, StreamConnection
- public interface HttpsConnection
- extends HttpConnection
ÀÌ ÀÎÅÍÆäÀ̽º´Â º¸¾È ³×Æ®¿öÅ© ¿¬°áÀ» ¼³Á¤ÇÏ´Â µ¥
ÇÊ¿äÇÑ ¸Þ¼Òµå¿Í »ó¼ö¸¦ Á¤ÀÇÇÕ´Ï´Ù.
Connector.open
¿¡ Àü´ÞµÉ ¶§ https
ü°è¸¦
»ç¿ëÇÏ´Â URI Çü½ÄÀº
HttpsConnection
À» ¹ÝȯÇÕ´Ï´Ù.
RFC 2818¿¡¼
ÀÌ Ã¼°è¸¦ Á¤ÀÇÇÕ´Ï´Ù.
º¸¾È ¿¬°áÀº ´ÙÀ½ »ç¾ç Áß
Çϳª¸¦ ÅëÇØ ±¸ÇöÇØ¾ß ÇÕ´Ï´Ù.
HTTPS´Â HTTPÀÇ º¸¾È ¹öÀü(IETF RFC2616)À¸·Î,
¿äûÀ» º¸³»±â Àü¿¡ ¿äû ¸Å°³ º¯¼ö¸¦ ¼³Á¤ÇØ¾ß ÇÏ´Â
¿äû-ÀÀ´ä ÇÁ·ÎÅäÄÝÀÔ´Ï´Ù.
Connected »óÅ·ΠÀüȯ½ÃŰ´Â ´Ù¾çÇÑ ¸Þ¼ÒµåÀÇ È£Ãâ Áß¿¡
¹ß»ýÇÒ ¼ö ÀÖ´Â Á¤»óÀûÀÎ IOExceptions
¿Ü¿¡µµ
CertificateException
(IOException
ÀÇ
¼ºê ŸÀÔ)ÀÌ ¹ß»ýÇÏ¿© º¸¾È ¿¬°á ±¸¼º°ú
°ü·ÃµÈ ¿À·ù¸¦ ³ªÅ¸³¾ ¼ö ÀÖ½À´Ï´Ù.
Çì´õ¸¦ ¾ÈÀüÇÏ°Ô º¸³¾ ¼ö ÀÖµµ·Ï Connected
»óÅ¿¡¼´Â
º¸¾È ¿¬°áÀÌ ÇÊ¿äÇÕ´Ï´Ù.
ÀÔ·Â ¹× Ãâ·Â ½ºÆ®¸²À» ¿±â À§ÇÑ Connector.open()
¹×
°ü·Ã ¸Þ¼Òµå È£Ãâ Ãʱ⿡ º¸¾È ¿¬°áÀ» ¼³Á¤Çϸé ÀÎÁõ¼ ¿¹¿Ü¿Í
°ü·ÃµÈ ¿À·ù°¡ º¸°íµÉ ¼ö ÀÖ½À´Ï´Ù.
¿¹
HTTPS ¿¬°áÀ» ¿°í ¸Å°³ º¯¼ö¸¦ ¼³Á¤ÇÑ ´ÙÀ½
HTTP ÀÀ´äÀ» ÀнÀ´Ï´Ù.
Connector.open
À» »ç¿ëÇÏ¿© URLÀ» ¿¸é
HttpsConnection
ÀÌ ¹ÝȯµË´Ï´Ù.
HTTP Çì´õ¸¦ Àаí ó¸®ÇÕ´Ï´Ù.
±æÀ̸¦ »ç¿ëÇÒ ¼ö ÀÖÀ¸¸é ±æÀ̸¦ »ç¿ëÇÏ¿© ´ë·®À¸·Î µ¥ÀÌÅ͸¦ ÀнÀ´Ï´Ù.
HttpsConnection
¿¡¼
InputStream
ÀÌ ¿¸³´Ï´Ù.
EOF(-1)±îÁö ¸ðµç ¹®ÀÚ¸¦ Àд µ¥ »ç¿ëµË´Ï´Ù.
¿¹¿Ü°¡ ¹ß»ýÇÏ¸é ¿¬°á°ú ½ºÆ®¸²ÀÌ ´ÝÈü´Ï´Ù.
void getViaHttpsConnection(String url)
throws CertificateException, IOException {
HttpsConnection c = null;
InputStream is = null;
try {
c = (HttpsConnection)Connector.open(url);
// Getting the InputStream ensures that the connection
// is opened (if it was not already handled by
// Connector.open()) and the SSL handshake is exchanged,
// and the HTTP response headers are read.
// These are stored until requested.
is = c.openDataInputStream();
if c.getResponseCode() == HttpConnection.HTTP_OK) {
// Get the length and process the data
int len = (int)c.getLength();
if (len > 0) {
byte[] data = new byte[len];
int actual = is.readFully(data);
...
} else {
int ch;
while ((ch = is.read()) != -1) {
...
}
}
} else {
...
}
} finally {
if (is != null)
is.close();
if (c != null)
c.close();
}
}
- Since:
- MIDP 2.0
- See Also:
CertificateException
Fields inherited from interface javax.microedition.io.HttpConnection |
GET, HEAD, HTTP_ACCEPTED, HTTP_BAD_GATEWAY, HTTP_BAD_METHOD, HTTP_BAD_REQUEST, HTTP_CLIENT_TIMEOUT, HTTP_CONFLICT, HTTP_CREATED, HTTP_ENTITY_TOO_LARGE, HTTP_EXPECT_FAILED, HTTP_FORBIDDEN, HTTP_GATEWAY_TIMEOUT, HTTP_GONE, HTTP_INTERNAL_ERROR, HTTP_LENGTH_REQUIRED, HTTP_MOVED_PERM, HTTP_MOVED_TEMP, HTTP_MULT_CHOICE, HTTP_NO_CONTENT, HTTP_NOT_ACCEPTABLE, HTTP_NOT_AUTHORITATIVE, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_NOT_MODIFIED, HTTP_OK, HTTP_PARTIAL, HTTP_PAYMENT_REQUIRED, HTTP_PRECON_FAILED, HTTP_PROXY_AUTH, HTTP_REQ_TOO_LONG, HTTP_RESET, HTTP_SEE_OTHER, HTTP_TEMP_REDIRECT, HTTP_UNAUTHORIZED, HTTP_UNAVAILABLE, HTTP_UNSUPPORTED_RANGE, HTTP_UNSUPPORTED_TYPE, HTTP_USE_PROXY, HTTP_VERSION, POST |
Method Summary |
int |
getPort()
ÀÌ HttpsConnection ¿¡ ´ëÇÑ URLÀÇ
³×Æ®¿öÅ© Æ÷Æ® ¹øÈ£¸¦ ¹ÝȯÇÕ´Ï´Ù. |
SecurityInfo |
getSecurityInfo()
¼º°øÀûÀ¸·Î ¿¸° ¿¬°á°ú °ü·ÃµÈ º¸¾È Á¤º¸¸¦ ¹ÝȯÇÕ´Ï´Ù.
|
Methods inherited from interface javax.microedition.io.HttpConnection |
getDate, getExpiration, getFile, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHost, getLastModified, getProtocol, getQuery, getRef, getRequestMethod, getRequestProperty, getResponseCode, getResponseMessage, getURL, setRequestMethod, setRequestProperty |
getSecurityInfo
public SecurityInfo getSecurityInfo()
throws IOException
- ¼º°øÀûÀ¸·Î ¿¸° ¿¬°á°ú °ü·ÃµÈ º¸¾È Á¤º¸¸¦ ¹ÝȯÇÕ´Ï´Ù.
¿¬°áÀÌ ¿©ÀüÈ÷
Setup
»óÅÂÀ̸é
¼¹ö¿¡ ´ëÇÑ º¸¾È ¿¬°áÀ»
¼³Á¤Çϱâ À§ÇØ ¿¬°áÀÌ Ãʱâȵ˴ϴÙ.
ÀÌ ¸Þ¼Òµå´Â ¿¬°áÀÌ ¼³Á¤µÈ ½Ã°£°ú ¼¹ö¿¡¼ Á¦°øÇÑ
Certificate
ÀÌ
°ËÁõµÈ ½Ã°£À» ¹ÝȯÇÕ´Ï´Ù.
SecurityInfo
´Â ¼¹ö¿¡ ´ëÇÑ ¿¬°áÀÌ ¼º°øÀûÀ¸·Î
¼³Á¤µÈ °æ¿ì¿¡¸¸ ¹ÝȯµË´Ï´Ù.
- Returns:
- ¿¸° ¿¬°á°ú °ü·ÃµÈ º¸¾È Á¤º¸
- Throws:
IOException
- ÀÓÀÇ ¿¬°á ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì
getPort
public int getPort()
- ÀÌ
HttpsConnection
¿¡ ´ëÇÑ URLÀÇ
³×Æ®¿öÅ© Æ÷Æ® ¹øÈ£¸¦ ¹ÝȯÇÕ´Ï´Ù.
- Specified by:
getPort
in interface HttpConnection
- Returns:
- ÀÌ
HttpsConnection
¿¡ ´ëÇÑ
URLÀÇ ³×Æ®¿öÅ© Æ÷Æ® ¹øÈ£.
Connector.open
¿¡ Àü´ÞµÈ ¹®ÀÚ¿¿¡ Æ÷Æ® ¹øÈ£°¡ ¾øÀ¸¸é
±âº» HTTPS Æ÷Æ® ¹øÈ£(443)°¡ ¹ÝȯµË´Ï´Ù.
ÀǰßÀ̳ª Á¦¾È »çÇ× º¸³»±â MID ÇÁ·ÎÇÊ »ç¾ç ¹öÀü 2.0
Java´Â ¹Ì±¹ ¹× ´Ù¸¥ ±¹°¡¿¡¼ Sun Microsystems, Inc.ÀÇ »óÇ¥ ¶Ç´Â µî·Ï »óÇ¥ÀÔ´Ï´Ù. Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. ¸ðµç ±Ç¸®´Â ÀúÀÛ±ÇÀÚÀÇ ¼ÒÀ¯ÀÔ´Ï´Ù.