亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? httpposter.java

?? J2ME MIDP_Example_Applications
?? JAVA
字號(hào):
// Copyright 2003 Nokia Corporation.
//
// THIS SOURCE CODE IS PROVIDED 'AS IS', WITH NO WARRANTIES WHATSOEVER,
// EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS
// FOR ANY PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE
// OR TRADE PRACTICE, RELATING TO THE SOURCE CODE OR ANY WARRANTY OTHERWISE
// ARISING OUT OF ANY PROPOSAL, SPECIFICATION, OR SAMPLE AND WITH NO
// OBLIGATION OF NOKIA TO PROVIDE THE LICENSEE WITH ANY MAINTENANCE OR
// SUPPORT. FURTHERMORE, NOKIA MAKES NO WARRANTY THAT EXERCISE OF THE
// RIGHTS GRANTED HEREUNDER DOES NOT INFRINGE OR MAY NOT CAUSE INFRINGEMENT
// OF ANY PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OWNED OR CONTROLLED
// BY THIRD PARTIES
//
// Furthermore, information provided in this source code is preliminary,
// and may be changed substantially prior to final release. Nokia Corporation
// retains the right to make changes to this source code at
// any time, without notice. This source code is provided for informational
// purposes only.
//
// Nokia and Nokia Connecting People are registered trademarks of Nokia
// Corporation.
// Java and all Java-based marks are trademarks or registered trademarks of
// Sun Microsystems, Inc.
// Other product and company names mentioned herein may be trademarks or
// trade names of their respective owners.
//
// A non-exclusive, non-transferable, worldwide, limited license is hereby
// granted to the Licensee to download, print, reproduce and modify the
// source code. The licensee has the right to market, sell, distribute and
// make available the source code in original or modified form only when
// incorporated into the programs developed by the Licensee. No other
// license, express or implied, by estoppel or otherwise, to any other
// intellectual property rights is granted herein.
package whiteboard;

import java.io.*;
import java.util.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;

/**
 *  This class accepts and queues POST and GET requests for a particular URL,
 *  and services them in first-in-first-out order. Using the queue allows it to
 *  be thread-safe without forcing its clients ever to block. It also accept
 *  alternative MIME-types
 */
