MID ÇÁ·ÎÇÊ

javax.microedition.io
Interface HttpConnection

All Superinterfaces:
Connection, ContentConnection, InputConnection, OutputConnection, StreamConnection
All Known Subinterfaces:
HttpsConnection

public interface HttpConnection
extends ContentConnection

ÀÌ ÀÎÅÍÆäÀ̽º´Â HTTP ¿¬°á¿¡ ÇÊ¿äÇÑ ¸Þ¼Òµå¿Í »ó¼ö¸¦ Á¤ÀÇÇÕ´Ï´Ù.

HTTP´Â ¿äûÀ» º¸³»±â Àü¿¡ ¿äû ¸Å°³ º¯¼ö¸¦ ¼³Á¤ÇØ¾ß ÇÏ´Â ¿äû-ÀÀ´ä ÇÁ·ÎÅäÄÝÀÔ´Ï´Ù. ¿¬°á »óÅ´ ´ÙÀ½ ¼¼ °¡Áö Áß ÇϳªÀÔ´Ï´Ù.

´ÙÀ½ ¸Þ¼Òµå´Â ¼³Á¤ »óÅ¿¡¼­¸¸ È£ÃâÇÒ ¼ö ÀÖ½À´Ï´Ù. ¼­¹ö·Î µ¥ÀÌÅ͸¦ º¸³»°Å³ª ¹Þ¾Æ¾ß ÇÏ´Â ¸Þ¼Òµå¸¦ »ç¿ëÇÏ¸é ¿¬°áÀÌ ¼³Á¤ »óÅ¿¡¼­ ¿¬°áµÊ »óÅ·ΠÀüȯµË´Ï´Ù.

¿¬°áÀÌ ¼³Á¤ »óÅÂÀÏ ¶§ ´ÙÀ½ ¸Þ¼Òµå¸¦ »ç¿ëÇÏ¸é ¿¬°áµÊ »óÅ·ΠÀüȯµË´Ï´Ù.

´ÙÀ½ ¸Þ¼Òµå´Â ¿¬°áÀÌ ¼³Á¤ ¶Ç´Â ¿¬°áµÊ »óÅÂÀÏ ¶§¸¸ È£ÃâÇÒ ¼ö ÀÖ½À´Ï´Ù.

openOutputStream ¶Ç´Â openDataOutputStream ¸Þ¼Òµå°¡ Ãâ·Â ½ºÆ®¸²À» ¿¬ ÈÄ setRequestMethod ¶Ç´Â setRequestProperty¸¦ ÅëÇØ ¿äû ¸Å°³ º¯¼ö¸¦ º¯°æÇÏ·Á´Â ½Ãµµ´Â ¹«½ÃµË´Ï´Ù. ¿äû ¸Å°³ º¯¼ö¸¦ º¸³½ °æ¿ì ÀÌµé ¸Þ¼Òµå´Â IOExceptionÀ» ¹ß»ý½Ãŵ´Ï´Ù. OutputStream.close ¶Ç´Â DataOutputStream.close ¸Þ¼Òµå¸¦ ÅëÇØ Ãâ·Â ½ºÆ®¸²À» ´ÝÀ¸¸é ¿¬°á »óÅ´ ¿¬°áµÊÀÌ µË´Ï´Ù. OutputStream.flush ¶Ç´Â DataOutputStream.flush ¸Þ¼Òµå¸¦ ÅëÇØ Ãâ·Â ½ºÆ®¸²À» Ç÷¯½ÃÇÒ °æ¿ì ½ºÆ®¸²¿¡ ±â·ÏµÇ´Â ¸ðµç µ¥ÀÌÅÍ¿Í ÇÔ²² ¿äû ¸Å°³ º¯¼ö¸¦ º¸³»¾ß ÇÕ´Ï´Ù.

close ¸Þ¼Òµå¸¦ »ç¿ëÇÏ¿© ¿¬°á¿¡¼­ ¿­¸° ¸ðµç ½ºÆ®¸²À» ´ÝÀ¸¸é ´Ù¸¥ µÎ »óÅ¿¡¼­ ´ÝÈû »óÅ·ΠÀüȯµË´Ï´Ù.

StreamConnection »ç¿ë ¿¹