class HttpPoster
     implements Runnable
{
    protected String url;
    protected volatile boolean aborting = false;
    protected Vector requestQueue = new Vector();


    HttpPoster(String url)
    {
        this.url = url;
        Thread thread = new Thread(this);
        thread.start();
    }


    // sends a request with default MIME-type
    void sendRequest(String type, String request, HttpPosterListener listener)
        throws IOException
    {
        sendRequest(type, null, request, listener);
    }


    // sends a request with a given MIME-type
    synchronized void sendRequest(String type, String mimeType,
                                  String request, HttpPosterListener listener)
        throws IOException
    {
        // Create a new request and add it to the queue
        HttpRequest newRequest = new HttpRequest();
        newRequest.type = type;
        newRequest.request = request;
        newRequest.listener = listener;
        newRequest.mimeType = mimeType;
        requestQueue.addElement(newRequest);
        // wake up sending thread
        notify();
    }


    public void run()
    {
        running :
        while (!aborting)
        {
            HttpRequest request = null;

            synchronized (this)
            {
                while (requestQueue.size() == 0)
                {
                    try
                    {
                        // releases lock
                        wait();
                    }
                    catch (InterruptedException e)
                    {
                        // Ignore this thread is not interrupted in MIDP
                    }

                    if (aborting)
                    {
                        break running;
                    }
                }

                request = (HttpRequest) (requestQueue.elementAt(0));
                requestQueue.removeElementAt(0);
            }

            // sendRequest must have notified us
            doSend(request.type, request.mimeType, request.request, request.listener);
        }
    }



    private void doSend(String type, String mimeType,
                        String requestStr, HttpPosterListener listener)
    {
        HttpConnection conn = null;
        InputStream in = null;
        String responseStr = null;
        String errorStr = null;
        boolean wasError = false;

        try
        {
            int responseCode;
            conn = (HttpConnection) Connector.open(url);

            // Set the request method and headers
            conn.setRequestMethod(type);
            // write request
            writeRequest(conn, requestStr, mimeType);

            // read response
            responseStr = readResponse(conn);

            responseCode = conn.getResponseCode();
            if (responseCode != HttpConnection.HTTP_OK)
            {
                wasError = true;
                errorStr = "Unsupported response code: " + responseCode;
            }

            // support URL rewriting for session handling
            String rewrittenUrl = conn.getHeaderField("X-RewrittenURL");
            if (rewrittenUrl != null)
            {
                // use this new one in future
                url = rewrittenUrl;
            }
        }
        catch (IOException e)
        {
            wasError = true;
            errorStr = e.getMessage();
        }
        catch (SecurityException e)
        {
            wasError = true;
            errorStr = e.getMessage();
        }
        finally
        {
            if (conn != null)
            {
                try
                {
                    conn.close();
                }
                catch (IOException e)
                {
                    // already closing, just ignore
                }
            }
        }

        if (wasError)
        {
            listener.handleHttpError(errorStr);
        }
        else
        {
            listener.receiveHttpResponse(responseStr);
        }
    }


    private void writeRequest(HttpConnection conn, String request, String mimeType)
        throws IOException
    {
        OutputStream out = null;
        try
        {
            // sets the MIME-type if available
            if (mimeType != null)
            {
                conn.setRequestProperty("Content-Type", mimeType);
            }

            conn.setRequestProperty("Content-Length",
                                    Integer.toString(request.length()));

            // Getting the output stream may flush the headers
            out = conn.openOutputStream();
            int requestLength = request.length();
            for (int i = 0; i < requestLength; ++i)
            {
                out.write(request.charAt(i));
            }
        }
        finally
        {
            if (out != null)
            {
                try
                {
                    out.close();
                }
                catch (IOException e)
                {
                    // already closing, just ignore
                }
            }
        }
    }


    private String readResponse(HttpConnection conn)
        throws IOException
    {
        InputStream in = null;
        String responseStr = null;
        try
        {
            // Opening the InputStream will open the connection
            // and read the HTTP headers. They are stored until
            // requested.
            in = conn.openInputStream();

            // Get the length and process the data
            StringBuffer responseBuf;
            long length = conn.getLength();
            if (length > 0)
            {
                responseBuf = new StringBuffer((int) length);
            }
            else
            {
                // default length
                responseBuf = new StringBuffer();
            }

            int ch;
            while ((ch = in.read()) != -1)
            {
                responseBuf.append((char) ch);
            }
            responseStr = responseBuf.toString();
        }
        finally
        {
            if (in != null)
            {
                try
                {
                    in.close();
                }
                catch (IOException e)
                {
                    // already closing, just ignore
                }
            }
        }
        return responseStr;
    }


    // This is just for tidying up - the instance is useless after it has
    // been called
    void abort()
    {
        aborting = true;
        synchronized (this)
        {
            // wake up our posting thread and kill it
            notify();
        }
    }


    // Internal data structure to keep track of the requests
    private class HttpRequest
    {
        String type;
        String mimeType;
        String request;
        HttpPosterListener listener;
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美主播一区二区三区| 亚洲国产高清在线| 欧美三级视频在线| 国产日韩精品一区二区三区在线| 国产精品亲子伦对白| 激情综合色播激情啊| 91丨九色丨尤物| 欧美岛国在线观看| 亚洲国产视频网站| 国产福利精品导航| 在线观看国产日韩| 国产日韩欧美综合在线| 偷偷要91色婷婷| 国产精品一区免费视频| 在线不卡免费欧美| 国产精品私人影院| 国产乱对白刺激视频不卡| 欧美网站大全在线观看| 亚洲国产成人私人影院tom| 一级中文字幕一区二区| 日本sm残虐另类| av一区二区久久| 精品国产精品一区二区夜夜嗨| 亚洲一区二区在线观看视频 | 欧美一区二区三区视频在线观看| 国产女人水真多18毛片18精品视频| 亚洲一区二区成人在线观看| 国产一区二区三区av电影| 色噜噜狠狠色综合中国| 亚洲男女毛片无遮挡| 懂色av一区二区三区蜜臀| 日韩欧美精品三级| 男女男精品视频| 欧美精品xxxxbbbb| 久久99国产精品尤物| 91麻豆文化传媒在线观看| 国产精品美女久久久久久久久久久| 麻豆成人免费电影| 久久久久久久久久久电影| 蜜臀久久99精品久久久画质超高清 | 高清不卡一二三区| 久久久综合网站| 久久99精品久久久久| 91精品国产入口| 久久99日本精品| 色婷婷精品久久二区二区蜜臂av | 国内精品免费**视频| 欧美一区二视频| 一区二区国产视频| 97se亚洲国产综合自在线| 久久久久久麻豆| 秋霞国产午夜精品免费视频| 欧美三级电影在线观看| 亚洲综合久久av| 欧美视频一区二| 偷拍自拍另类欧美| 91精品国产综合久久久蜜臀粉嫩| 亚洲韩国一区二区三区| 欧美日韩国产美| 中文字幕在线观看不卡| 91久久香蕉国产日韩欧美9色| 国产清纯白嫩初高生在线观看91 | 中文字幕精品一区二区精品绿巨人| 日韩经典中文字幕一区| 91精品蜜臀在线一区尤物| 国产精品久久久99| 成人丝袜视频网| 国产精品短视频| 91首页免费视频| 亚洲国产欧美在线人成| 欧美图区在线视频| 美洲天堂一区二卡三卡四卡视频| 4438亚洲最大| 国产精品自拍av| 亚洲黄色小视频| 欧美人妖巨大在线| 美女www一区二区| 亚洲天堂网中文字| 日本乱人伦aⅴ精品| 亚洲午夜影视影院在线观看| 欧美一区二区三区免费大片| 成人免费视频一区二区| 三级不卡在线观看| 中文字幕不卡在线观看| 日本韩国视频一区二区| 极品美女销魂一区二区三区| 亚洲靠逼com| 久久久久久免费网| 欧美三级韩国三级日本三斤| 国内欧美视频一区二区| 26uuu久久综合| av不卡免费电影| 日韩和欧美的一区| 日韩毛片高清在线播放| 欧美肥大bbwbbw高潮| 丁香网亚洲国际| 一区二区三区小说| 精品国产第一区二区三区观看体验| 极品美女销魂一区二区三区免费| 国产亚洲短视频| 欧美日韩国产美| 国产一区在线精品| 亚洲另类一区二区| 精品日韩在线一区| av亚洲精华国产精华| 国产一区福利在线| 一区二区三区在线视频观看| 久久免费的精品国产v∧| 成人性生交大片免费看视频在线 | 视频一区中文字幕国产| 亚洲欧美偷拍卡通变态| 在线综合+亚洲+欧美中文字幕| 成人国产免费视频| 亚洲午夜精品在线| 亚洲电影在线免费观看| 1000精品久久久久久久久| 欧美丰满美乳xxx高潮www| 91麻豆精品秘密| 国产成人日日夜夜| 亚洲精品久久7777| 国产女同性恋一区二区| 国产性天天综合网| 国产婷婷色一区二区三区四区| 色狠狠色狠狠综合| 色呦呦网站一区| 懂色av一区二区夜夜嗨| 亚洲成av人片观看| 亚洲五码中文字幕| 日韩激情av在线| 亚洲午夜三级在线| 中文字幕亚洲欧美在线不卡| 国产精品成人在线观看| 久久久久久久久久电影| 欧美日韩精品一区二区在线播放| 99国产精品国产精品久久| 久久综合综合久久综合| 亚洲精品国产品国语在线app| 精品久久久久99| 欧美一区二区在线看| 欧美在线一区二区| 精品视频全国免费看| 高清久久久久久| 欧美三级电影精品| 欧美日韩高清在线播放| 欧美探花视频资源| 91麻豆精品国产91久久久久| 5858s免费视频成人| 日韩亚洲电影在线| 欧美成人女星排行榜| 国产精品乱码人人做人人爱| 日韩无一区二区| 国产无遮挡一区二区三区毛片日本 | 粉嫩绯色av一区二区在线观看| 亚洲一区二区欧美激情| 亚洲午夜久久久久久久久电影网| 美女视频一区二区| 免费久久99精品国产| 激情综合一区二区三区| 性做久久久久久免费观看欧美| 国产精品久久久久四虎| 欧美激情在线观看视频免费| 久久精品水蜜桃av综合天堂| 午夜影院久久久| 另类小说一区二区三区| 亚洲国产日韩一区二区| 亚洲国产人成综合网站| 久久疯狂做爰流白浆xx| 国产一区二区日韩精品| 国产mv日韩mv欧美| 一本色道久久加勒比精品| 欧美欧美欧美欧美首页| 日韩一区二区麻豆国产| 日韩一区和二区| 国产亚洲一二三区| 秋霞国产午夜精品免费视频| 一二三区精品视频| 亚洲色图.com| 日本va欧美va瓶| 老司机一区二区| 国产精品成人一区二区三区夜夜夜 | 极品美女销魂一区二区三区| 国产福利一区二区| 精品国产91乱码一区二区三区| 欧美高清在线视频| 免费成人av在线| 成人美女视频在线观看18| 欧美影院一区二区三区| 精品成人一区二区| 亚洲毛片av在线| 韩国女主播成人在线观看| 在线观看区一区二| 久久亚洲精品小早川怜子| 婷婷一区二区三区| 91麻豆产精品久久久久久| 欧美日韩一级二级三级| 亚洲国产激情av| 国产suv精品一区二区6| 国产精品日产欧美久久久久| 国产成人午夜视频| 久久亚洲综合色|