StreamConnectionÀ» »ç¿ëÇÏ¿© ´Ü¼øÈ÷ URLÀ» Àб⸸ Çϸç HTTP °íÀ¯ÀÇ µ¿ÀÛÀº ÇÊ¿ä ¾ø°Å³ª »ç¿ëµÇÁö ¾Ê½À´Ï´Ù. (ÁÖ: ÀÌ ¿¹¿¡¼­´Â ¸ðµç HTTP ÀÀ´ä Çì´õ¿Í HTTP ÀÀ´ä Äڵ带 ¹«½ÃÇÕ´Ï´Ù. ÇÁ·Ï½Ã³ª ¼­¹ö°¡ ¿À·ù ÀÀ´ä ÆäÀÌÁö¸¦ º¸³ÂÀ» ¼öµµ ÀÖÀ¸¹Ç·Î ÀÀ¿ë ÇÁ·Î±×·¥Àº InputStream¿¡¼­ ¾î¶² µ¥ÀÌÅͰ¡ °Ë»öµÇ´ÂÁö ±¸ºÐÇÒ ¼ö ¾ø½À´Ï´Ù.

Connector.openÀ» »ç¿ëÇÏ¿© URLÀ» ¿­°í StreamConnectionÀÌ ¹ÝȯµË´Ï´Ù. StreamConnection¿¡¼­ InputStreamÀÌ ¿­¸³´Ï´Ù. EOF(-1)±îÁö ¸ðµç ¹®ÀÚ¸¦ Àд µ¥ »ç¿ëµË´Ï´Ù. ¿¹¿Ü°¡ ¹ß»ýÇÏ¸é ¿¬°á°ú ½ºÆ®¸²ÀÌ ´ÝÈü´Ï´Ù.

     void getViaStreamConnection(String url) throws IOException {
         StreamConnection c = null;
         InputStream s = null;
         try {
             c = (StreamConnection)Connector.open(url);
             s = c.openInputStream();
             int ch;
             while ((ch = s.read()) != -1) {
                 ...
             }
         } finally {
             if (s != null)
                 s.close();
             if (c != null)
                 c.close();
         }
     }

ContentConnection »ç¿ë ¿¹

ContentConnectionÀ» »ç¿ëÇÏ¿© ´Ü¼øÈ÷ URLÀ» Àб⸸ Çϸç HTTP °íÀ¯ÀÇ µ¿ÀÛÀº ÇÊ¿ä ¾ø°Å³ª »ç¿ëµÇÁö ¾Ê½À´Ï´Ù.

Connector.openÀ» »ç¿ëÇÏ¿© URLÀ» ¿­°í ContentConnectionÀÌ ¹ÝȯµË´Ï´Ù. ContentConnectionÀº ±æÀ̸¦ Á¦°øÇÒ ¼öµµ ÀÖ½À´Ï´Ù. ±æÀ̸¦ »ç¿ëÇÒ ¼ö ÀÖÀ¸¸é ±æÀ̸¦ »ç¿ëÇÏ¿© ´ë·®À¸·Î µ¥ÀÌÅ͸¦ ÀнÀ´Ï´Ù. ContentConnection¿¡¼­ InputStreamÀÌ ¿­¸³´Ï´Ù. EOF(-1)±îÁö ¸ðµç ¹®ÀÚ¸¦ Àд µ¥ »ç¿ëµË´Ï´Ù. ¿¹¿Ü°¡ ¹ß»ýÇÏ¸é ¿¬°á°ú ½ºÆ®¸²ÀÌ ´ÝÈü´Ï´Ù.

     void getViaContentConnection(String url) throws IOException {
         ContentConnection c = null;
         DataInputStream is = null;
         try {
             c = (ContentConnection)Connector.open(url);
             int len = (int)c.getLength();
             dis = c.openDataInputStream();
             if (len > 0) {
                 byte[] data = new byte[len];
                 dis.readFully(data);
             } else {
                 int ch;
                 while ((ch = dis.read()) != -1) {
                     ...
                 }
             }
         } finally {
             if (dis != null)
                 dis.close();
             if (c != null)
                 c.close();
         }
     }

HttpConnection »ç¿ë ¿¹

HttpConnectionÀ» »ç¿ëÇÏ¿© HTTP Çì´õ¿Í µ¥ÀÌÅ͸¦ ÀнÀ´Ï´Ù.

Connector.openÀ» »ç¿ëÇÏ¿© URLÀ» ¿­°í HttpConnectionÀÌ ¹ÝȯµË´Ï´Ù. HTTP Çì´õ¸¦ Àаí ó¸®ÇÕ´Ï´Ù. ±æÀ̸¦ »ç¿ëÇÒ ¼ö ÀÖÀ¸¸é ±æÀ̸¦ »ç¿ëÇÏ¿© ´ë·®À¸·Î µ¥ÀÌÅ͸¦ ÀнÀ´Ï´Ù. HttpConnection¿¡¼­ InputStreamÀÌ ¿­¸³´Ï´Ù. EOF(-1)±îÁö ¸ðµç ¹®ÀÚ¸¦ Àд µ¥ »ç¿ëµË´Ï´Ù. ¿¹¿Ü°¡ ¹ß»ýÇÏ¸é ¿¬°á°ú ½ºÆ®¸²ÀÌ ´ÝÈü´Ï´Ù.

     void getViaHttpConnection(String url) throws IOException {
         HttpConnection c = null;
         InputStream is = null;
         int rc;

         try {
             c = (HttpConnection)Connector.open(url);

             // Getting the response code will open the connection,
             // send the request, and read the HTTP response headers.
             // The headers are stored until requested.
             rc = c.getResponseCode();
             if (rc != HttpConnection.HTTP_OK) {
                 throw new IOException("HTTP response code: " + rc);
             }

             is = c.openInputStream();

             // Get the ContentType
             String type = c.getType();

             // Get the length and process the data
             int len = (int)c.getLength();
             if (len > 0) {
                 int actual = 0;
                 int bytesread = 0 ;
                 byte[] data = new byte[len];
                 while ((bytesread != len) && (actual != -1)) {
                    actual = is.read(data, bytesread, len - bytesread);
                    bytesread += actual;
                 }
             } else {
                 int ch;
                 while ((ch = is.read()) != -1) {
                     ...
                 }
             }
         } catch (ClassCastException e) {
             throw new IllegalArgumentException("Not an HTTP URL");
         } finally {
             if (is != null)
                 is.close();
             if (c != null)
                 c.close();
         }
     }

POST ¹× HttpConnection »ç¿ë ¿¹

ÀϺΠÇì´õ¿Í ³»¿ëÀÌ Æ÷ÇÔµÈ ¿äûÀ» ¼­¹ö¿¡ °Ô½ÃÇϰí Çì´õ¿Í ³»¿ëÀ» ó¸®ÇÕ´Ï´Ù.

Connector.openÀ» »ç¿ëÇÏ¿© URLÀ» ¿­°í HttpConnectionÀÌ ¹ÝȯµË´Ï´Ù. ¿äû ¸Þ¼Òµå´Â POST¿Í ¿äû Çì´õ ÁýÇÕÀ¸·Î ¼³Á¤µË´Ï´Ù. ´Ü¼øÇÑ ¸í·ÉÀ» ÀÛ¼ºÇϰí Ç÷¯½ÃÇÕ´Ï´Ù. HTTP Çì´õ¸¦ Àаí ó¸®ÇÕ´Ï´Ù. ±æÀ̸¦ »ç¿ëÇÒ ¼ö ÀÖÀ¸¸é ±æÀ̸¦ »ç¿ëÇÏ¿© ´ë·®À¸·Î µ¥ÀÌÅ͸¦ ÀнÀ´Ï´Ù. HttpConnection¿¡¼­ InputStreamÀÌ ¿­¸³´Ï´Ù. EOF(-1)±îÁö ¸ðµç ¹®ÀÚ¸¦ Àд µ¥ »ç¿ëµË´Ï´Ù. ¿¹¿Ü°¡ ¹ß»ýÇÏ¸é ¿¬°á°ú ½ºÆ®¸²ÀÌ ´ÝÈü´Ï´Ù.

    void postViaHttpConnection(String url) throws IOException {
        HttpConnection c = null;
        InputStream is = null;
        OutputStream os = null;
        int rc;

        try {
            c = (HttpConnection)Connector.open(url);

            // Set the request method and headers
            c.setRequestMethod(HttpConnection.POST);
            c.setRequestProperty("If-Modified-Since",
                "29 Oct 1999 19:43:31 GMT");
            c.setRequestProperty("User-Agent",
                "Profile/MIDP-2.0 Configuration/CLDC-1.0");
            c.setRequestProperty("Content-Language", "en-US");

            // Getting the output stream may flush the headers
            os = c.openOutputStream();
            os.write("LIST games\n".getBytes());
            os.flush();           // Optional, getResponseCode will flush

            // Getting the response code will open the connection,
            // send the request, and read the HTTP response headers.
            // The headers are stored until requested.
            rc = c.getResponseCode();
            if (rc != HttpConnection.HTTP_OK) {
                throw new IOException("HTTP response code: " + rc);
            }

            is = c.openInputStream();

            // Get the ContentType
            String type = c.getType();
            processType(type);

            // Get the length and process the data
            int len = (int)c.getLength();
            if (len > 0) {
                 int actual = 0;
                 int bytesread = 0 ;
                 byte[] data = new byte[len];
                 while ((bytesread != len) && (actual != -1)) {
                    actual = is.read(data, bytesread, len - bytesread);
                    bytesread += actual;
                 }
                process(data);
            } else {
                int ch;
                while ((ch = is.read()) != -1) {
                    process((byte)ch);
                }
            }
        } catch (ClassCastException e) {
            throw new IllegalArgumentException("Not an HTTP URL");
        } finally {
            if (is != null)
                is.close();
            if (os != null)
                os.close();
            if (c != null)
                c.close();
        }
    }

Ä¿³ØÅÍ¿¡ ´ëÇÑ ´Ü¼øÇÑ ½ºÆ®¸² ¸Þ¼Òµå

ÁÖÀÇ: Connector Ŭ·¡½º´Â ÁöÁ¤µÈ URL¿¡ ´ëÇÑ ÀÔ·Â ¶Ç´Â Ãâ·Â ½ºÆ®¸²À» Á÷Á¢ °Ë»öÇϱâ À§ÇÑ ´ÙÀ½°ú °°Àº Æí¸®ÇÑ ¸Þ¼Òµå¸¦ Á¤ÀÇÇÕ´Ï´Ù.

ÀÌ·¯ÇÑ ¸Þ¼Òµå¸¦ »ç¿ëÇÒ °æ¿ì ƯÁ¤ Á¦ÇÑÀÌ ¼ö¹ÝµË´Ï´Ù. ½ÇÁ¦ ¿¬°á¿¡ ´ëÇÑ ÂüÁ¶°¡ ¾Æ´Ñ ¿¬°áÀÇ ÀÔ·Â ¶Ç´Â Ãâ·Â ½ºÆ®¸²¿¡ ´ëÇÑ ÂüÁ¶¸¸ °¡Á®¿Ã ¼ö ÀÖ½À´Ï´Ù. ¿¬°á¿¡ ´ëÇÑ ÂüÁ¶¸¦ °¡Á®¿Ã ¼ö ¾øÀ¸¹Ç·Î ¿¬°áÀ» Á÷Á¢ Á¶ÀÛÇϰųª Äõ¸®ÇÒ ¼ö ¾øÀ¸¸ç ´ÙÀ½ ¸Þ¼Òµå¸¦ È£ÃâÇÒ ¼ö ¾ø°Ô µË´Ï´Ù.

Since:
MIDP 1.0

Field Summary
static String GET
          HTTP Get ¸Þ¼Òµå
static String HEAD
          HTTP Head ¸Þ¼Òµå
static int HTTP_ACCEPTED
          202: ¿äû 󸮰¡ ½ÂÀεǾúÁö¸¸ 󸮰¡ ¿Ï·áµÇÁö ¾Ê¾Ò½À´Ï´Ù.
static int HTTP_BAD_GATEWAY
          502: °ÔÀÌÆ®¿þÀ̳ª ÇÁ·Ï½Ã·Î ÀÛµ¿ÇÏ´Â ¼­¹ö°¡ ¿äû ÀÌÇà Áß¿¡ ¾×¼¼½ºÇÑ ¾÷½ºÆ®¸² ¼­¹ö·ÎºÎÅÍ À¯È¿ÇÏÁö ¾ÊÀº ÀÀ´äÀ» ¹Þ¾Ò½À´Ï´Ù.
static int HTTP_BAD_METHOD
          405: Request-Line¿¡ ÁöÁ¤µÈ ¸Þ¼Òµå¸¦ Request-URI·Î ½Äº°µÈ ÀÚ¿ø¿¡ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.
static int HTTP_BAD_REQUEST
          400: À߸øµÈ Çü½ÄÀÇ ±¸¹® ¶§¹®¿¡ ¼­¹ö¿¡¼­ ¿äûÀ» ÀÌÇØÇÒ ¼ö ¾ø½À´Ï´Ù.
static int HTTP_CLIENT_TIMEOUT
          408: Ŭ¶óÀÌ¾ðÆ®°¡ ¼­¹ö ´ë±â ½Ã°£ ³»¿¡ ¿äûÇÏÁö ¸øÇß½À´Ï´Ù.
static int HTTP_CONFLICT
          409: ¿äûÀÌ ÀÚ¿øÀÇ ÇöÀç »óÅÂ¿Í Ãæµ¹ÇϹǷΠ¿äûÀ» ¿Ï·áÇÒ ¼ö ¾ø½À´Ï´Ù.
static int HTTP_CREATED
          201: ¿äûÀÌ ÀÌÇàµÇ¾úÀ¸¸ç ±× °á°ú »õ·Î¿î ÀÚ¿øÀÌ ¸¸µé¾îÁ³½À´Ï´Ù.
static int HTTP_ENTITY_TOO_LARGE
          413: ¼­¹ö¿¡¼­ ó¸®ÇÒ ¼ö ÀÖ´Â °Íº¸´Ù ¿äû ¿£Æ¼Æ¼°¡ ´õ Å©¹Ç·Î ¼­¹ö°¡ ¿äû 󸮸¦ °ÅºÎÇÕ´Ï´Ù.
static int HTTP_EXPECT_FAILED
          417: ¼­¹ö°¡ Expect ¿äû Çì´õ Çʵ忡 ÁöÁ¤µÈ ±â´ë¸¦ ÃæÁ·½Ãų ¼ö ¾ø°Å³ª, ¼­¹ö°¡ ÇÁ·Ï½ÃÀÎ °æ¿ì ´ÙÀ½ °æÀ¯ ¼­¹ö¿¡¼­ ¿äûÀ» ÃæÁ·½Ãų ¼ö ¾ø´Ù´Â È®½ÇÇÑ Áõ°Å°¡ ÀÖ½À´Ï´Ù.
static int HTTP_FORBIDDEN
          403: ¼­¹ö°¡ ¿äûÀ» ÀÌÇØÇßÁö¸¸ ÀÌÇàÇϱ⸦ °ÅºÎÇÕ´Ï´Ù.
static int HTTP_GATEWAY_TIMEOUT
          504: °ÔÀÌÆ®¿þÀ̳ª ÇÁ·Ï½Ã·Î ÀÛµ¿ÇÏ´Â ¼­¹ö°¡ ¿äû ¿Ï·á Áß¿¡ ¾×¼¼½ºÇÑ URI ¶Ç´Â ´Ù¸¥ º¸Á¶ ¼­¹ö¿¡ ÀÇÇØ ÁöÁ¤µÈ ¾÷½ºÆ®¸² ¼­¹ö·ÎºÎÅÍ ÀûÀýÇÑ ÀÀ´äÀ» ¹ÞÁö ¸øÇß½À´Ï´Ù.
static int HTTP_GONE
          410: ¿äûµÈ ÀÚ¿øÀº ¼­¹ö¿¡¼­ ´õ ÀÌ»ó »ç¿ëÇÒ ¼ö ¾øÀ¸¸ç Àü´Þ ÁÖ¼Ò¸¦ ¾Ë ¼ö ¾ø½À´Ï´Ù.
static int HTTP_INTERNAL_ERROR
          500: ¼­¹ö¿¡¼­ ¿¹»óÄ¡ ¸øÇÑ Á¶°ÇÀ» ¹ß°ßÇÏ¿© ¿äûÀ» ÀÌÇàÇÏÁö ¸øÇß½À´Ï´Ù.
static int HTTP_LENGTH_REQUIRED
          411: ¼­¹ö¿¡¼­ Content- Length°¡ Á¤ÀǵÇÁö ¾ÊÀº ¿äûÀ» °ÅºÎÇÕ´Ï´Ù.
static int HTTP_MOVED_PERM
          301: ¿äûµÈ ÀÚ¿ø¿¡ »õ·Î¿î ¿µ±¸ URLÀÌ ÇÒ´çµÇ¾úÀ¸¸ç ÀÌ ÀÚ¿ø¿¡ ´ëÇÑ ÀÌÈÄ ÂüÁ¶´Â ¹ÝȯµÈ URI Áß Çϳª¸¦ »ç¿ëÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
static int HTTP_MOVED_TEMP
          302: ¿äûµÈ ÀÚ¿øÀÌ ÀϽÃÀûÀ¸·Î ´Ù¸¥ URI¿¡ ÀÖ½À´Ï´Ù.
static int HTTP_MULT_CHOICE
          300: ¿äûµÈ ÀÚ¿øÀÌ °¢°¢ ƯÁ¤ À§Ä¡¸¦ °¡Áø Ç¥Çö ÁýÇÕ Áß Çϳª¿¡ ÀÏÄ¡Çϸç, »ç¿ëÀÚ°¡ ¿øÇϴ ǥÇöÀ» ¼±ÅÃÇÏ°í ¿äûÀ» ÇØ´ç À§Ä¡·Î ¸®µð·º¼ÇÇÒ ¼ö ÀÖµµ·Ï ¿¡ÀÌÀüÆ® ±¸µ¿ Çù»ó Á¤º¸°¡ Á¦°øµË´Ï´Ù.
static int HTTP_NO_CONTENT
          204: ¼­¹ö¿¡¼­ ¿äûÀ» ÀÌÇàÇßÁö¸¸ entity-body¸¦ ¹ÝȯÇÒ Çʿ䰡 ¾øÀ¸¸ç ¾÷µ¥ÀÌÆ®µÈ meta-informationÀ» ¹ÝȯÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
static int HTTP_NOT_ACCEPTABLE
          406: ¿äû¿¡ ÀÇÇØ ½Äº°µÈ ÀÚ¿øÀÌ ¿äû ½Ã Àü¼ÛµÈ ½ÂÀÎ Çì´õ¿¡ µû¶ó ½ÂÀÎÇÒ ¼ö ¾ø´Â ³»¿ëÀÌ Æ÷ÇÔµÈ ÀÀ´ä ¿£Æ¼Æ¼¸¸ »ý¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.
static int HTTP_NOT_AUTHORITATIVE
          203: entity-header¿¡ ¹ÝȯµÈ meta-informationÀº ¿øº» ¼­¹ö¿¡¼­ »ç¿ëÇÒ ¼ö ÀÖ´Â Á¤ÀÇ ÁýÇÕÀÌ ¾Æ´Õ´Ï´Ù.
static int HTTP_NOT_FOUND
          404: ¼­¹ö¿¡¼­ Request-URI¿¡ ÀÏÄ¡ÇÏ´Â Ç׸ñÀ» ãÁö ¸øÇß½À´Ï´Ù.
static int HTTP_NOT_IMPLEMENTED
          501: ¼­¹ö¿¡¼­ ¿äû ÀÌÇà¿¡ ÇÊ¿äÇÑ ±â´ÉÀ» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.
static int HTTP_NOT_MODIFIED
          304: Ŭ¶óÀÌ¾ðÆ®°¡ Á¶°ÇºÎ GET ¿äûÀ» ¼öÇàÇßÀ¸¸ç ¾×¼¼½º°¡ Çã¿ëµÇ¾úÁö¸¸ ¹®¼­¸¦ ¼öÁ¤ÇÏÁö ¾ÊÀº °æ¿ì ¼­¹ö´Â ÀÌ »óÅ ÄÚµå·Î ÀÀ´äÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
static int HTTP_OK
          200: ¿äûÀÌ ¼º°øÇß½À´Ï´Ù.
static int HTTP_PARTIAL
          206: ¼­¹ö¿¡¼­ ÀÚ¿ø¿¡ ´ëÇÑ ºÎºÐ GET ¿äûÀ» ÀÌÇàÇß½À´Ï´Ù.
static int HTTP_PAYMENT_REQUIRED
          402: ÀÌ ÄÚµå´Â ÀÌÈÄ »ç¿ëÀ» À§ÇØ ¿¹¾àµË´Ï´Ù.
static int HTTP_PRECON_FAILED
          412: Çϳª ÀÌ»óÀÇ ¿äû Çì´õ Çʵ忡 ÁöÁ¤µÈ »çÀü Á¶°ÇÀ» ¼­¹ö¿¡¼­ Å×½ºÆ®ÇÑ °á°ú false·Î Æò°¡µÇ¾ú½À´Ï´Ù.
static int HTTP_PROXY_AUTH
          407: ÀÌ ÄÚµå´Â 401 (Unauthorized)¿Í À¯»çÇÏÁö¸¸ Ŭ¶óÀÌ¾ðÆ®°¡ ¸ÕÀú ÇÁ·Ï½Ã¸¦ »ç¿ëÇÏ¿© ÀÚ½ÅÀ» ÀÎÁõÇØ¾ß ÇÔÀ» ³ªÅ¸³À´Ï´Ù.
static int HTTP_REQ_TOO_LONG
          414: Request-URI°¡ ¼­¹ö¿¡¼­ ÇØ¼®ÇÒ ¼ö ÀÖ´Â °Íº¸´Ù ±æ¾î¼­ ¼­¹ö°¡ ¿äû 󸮸¦ °ÅºÎÇÕ´Ï´Ù.
static int HTTP_RESET
          205: ¼­¹ö¿¡¼­ ¿äûÀ» ÀÌÇàÇßÀ¸¸ç »ç¿ëÀÚ ¿¡ÀÌÀüÆ®´Â ¿äûÀ» º¸³»°Ô ÇÑ ¹®¼­ º¸±â¸¦ Àç¼³Á¤ÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
static int HTTP_SEE_OTHER
          303: ¿äû¿¡ ´ëÇÑ ÀÀ´äÀº ´Ù¸¥ URI¿¡¼­ ãÀ» ¼ö ÀÖÀ¸¸ç ÇØ´ç ÀÚ¿ø¿¡ ´ëÇÑ GET ¸Þ¼Òµå¸¦ »ç¿ëÇÏ¿© °Ë»öÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
static int HTTP_TEMP_REDIRECT
          307: ¿äûµÈ ÀÚ¿øÀÌ ÀϽÃÀûÀ¸·Î ´Ù¸¥ URI¿¡ ÀÖ½À´Ï´Ù.
static int HTTP_UNAUTHORIZED
          401: ¿äû¿¡ »ç¿ëÀÚ ÀÎÁõÀÌ ÇÊ¿äÇÕ´Ï´Ù.
static int HTTP_UNAVAILABLE
          503: ÀϽÃÀû ¿À¹ö·Îµå ¶Ç´Â À¯Áö º¸¼ö·Î ÀÎÇØ ÇöÀç ¼­¹ö¿¡¼­ ¿äûÀ» ó¸®ÇÒ ¼ö ¾ø½À´Ï´Ù.
static int HTTP_UNSUPPORTED_RANGE
          416: ¿äû¿¡ Range ¿äû Çì´õ Çʵ尡 Æ÷ÇԵǾî ÀÖÁö¸¸ ÀÌ ÇʵåÀÇ ¹üÀ§ ÁöÁ¤ÀÚ °ª Áß¿¡ ¼±ÅÃÇÑ ÀÚ¿øÀÇ ÇöÀç ¹üÀ§¿Í °ãÄ¡´Â °ªÀÌ ¾øÀ¸¸ç ¿äû¿¡ If-Range ¿äû Çì´õ Çʵ尡 Æ÷ÇԵǾî ÀÖÁö ¾ÊÀ¸¸é ¼­¹ö¿¡¼­ ÀÌ »óÅ ÄÚµå·Î ÀÀ´äÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
static int HTTP_UNSUPPORTED_TYPE
          415: ¿äû ¿£Æ¼Æ¼°¡ ¿äûµÈ ¸Þ¼ÒµåÀÇ ¿äû ÀÚ¿ø¿¡¼­ Áö¿øÇÏÁö ¾Ê´Â Çü½ÄÀ̹ǷΠ¼­¹ö¿¡¼­ ¿äû 󸮸¦ °ÅºÎÇÕ´Ï´Ù.
static int HTTP_USE_PROXY
          305: ¿äûµÈ ÀÚ¿øÀº Location Çʵ忡 ÁöÁ¤µÈ ÇÁ·Ï½Ã¸¦ ÅëÇØ ¾×¼¼½ºÇØ¾ß ÇÕ´Ï´Ù.
static int HTTP_VERSION
          505: ¼­¹ö¿¡¼­ ¿äû ¸Þ½ÃÁö¿¡ »ç¿ëµÈ HTTP ÇÁ·ÎÅäÄÝ ¹öÀüÀ» Áö¿øÇÏÁö ¾Ê°Å³ª Áö¿øÀ» °ÅºÎÇÕ´Ï´Ù.
static String POST
          HTTP Post ¸Þ¼Òµå
 
Method Summary
 long getDate()
          date Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 long getExpiration()
          expires Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 String getFile()
          HttpConnectionÀÇ URL¿¡¼­ ÆÄÀÏ ºÎºÐÀ» ¹ÝȯÇÕ´Ï´Ù.
 String getHeaderField(int n)
          »öÀÎÀ¸·Î Çì´õ ÇÊµå °ªÀ» °¡Á®¿É´Ï´Ù.
 String getHeaderField(String name)
          ¸í¸íµÈ Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 long getHeaderFieldDate(String name, long def)
          ³¯Â¥·Î ±¸¹® ºÐ¼®µÈ ¸í¸íµÈ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 int getHeaderFieldInt(String name, int def)
          ¼ýÀÚ·Î ±¸¹® ºÐ¼®µÈ ¸í¸íµÈ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 String getHeaderFieldKey(int n)
          »öÀÎÀ¸·Î Çì´õ Çʵå ۸¦ °¡Á®¿É´Ï´Ù.
 String getHost()
          HttpConnectionÀÇ URL¿¡ ÁöÁ¤µÈ È£½ºÆ® Á¤º¸(¿¹: È£½ºÆ® À̸§ ¶Ç´Â IPv4 ÁÖ¼Ò)¸¦ ¹ÝȯÇÕ´Ï´Ù.
 long getLastModified()
          last-modified Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 int getPort()
          ÀÌ HttpConnection¿¡ ´ëÇÑ URLÀÇ ³×Æ®¿öÅ© Æ÷Æ® ¹øÈ£¸¦ ¹ÝȯÇÕ´Ï´Ù.
 String getProtocol()
          HttpConnectionÀÇ URL¿¡ ÁöÁ¤µÈ ÇÁ·ÎÅäÄÝ À̸§(¿¹: http ¶Ç´Â https)À» ¹ÝȯÇÕ´Ï´Ù.
 String getQuery()
          HttpConnectionÀÇ URL¿¡¼­ Äõ¸® ºÎºÐÀ» ¹ÝȯÇÕ´Ï´Ù.
 String getRef()
          HttpConnectionÀÇ URL¿¡¼­ ÂüÁ¶ ºÎºÐÀ» ¹ÝȯÇÕ´Ï´Ù.
 String getRequestMethod()
          ÇöÀç ¿äû ¸Þ¼Òµå(¿¹: HEAD, GET, POST)¸¦ °¡Á®¿É´Ï´Ù.
 String getRequestProperty(String key)
          ÀÌ ¿¬°áÀÇ ¸í¸íµÈ ÀÏ¹Ý ¿äû µî·Ï Á¤º¸ °ªÀ» ¹ÝȯÇÕ´Ï´Ù.
 int getResponseCode()
          HTTP ÀÀ´ä »óÅ Äڵ带 ¹ÝȯÇϸç, ÀÀ´äÀ» ´ÙÀ½°ú °°ÀÌ ±¸¹® ºÐ¼®ÇÕ´Ï´Ù.
 String getResponseMessage()
          ÀÀ´ä ÄÚµå¿Í ÇÔ²² ¼­¹ö¿¡¼­ ¹ÝȯµÈ HTTP ÀÀ´ä ¸Þ½ÃÁö¸¦ °¡Á®¿É´Ï´Ù.
 String getURL()
          ÀÌ ¿¬°á¿¡ ´ëÇÑ URLÀÇ ¹®ÀÚ¿­ Ç¥ÇöÀ» ¹ÝȯÇÕ´Ï´Ù.
 void setRequestMethod(String method)
          URL ¿äû ¸Þ¼Òµå¸¦ ´ÙÀ½ Áß Çϳª·Î ¼³Á¤ÇÕ´Ï´Ù.
 void setRequestProperty(String key, String value)
          ÀÏ¹Ý ¿äû µî·Ï Á¤º¸¸¦ ¼³Á¤ÇÕ´Ï´Ù.
 
Methods inherited from interface javax.microedition.io.ContentConnection
getEncoding, getLength, getType
 
Methods inherited from interface javax.microedition.io.InputConnection
openDataInputStream, openInputStream
 
Methods inherited from interface javax.microedition.io.Connection
close
 
Methods inherited from interface javax.microedition.io.OutputConnection
openDataOutputStream, openOutputStream
 

Field Detail

HEAD

public static final String HEAD
HTTP Head ¸Þ¼Òµå

See Also:
Constant Field Values

GET

public static final String GET
HTTP Get ¸Þ¼Òµå

See Also:
Constant Field Values

POST

public static final String POST
HTTP Post ¸Þ¼Òµå

See Also:
Constant Field Values

HTTP_OK

public static final int HTTP_OK
200: ¿äûÀÌ ¼º°øÇß½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_CREATED

public static final int HTTP_CREATED
201: ¿äûÀÌ ÀÌÇàµÇ¾úÀ¸¸ç ±× °á°ú »õ·Î¿î ÀÚ¿øÀÌ ¸¸µé¾îÁ³½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_ACCEPTED

public static final int HTTP_ACCEPTED
202: ¿äû 󸮰¡ ½ÂÀεǾúÁö¸¸ 󸮰¡ ¿Ï·áµÇÁö ¾Ê¾Ò½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_NOT_AUTHORITATIVE

public static final int HTTP_NOT_AUTHORITATIVE
203: entity-header¿¡ ¹ÝȯµÈ meta-informationÀº ¿øº» ¼­¹ö¿¡¼­ »ç¿ëÇÒ ¼ö ÀÖ´Â Á¤ÀÇ ÁýÇÕÀÌ ¾Æ´Õ´Ï´Ù.

See Also:
Constant Field Values

HTTP_NO_CONTENT

public static final int HTTP_NO_CONTENT
204: ¼­¹ö¿¡¼­ ¿äûÀ» ÀÌÇàÇßÁö¸¸ entity-body¸¦ ¹ÝȯÇÒ Çʿ䰡 ¾øÀ¸¸ç ¾÷µ¥ÀÌÆ®µÈ meta-informationÀ» ¹ÝȯÇÒ ¼öµµ ÀÖ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_RESET

public static final int HTTP_RESET
205: ¼­¹ö¿¡¼­ ¿äûÀ» ÀÌÇàÇßÀ¸¸ç »ç¿ëÀÚ ¿¡ÀÌÀüÆ®´Â ¿äûÀ» º¸³»°Ô ÇÑ ¹®¼­ º¸±â¸¦ Àç¼³Á¤ÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_PARTIAL

public static final int HTTP_PARTIAL
206: ¼­¹ö¿¡¼­ ÀÚ¿ø¿¡ ´ëÇÑ ºÎºÐ GET ¿äûÀ» ÀÌÇàÇß½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_MULT_CHOICE

public static final int HTTP_MULT_CHOICE
300: ¿äûµÈ ÀÚ¿øÀÌ °¢°¢ ƯÁ¤ À§Ä¡¸¦ °¡Áø Ç¥Çö ÁýÇÕ Áß Çϳª¿¡ ÀÏÄ¡Çϸç, »ç¿ëÀÚ°¡ ¿øÇϴ ǥÇöÀ» ¼±ÅÃÇÏ°í ¿äûÀ» ÇØ´ç À§Ä¡·Î ¸®µð·º¼ÇÇÒ ¼ö ÀÖµµ·Ï ¿¡ÀÌÀüÆ® ±¸µ¿ Çù»ó Á¤º¸°¡ Á¦°øµË´Ï´Ù.

See Also:
Constant Field Values

HTTP_MOVED_PERM

public static final int HTTP_MOVED_PERM
301: ¿äûµÈ ÀÚ¿ø¿¡ »õ·Î¿î ¿µ±¸ URLÀÌ ÇÒ´çµÇ¾úÀ¸¸ç ÀÌ ÀÚ¿ø¿¡ ´ëÇÑ ÀÌÈÄ ÂüÁ¶´Â ¹ÝȯµÈ URI Áß Çϳª¸¦ »ç¿ëÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_MOVED_TEMP

public static final int HTTP_MOVED_TEMP
302: ¿äûµÈ ÀÚ¿øÀÌ ÀϽÃÀûÀ¸·Î ´Ù¸¥ URI¿¡ ÀÖ½À´Ï´Ù. (ÁÖ: ÀÌ »óÅ ÄÚµåÀÇ À̸§Àº RFC2068ÀÇ ÀÌÀü ¹ßÇ๰À» ¹Ý¿µÇÕ´Ï´Ù. RFC2616¿¡¼­ "ÀϽÃÀûÀ¸·Î À̵¿µÊ"Àº "¹ß°ßµÊ"À¸·Î º¯°æµÇ¾ú½À´Ï´Ù. ÇÏÁö¸¸ Àǹ̴ º¯°æµÇÁö ¾Ê¾Ò½À´Ï´Ù. Location Çì´õ´Â ÀÀ¿ë ÇÁ·Î±×·¥ÀÌ ¿äûÀ» ´Ù½Ã º¸³»¾ß ÇÏ´Â À§Ä¡¸¦ ³ªÅ¸³À´Ï´Ù.)

See Also:
Constant Field Values

HTTP_SEE_OTHER

public static final int HTTP_SEE_OTHER
303: ¿äû¿¡ ´ëÇÑ ÀÀ´äÀº ´Ù¸¥ URI¿¡¼­ ãÀ» ¼ö ÀÖÀ¸¸ç ÇØ´ç ÀÚ¿ø¿¡ ´ëÇÑ GET ¸Þ¼Òµå¸¦ »ç¿ëÇÏ¿© °Ë»öÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_NOT_MODIFIED

public static final int HTTP_NOT_MODIFIED
304: Ŭ¶óÀÌ¾ðÆ®°¡ Á¶°ÇºÎ GET ¿äûÀ» ¼öÇàÇßÀ¸¸ç ¾×¼¼½º°¡ Çã¿ëµÇ¾úÁö¸¸ ¹®¼­¸¦ ¼öÁ¤ÇÏÁö ¾ÊÀº °æ¿ì ¼­¹ö´Â ÀÌ »óÅ ÄÚµå·Î ÀÀ´äÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_USE_PROXY

public static final int HTTP_USE_PROXY
305: ¿äûµÈ ÀÚ¿øÀº Location Çʵ忡 ÁöÁ¤µÈ ÇÁ·Ï½Ã¸¦ ÅëÇØ ¾×¼¼½ºÇØ¾ß ÇÕ´Ï´Ù.

See Also:
Constant Field Values

HTTP_TEMP_REDIRECT

public static final int HTTP_TEMP_REDIRECT
307: ¿äûµÈ ÀÚ¿øÀÌ ÀϽÃÀûÀ¸·Î ´Ù¸¥ URI¿¡ ÀÖ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_BAD_REQUEST

public static final int HTTP_BAD_REQUEST
400: À߸øµÈ Çü½ÄÀÇ ±¸¹® ¶§¹®¿¡ ¼­¹ö¿¡¼­ ¿äûÀ» ÀÌÇØÇÒ ¼ö ¾ø½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_UNAUTHORIZED

public static final int HTTP_UNAUTHORIZED
401: ¿äû¿¡ »ç¿ëÀÚ ÀÎÁõÀÌ ÇÊ¿äÇÕ´Ï´Ù. ÀÀ´ä¿¡´Â ¿äûµÈ ÀÚ¿ø¿¡ ÇØ´çÇÏ´Â ½Ãµµ°¡ Æ÷ÇÔµÈ WWW-Authenticate Çì´õ Çʵ尡 ÀÖ¾î¾ß ÇÕ´Ï´Ù.

See Also:
Constant Field Values

HTTP_PAYMENT_REQUIRED

public static final int HTTP_PAYMENT_REQUIRED
402: ÀÌ ÄÚµå´Â ÀÌÈÄ »ç¿ëÀ» À§ÇØ ¿¹¾àµË´Ï´Ù.

See Also:
Constant Field Values

HTTP_FORBIDDEN

public static final int HTTP_FORBIDDEN
403: ¼­¹ö°¡ ¿äûÀ» ÀÌÇØÇßÁö¸¸ ÀÌÇàÇϱ⸦ °ÅºÎÇÕ´Ï´Ù. ±ÇÇÑ ºÎ¿©µµ È¿°ú°¡ ¾øÀ¸¸ç ¿äûÀ» ¹Ýº¹ÇÏÁö ¾Ê´Â °ÍÀÌ ÁÁ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_NOT_FOUND

public static final int HTTP_NOT_FOUND
404: ¼­¹ö¿¡¼­ Request-URI¿¡ ÀÏÄ¡ÇÏ´Â Ç׸ñÀ» ãÁö ¸øÇß½À´Ï´Ù. Á¶°ÇÀÌ ÀϽÃÀûÀÎÁö ¶Ç´Â ¿µ±¸ÀûÀÎÁö È®ÀÎÇÒ ¼ö ¾ø½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_BAD_METHOD

public static final int HTTP_BAD_METHOD
405: Request-Line¿¡ ÁöÁ¤µÈ ¸Þ¼Òµå¸¦ Request-URI·Î ½Äº°µÈ ÀÚ¿ø¿¡ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_NOT_ACCEPTABLE

public static final int HTTP_NOT_ACCEPTABLE
406: ¿äû¿¡ ÀÇÇØ ½Äº°µÈ ÀÚ¿øÀÌ ¿äû ½Ã Àü¼ÛµÈ ½ÂÀÎ Çì´õ¿¡ µû¶ó ½ÂÀÎÇÒ ¼ö ¾ø´Â ³»¿ëÀÌ Æ÷ÇÔµÈ ÀÀ´ä ¿£Æ¼Æ¼¸¸ »ý¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_PROXY_AUTH

public static final int HTTP_PROXY_AUTH
407: ÀÌ ÄÚµå´Â 401 (Unauthorized)¿Í À¯»çÇÏÁö¸¸ Ŭ¶óÀÌ¾ðÆ®°¡ ¸ÕÀú ÇÁ·Ï½Ã¸¦ »ç¿ëÇÏ¿© ÀÚ½ÅÀ» ÀÎÁõÇØ¾ß ÇÔÀ» ³ªÅ¸³À´Ï´Ù.

See Also:
Constant Field Values

HTTP_CLIENT_TIMEOUT

public static final int HTTP_CLIENT_TIMEOUT
408: Ŭ¶óÀÌ¾ðÆ®°¡ ¼­¹ö ´ë±â ½Ã°£ ³»¿¡ ¿äûÇÏÁö ¸øÇß½À´Ï´Ù. Ŭ¶óÀÌ¾ðÆ®´Â ¾ðÁ¦µçÁö ¼öÁ¤ÇÏÁö ¾Ê°í ÀÌ ¿äûÀ» ¹Ýº¹ÇÒ ¼öµµ ÀÖ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_CONFLICT

public static final int HTTP_CONFLICT
409: ¿äûÀÌ ÀÚ¿øÀÇ ÇöÀç »óÅÂ¿Í Ãæµ¹ÇϹǷΠ¿äûÀ» ¿Ï·áÇÒ ¼ö ¾ø½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_GONE

public static final int HTTP_GONE
410: ¿äûµÈ ÀÚ¿øÀº ¼­¹ö¿¡¼­ ´õ ÀÌ»ó »ç¿ëÇÒ ¼ö ¾øÀ¸¸ç Àü´Þ ÁÖ¼Ò¸¦ ¾Ë ¼ö ¾ø½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_LENGTH_REQUIRED

public static final int HTTP_LENGTH_REQUIRED
411: ¼­¹ö¿¡¼­ Content- Length°¡ Á¤ÀǵÇÁö ¾ÊÀº ¿äûÀ» °ÅºÎÇÕ´Ï´Ù.

See Also:
Constant Field Values

HTTP_PRECON_FAILED

public static final int HTTP_PRECON_FAILED
412: Çϳª ÀÌ»óÀÇ ¿äû Çì´õ Çʵ忡 ÁöÁ¤µÈ »çÀü Á¶°ÇÀ» ¼­¹ö¿¡¼­ Å×½ºÆ®ÇÑ °á°ú false·Î Æò°¡µÇ¾ú½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_ENTITY_TOO_LARGE

public static final int HTTP_ENTITY_TOO_LARGE
413: ¼­¹ö¿¡¼­ ó¸®ÇÒ ¼ö ÀÖ´Â °Íº¸´Ù ¿äû ¿£Æ¼Æ¼°¡ ´õ Å©¹Ç·Î ¼­¹ö°¡ ¿äû 󸮸¦ °ÅºÎÇÕ´Ï´Ù.

See Also:
Constant Field Values

HTTP_REQ_TOO_LONG

public static final int HTTP_REQ_TOO_LONG
414: Request-URI°¡ ¼­¹ö¿¡¼­ ÇØ¼®ÇÒ ¼ö ÀÖ´Â °Íº¸´Ù ±æ¾î¼­ ¼­¹ö°¡ ¿äû 󸮸¦ °ÅºÎÇÕ´Ï´Ù.

See Also:
Constant Field Values

HTTP_UNSUPPORTED_TYPE

public static final int HTTP_UNSUPPORTED_TYPE
415: ¿äû ¿£Æ¼Æ¼°¡ ¿äûµÈ ¸Þ¼ÒµåÀÇ ¿äû ÀÚ¿ø¿¡¼­ Áö¿øÇÏÁö ¾Ê´Â Çü½ÄÀ̹ǷΠ¼­¹ö¿¡¼­ ¿äû 󸮸¦ °ÅºÎÇÕ´Ï´Ù.

See Also:
Constant Field Values

HTTP_UNSUPPORTED_RANGE

public static final int HTTP_UNSUPPORTED_RANGE
416: ¿äû¿¡ Range ¿äû Çì´õ Çʵ尡 Æ÷ÇԵǾî ÀÖÁö¸¸ ÀÌ ÇʵåÀÇ ¹üÀ§ ÁöÁ¤ÀÚ °ª Áß¿¡ ¼±ÅÃÇÑ ÀÚ¿øÀÇ ÇöÀç ¹üÀ§¿Í °ãÄ¡´Â °ªÀÌ ¾øÀ¸¸ç ¿äû¿¡ If-Range ¿äû Çì´õ Çʵ尡 Æ÷ÇԵǾî ÀÖÁö ¾ÊÀ¸¸é ¼­¹ö¿¡¼­ ÀÌ »óÅ ÄÚµå·Î ÀÀ´äÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_EXPECT_FAILED

public static final int HTTP_EXPECT_FAILED
417: ¼­¹ö°¡ Expect ¿äû Çì´õ Çʵ忡 ÁöÁ¤µÈ ±â´ë¸¦ ÃæÁ·½Ãų ¼ö ¾ø°Å³ª, ¼­¹ö°¡ ÇÁ·Ï½ÃÀÎ °æ¿ì ´ÙÀ½ °æÀ¯ ¼­¹ö¿¡¼­ ¿äûÀ» ÃæÁ·½Ãų ¼ö ¾ø´Ù´Â È®½ÇÇÑ Áõ°Å°¡ ÀÖ½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_INTERNAL_ERROR

public static final int HTTP_INTERNAL_ERROR
500: ¼­¹ö¿¡¼­ ¿¹»óÄ¡ ¸øÇÑ Á¶°ÇÀ» ¹ß°ßÇÏ¿© ¿äûÀ» ÀÌÇàÇÏÁö ¸øÇß½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_NOT_IMPLEMENTED

public static final int HTTP_NOT_IMPLEMENTED
501: ¼­¹ö¿¡¼­ ¿äû ÀÌÇà¿¡ ÇÊ¿äÇÑ ±â´ÉÀ» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_BAD_GATEWAY

public static final int HTTP_BAD_GATEWAY
502: °ÔÀÌÆ®¿þÀ̳ª ÇÁ·Ï½Ã·Î ÀÛµ¿ÇÏ´Â ¼­¹ö°¡ ¿äû ÀÌÇà Áß¿¡ ¾×¼¼½ºÇÑ ¾÷½ºÆ®¸² ¼­¹ö·ÎºÎÅÍ À¯È¿ÇÏÁö ¾ÊÀº ÀÀ´äÀ» ¹Þ¾Ò½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_UNAVAILABLE

public static final int HTTP_UNAVAILABLE
503: ÀϽÃÀû ¿À¹ö·Îµå ¶Ç´Â À¯Áö º¸¼ö·Î ÀÎÇØ ÇöÀç ¼­¹ö¿¡¼­ ¿äûÀ» ó¸®ÇÒ ¼ö ¾ø½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_GATEWAY_TIMEOUT

public static final int HTTP_GATEWAY_TIMEOUT
504: °ÔÀÌÆ®¿þÀ̳ª ÇÁ·Ï½Ã·Î ÀÛµ¿ÇÏ´Â ¼­¹ö°¡ ¿äû ¿Ï·á Áß¿¡ ¾×¼¼½ºÇÑ URI ¶Ç´Â ´Ù¸¥ º¸Á¶ ¼­¹ö¿¡ ÀÇÇØ ÁöÁ¤µÈ ¾÷½ºÆ®¸² ¼­¹ö·ÎºÎÅÍ ÀûÀýÇÑ ÀÀ´äÀ» ¹ÞÁö ¸øÇß½À´Ï´Ù.

See Also:
Constant Field Values

HTTP_VERSION

public static final int HTTP_VERSION
505: ¼­¹ö¿¡¼­ ¿äû ¸Þ½ÃÁö¿¡ »ç¿ëµÈ HTTP ÇÁ·ÎÅäÄÝ ¹öÀüÀ» Áö¿øÇÏÁö ¾Ê°Å³ª Áö¿øÀ» °ÅºÎÇÕ´Ï´Ù.

See Also:
Constant Field Values
Method Detail

getURL

public String getURL()
ÀÌ ¿¬°á¿¡ ´ëÇÑ URLÀÇ ¹®ÀÚ¿­ Ç¥ÇöÀ» ¹ÝȯÇÕ´Ï´Ù.

Returns:
ÀÌ ¿¬°á¿¡ ´ëÇÑ URLÀÇ ¹®ÀÚ¿­ Ç¥Çö

getProtocol

public String getProtocol()
HttpConnectionÀÇ URL¿¡ ÁöÁ¤µÈ ÇÁ·ÎÅäÄÝ À̸§(¿¹: http ¶Ç´Â https)À» ¹ÝȯÇÕ´Ï´Ù.

Returns:
HttpConnectionÀÇ URL¿¡ ÁöÁ¤µÈ ÇÁ·ÎÅäÄÝ

getHost

public String getHost()
HttpConnectionÀÇ URL¿¡ ÁöÁ¤µÈ È£½ºÆ® Á¤º¸(¿¹: È£½ºÆ® À̸§ ¶Ç´Â IPv4 ÁÖ¼Ò)¸¦ ¹ÝȯÇÕ´Ï´Ù.

Returns:
HttpConnectionÀÇ URL¿¡ ÁöÁ¤µÈ È£½ºÆ® Á¤º¸

getFile

public String getFile()
HttpConnectionÀÇ URL¿¡¼­ ÆÄÀÏ ºÎºÐÀ» ¹ÝȯÇÕ´Ï´Ù.

Returns:
HttpConnectionÀÇ URL¿¡¼­ ÆÄÀÏ ºÎºÐ. ÆÄÀÏÀÌ ¾øÀ¸¸é nullÀÌ ¹ÝȯµË´Ï´Ù.

getRef

public String getRef()
HttpConnectionÀÇ URL¿¡¼­ ÂüÁ¶ ºÎºÐÀ» ¹ÝȯÇÕ´Ï´Ù. RFC2396Àº ¼±Åà »çÇ×ÀÎ Á¶°¢ ½Äº°ÀÚ¸¦ URL¿¡¼­ ±³Â÷ ¹«´Ì(#) ¹®ÀÚ µÚÀÇ ÅØ½ºÆ®·Î ±ÔÁ¤ÇÕ´Ï´Ù. »ç¿ëÀÚ ¿¡ÀÌÀüÆ®´Â ÀÌ Á¤º¸¸¦ ÀÚ¿øÀÌ ¼º°øÀûÀ¸·Î °Ë»öµÈ ÈÄÀÇ Ãß°¡ ÂüÁ¶ Á¤º¸·Î »ç¿ëÇÒ ¼öµµ ÀÖ½À´Ï´Ù. Á¶°¢ ½Äº°ÀÚÀÇ Çü½Ä°ú ÇØ¼®Àº °Ë»öµÈ Á¤º¸ÀÇ ¹Ìµð¾î À¯Çü[RFC2046]¿¡ µû¶ó ´Þ¶óÁý´Ï´Ù.

Returns:
HttpConnectionÀÇ URL¿¡¼­ ÂüÁ¶ ºÎºÐ. °ªÀÌ ¾øÀ¸¸é nullÀÌ ¹ÝȯµË´Ï´Ù.

getQuery

public String getQuery()
HttpConnectionÀÇ URL¿¡¼­ Äõ¸® ºÎºÐÀ» ¹ÝȯÇÕ´Ï´Ù. RFC2396Àº Äõ¸® ±¸¼º ¿ä¼Ò¸¦ URL¿¡¼­ ù ¹øÂ° ¹°À½Ç¥(?) ¹®ÀÚ µÚÀÇ ÅØ½ºÆ®·Î Á¤ÀÇÇÕ´Ï´Ù.

Returns:
HttpConnectionÀÇ URL¿¡¼­ Äõ¸® ºÎºÐ. °ªÀÌ ¾øÀ¸¸é nullÀÌ ¹ÝȯµË´Ï´Ù.

getPort

public int getPort()
ÀÌ HttpConnection¿¡ ´ëÇÑ URLÀÇ ³×Æ®¿öÅ© Æ÷Æ® ¹øÈ£¸¦ ¹ÝȯÇÕ´Ï´Ù.

Returns:
ÀÌ HttpConnection¿¡ ´ëÇÑ URLÀÇ ³×Æ®¿öÅ© Æ÷Æ® ¹øÈ£. Connector.open¿¡ Àü´ÞµÈ ¹®ÀÚ¿­¿¡ Æ÷Æ® ¹øÈ£°¡ ¾øÀ¸¸é ±âº» HTTP Æ÷Æ® ¹øÈ£(80)°¡ ¹ÝȯµË´Ï´Ù.

getRequestMethod

public String getRequestMethod()
ÇöÀç ¿äû ¸Þ¼Òµå(¿¹: HEAD, GET, POST)¸¦ °¡Á®¿É´Ï´Ù. ±âº»°ªÀº GETÀÔ´Ï´Ù.

Returns:
HTTP ¿äû ¸Þ¼Òµå
See Also:
setRequestMethod(java.lang.String)

setRequestMethod

public void setRequestMethod(String method)
                      throws IOException
URL ¿äû ¸Þ¼Òµå¸¦ ´ÙÀ½ Áß Çϳª·Î ¼³Á¤ÇÕ´Ï´Ù. ¼¼ ¸Þ¼Òµå´Â ¸ðµÎ À¯È¿Çϸç ÇÁ·ÎÅäÄÝ Á¦ÇÑÀÇ Àû¿ëÀ» ¹Þ½À´Ï´Ù. ±âº» ¸Þ¼Òµå´Â GETÀÔ´Ï´Ù.

Parameters:
method - HTTP ¸Þ¼Òµå
Throws:
IOException - ¸Þ¼Òµå¸¦ Àç¼³Á¤ÇÒ ¼ö ¾ø°Å³ª ¿äûµÈ ¸Þ¼Òµå°¡ HTTP¿¡ À¯È¿ÇÏÁö ¾ÊÀº °æ¿ì
See Also:
getRequestMethod()

getRequestProperty

public String getRequestProperty(String key)
ÀÌ ¿¬°áÀÇ ¸í¸íµÈ ÀÏ¹Ý ¿äû µî·Ï Á¤º¸ °ªÀ» ¹ÝȯÇÕ´Ï´Ù.

Parameters:
key - ¿äû µî·Ï Á¤º¸¸¦ ¾Ë·ÁÁִ Ű¿öµå(¿¹: "accept")
Returns:
ÀÌ ¿¬°áÀÇ ¸í¸íµÈ ÀÏ¹Ý ¿äû µî·Ï Á¤º¸ °ª. ÁöÁ¤µÈ À̸§À» °¡Áø ۰¡ ¾øÀ¸¸é nullÀÌ ¹ÝȯµË´Ï´Ù.
See Also:
setRequestProperty(java.lang.String, java.lang.String)

setRequestProperty

public void setRequestProperty(String key,
                               String value)
                        throws IOException
ÀÏ¹Ý ¿äû µî·Ï Á¤º¸¸¦ ¼³Á¤ÇÕ´Ï´Ù. ÇØ´ç ۸¦ °¡Áø µî·Ï Á¤º¸°¡ ÀÖÀ¸¸é ±âÁ¸ °ªÀ» »õ °ªÀ¸·Î µ¤¾î¾¹´Ï´Ù.

ÁÖ: HTTP¿¡¼­ ¿©·¯ ÀνºÅϽº°¡ À¯È¿ÇÏ°Ô µ¿ÀÏÇÑ Å°¸¦ °¡Áú ¼ö ÀÖ´Â ¸ðµç ¿äû µî·Ï Á¤º¸´Â ´ÜÀÏ µî·Ï Á¤º¸¿¡ ¿©·¯ µî·Ï Á¤º¸¸¦ Ãß°¡ÇÒ ¼ö ÀÖµµ·Ï ½°Ç¥·Î ±¸ºÐµÈ ¸ñ·Ï ±¸¹®À» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.

Parameters:
key - ¿äûÀ» ¾Ë·ÁÁִ Ű¿öµå(¿¹: "accept")
value - ¿¬°áµÈ °ª
Throws:
IOException - ¿¬°á »óŰ¡ ¿¬°áµÊÀÎ °æ¿ì
See Also:
getRequestProperty(java.lang.String)

getResponseCode

public int getResponseCode()
                    throws IOException
HTTP ÀÀ´ä »óÅ Äڵ带 ¹ÝȯÇϸç, ÀÀ´äÀ» ´ÙÀ½°ú °°ÀÌ ±¸¹® ºÐ¼®ÇÕ´Ï´Ù.
 HTTP/1.0 200 OK
 HTTP/1.0 401 Unauthorized
¶ÇÇÑ ÀÀ´ä¿¡¼­ °¢°¢ Á¤¼ö 200°ú 401À» ÃßÃâÇÕ´Ï´Ù(¿¹: ÀÀ´äÀÌ À¯È¿ÇÑ HTTP°¡ ¾Æ´Ñ °æ¿ì).

Returns:
HTTP Status-Code ¶Ç´Â »óÅ Äڵ带 È®ÀÎÇÒ ¼ö ¾ø´Â °æ¿ì -1
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getResponseMessage

public String getResponseMessage()
                          throws IOException
ÀÀ´ä ÄÚµå¿Í ÇÔ²² ¼­¹ö¿¡¼­ ¹ÝȯµÈ HTTP ÀÀ´ä ¸Þ½ÃÁö¸¦ °¡Á®¿É´Ï´Ù. ÀÀ´äÀº ´ÙÀ½°ú °°½À´Ï´Ù.
 HTTP/1.0 200 OK
 HTTP/1.0 404 Not Found
¿©±â¼­ °¢°¢ ¹®ÀÚ¿­ "OK"¿Í "Not Found"¸¦ ÃßÃâÇÕ´Ï´Ù. ÀÀ´ä¿¡¼­ ¾Æ¹« °Íµµ È®ÀÎÇÒ ¼ö ¾øÀ¸¸é nullÀ» ¹ÝȯÇÕ´Ï´Ù(°á°ú°¡ À¯È¿ÇÑ HTTP°¡ ¾Æ´Ñ °æ¿ì).

Returns:
HTTP ÀÀ´ä ¸Þ½ÃÁö ¶Ç´Â null
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getExpiration

public long getExpiration()
                   throws IOException
expires Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.

Returns:
ÀÌ URLÀÌ ÂüÁ¶ÇÏ´Â ÀÚ¿øÀÇ ¸¸·á ³¯Â¥ ¶Ç´Â ¸¸·á ³¯Â¥¸¦ ¾Ë ¼ö ¾ø´Â °æ¿ì 0. °ªÀº 1970³â 1¿ù 1ÀÏ GMT ÀÌÈÄÀÇ ¹Ð¸®ÃÊ ¼öÀÔ´Ï´Ù.
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getDate

public long getDate()
             throws IOException
date Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.

Returns:
URLÀÌ ÂüÁ¶ÇÏ´Â ÀÚ¿øÀÇ Àü¼Û ³¯Â¥ ¶Ç´Â Àü¼Û ³¯Â¥¸¦ ¾Ë ¼ö ¾ø´Â °æ¿ì 0. ¹ÝȯµÈ °ªÀº 1970³â 1¿ù 1ÀÏ GMT ÀÌÈÄÀÇ ¹Ð¸®ÃÊ ¼öÀÔ´Ï´Ù.
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getLastModified

public long getLastModified()
                     throws IOException
last-modified Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù. °á°ú´Â 1970³â 1¿ù 1ÀÏ GMT ÀÌÈÄÀÇ ¹Ð¸®ÃÊ ¼öÀÔ´Ï´Ù.

Returns:
ÀÌ HttpConnectionÀÌ ÂüÁ¶ÇÏ´Â ÀÚ¿øÀÌ ¸¶Áö¸·À¸·Î ¼öÁ¤µÈ ³¯Â¥ ¶Ç´Â ³¯Â¥¸¦ ¾Ë ¼ö ¾ø´Â °æ¿ì 0
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getHeaderField

public String getHeaderField(String name)
                      throws IOException
¸í¸íµÈ Çì´õ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.

Parameters:
name - Çì´õ ÇʵåÀÇ À̸§
Returns:
¸í¸íµÈ Çì´õ ÇÊµå °ª ¶Ç´Â ÇØ´ç Çʵ尡 Çì´õ¿¡ ¾ø´Â °æ¿ì null
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getHeaderFieldInt

public int getHeaderFieldInt(String name,
                             int def)
                      throws IOException
¼ýÀÚ·Î ±¸¹® ºÐ¼®µÈ ¸í¸íµÈ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù.

ÀϺΠ¿¬°á À¯Çü(¿¹: http-ng)¿¡´Â ¹Ì¸® ±¸¹® ºÐ¼®µÈ Çì´õ°¡ Àֱ⠶§¹®¿¡ ÀÌ·¯ÇÑ ¾ç½ÄÀÇ getHeaderField°¡ »ç¿ëµË´Ï´Ù. ÇØ´ç ¿¬°á À¯ÇüÀÇ Å¬·¡½º´Â ÀÌ ¸Þ¼Òµå¸¦ ¹«½ÃÇÏ°í ±¸¹® ºÐ¼®À» ÇÇÇÒ ¼ö ÀÖ½À´Ï´Ù.

Parameters:
name - Çì´õ ÇʵåÀÇ À̸§
def - ±âº»°ª
Returns:
Á¤¼ö·Î ±¸¹® ºÐ¼®µÈ ¸í¸íµÈ ÇÊµå °ª. Çʵ尡 ¾ø°Å³ª Çʵå Çü½ÄÀÌ À߸øµÈ °æ¿ì def °ªÀÌ ¹ÝȯµË´Ï´Ù.
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getHeaderFieldDate

public long getHeaderFieldDate(String name,
                               long def)
                        throws IOException
³¯Â¥·Î ±¸¹® ºÐ¼®µÈ ¸í¸íµÈ ÇÊµå °ªÀ» ¹ÝȯÇÕ´Ï´Ù. °á°ú´Â ¸í¸íµÈ Çʵ尡 ³ªÅ¸³»´Â 1970³â 1¿ù 1ÀÏ GMT ÀÌÈÄÀÇ ¹Ð¸®ÃÊ ¼öÀÔ´Ï´Ù.

ÀϺΠ¿¬°á À¯Çü(¿¹: http-ng)¿¡´Â ¹Ì¸® ±¸¹® ºÐ¼®µÈ Çì´õ°¡ Àֱ⠶§¹®¿¡ ÀÌ·¯ÇÑ ¾ç½ÄÀÇ getHeaderField°¡ »ç¿ëµË´Ï´Ù. ÇØ´ç ¿¬°á À¯ÇüÀÇ Å¬·¡½º´Â ÀÌ ¸Þ¼Òµå¸¦ ¹«½ÃÇÏ°í ±¸¹® ºÐ¼®À» ÇÇÇÒ ¼ö ÀÖ½À´Ï´Ù.

Parameters:
name - Çì´õ ÇʵåÀÇ À̸§
def - ±âº»°ª
Returns:
³¯Â¥·Î ±¸¹® ºÐ¼®µÈ ÇÊµå °ª. Çʵ尡 ¾ø°Å³ª Çʵå Çü½ÄÀÌ À߸øµÈ °æ¿ì def ÀÎÀÚ °ªÀÌ ¹ÝȯµË´Ï´Ù.
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getHeaderField

public String getHeaderField(int n)
                      throws IOException
»öÀÎÀ¸·Î Çì´õ ÇÊµå °ªÀ» °¡Á®¿É´Ï´Ù.

Parameters:
n - Çì´õ ÇʵåÀÇ »öÀÎ
Returns:
n¹øÂ° Çì´õ ÇÊµå °ª ¶Ç´Â ¹è¿­ »öÀÎÀÌ ¹üÀ§¿¡¼­ ¹þ¾î³­ °æ¿ì null. Çʵ忡 °ªÀÌ ¾øÀ¸¸é ºó ¹®ÀÚ¿­ÀÌ ¹ÝȯµË´Ï´Ù.
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

getHeaderFieldKey

public String getHeaderFieldKey(int n)
                         throws IOException
»öÀÎÀ¸·Î Çì´õ Çʵå ۸¦ °¡Á®¿É´Ï´Ù.

Parameters:
n - Çì´õ ÇʵåÀÇ »öÀÎ
Returns:
n¹øÂ° Çì´õ Çʵå Ű ¶Ç´Â ¹è¿­ »öÀÎÀÌ ¹üÀ§¿¡¼­ ¹þ¾î³­ °æ¿ì null
Throws:
IOException - ¼­¹ö¿¡ ¿¬°áÇÏ´Â µ¿¾È ¿À·ù°¡ ¹ß»ýÇÑ °æ¿ì

MID ÇÁ·ÎÇÊ

ÀǰßÀ̳ª Á¦¾È »çÇ× º¸³»±â MID ÇÁ·ÎÇÊ »ç¾ç ¹öÀü 2.0
Java´Â ¹Ì±¹ ¹× ´Ù¸¥ ±¹°¡¿¡¼­ Sun Microsystems, Inc.ÀÇ »óÇ¥ ¶Ç´Â µî·Ï »óÇ¥ÀÔ´Ï´Ù. Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. ¸ðµç ±Ç¸®´Â ÀúÀÛ±ÇÀÚÀÇ ¼ÒÀ¯ÀÔ´Ï´Ù.