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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? httpposter.java

?? J2ME MIDP_Example_Applications
?? JAVA
字號:
// 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.


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


// This class accepts and queues POST 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.


class HttpPoster
    implements Runnable
{
    private String url;
    private volatile boolean aborting = false;
    private Vector requestQueue = new Vector();
    private Vector httpRequestPropertiesQueue = new Vector();
    private Vector listenerQueue = new Vector();


    HttpPoster(String url)
    {
        this.url = url;

        Thread thread = new Thread(this);
        thread.start();
    }


    synchronized void sendHttpRequest(byte[] bytes,
                                      Hashtable httpRequestProperties,
                                      HttpPosterListener listener)
        throws IOException, UnsupportedEncodingException
    {
        httpRequestPropertiesQueue.addElement(httpRequestProperties);

        requestQueue.addElement(bytes);

        listenerQueue.addElement(listener);

        notify(); // wake up sending thread
    }



    public void run()
    {
        running :
        while (!aborting)
        {
            Hashtable httpRequestProperties;
            HttpPosterListener listener;

            byte[] bytes = null;
            synchronized (this)
            {
                while (requestQueue.size() == 0)
                {
                    try
                    {
                        wait(); // releases lock
                    }
                    catch (InterruptedException e)
                    {
                    }

                    if (aborting)
                    {
                        break running;
                    }
                }

                httpRequestProperties =
                    (Hashtable)
                    (httpRequestPropertiesQueue.elementAt(0));
                bytes = (byte[]) requestQueue.elementAt(0);
                listener = (HttpPosterListener)
                           (listenerQueue.elementAt(0));
                httpRequestPropertiesQueue.removeElementAt(0);
                requestQueue.removeElementAt(0);
                listenerQueue.removeElementAt(0);
            }

            // sendHttpRequest must have notified us
            doSend(httpRequestProperties, bytes, listener);
        }
    }


    private void doSend(Hashtable httpRequestProperties,
                        byte[] bytes,
                        HttpPosterListener listener)
    {
        HttpConnection conn = null;
        InputStream in = null;
        OutputStream out = null;
        String responseStr = null;
        String errorStr = null;
        boolean wasError = false;

        ByteArrayOutputStream responseBytes =
            new ByteArrayOutputStream();
        try
        {
            conn = (HttpConnection) Connector.open(url);

            // Set the request method
            conn.setRequestMethod(HttpConnection.POST);

            // Set the HTTP request header fields
            Enumeration enumeration = httpRequestProperties.keys();
            while(enumeration.hasMoreElements())
            {
            	String name = (String) enumeration.nextElement();
                String value = (String) httpRequestProperties.get(name);
            	conn.setRequestProperty(name, value);
            }

            // Getting the output stream may flush the headers
            out = conn.openOutputStream();

            out.write(bytes);

            // 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
            int ch;
            while ((ch = in.read()) != -1)
            {
                responseBytes.write(ch);
            }

            // If needed, one could add support for HTTP sessions
            // using URL re-writing here. See the SumMIDlet example
            // for more details.
        }
        catch (IOException e)
        {
            wasError = true;

            errorStr = "IOException connecting to '" + url + "'";
            if (e.getMessage() != null)
            {
                errorStr += (": " + e.getMessage());
            }
        }
        catch (SecurityException e)
        {
            wasError = true;
            errorStr = e.getMessage();
        }
        finally
        {
            if (in != null)
            {
                try
                {
                    in.close();
                }
                catch (IOException e)
                {
                    // just ignore, there is nothing we can do
                }
            }
            if (out != null)
            {
                try
                {
                    out.close();
                }
                catch (IOException e)
                {
                    // just ignore, there is nothing we can do
                }
            }
            if (conn != null)
            {
                try
                {
                    conn.close();
                }
                catch (IOException e)
                {
                    // just ignore, there is nothing we can do
                }
            }
        }


        if (wasError)
        {
            listener.handleHttpPosterError(errorStr);
        }
        else
        {
            listener.receiveHttpResponse(responseBytes.toByteArray());
        }
    }


    // The instance is useless after abort has been called.
    void abort()
    {
        aborting = true;
        synchronized (this)
        {
            notify(); // wake up our posting thread and kill it
        }
    }


    boolean isAborting()
    {
        return aborting;
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜免费电影| 久久欧美中文字幕| 欧美精品久久天天躁| 欧美日韩一二三区| 久久久夜色精品亚洲| 一区二区三区蜜桃| 久久99精品国产91久久来源| 国产成人精品网址| 欧美亚洲禁片免费| 国产精品卡一卡二卡三| 亚洲视频一区二区在线| 国内精品久久久久影院色| 91免费精品国自产拍在线不卡| 欧美一区二区三区日韩| 中文字幕国产一区二区| 三级不卡在线观看| 91香蕉视频在线| 26uuu成人网一区二区三区| 久久久亚洲精华液精华液精华液| 亚洲香肠在线观看| 国产69精品久久久久777| 欧美精品久久99| 综合av第一页| 秋霞午夜av一区二区三区| 91玉足脚交白嫩脚丫在线播放| 久久丝袜美腿综合| 轻轻草成人在线| 欧美特级限制片免费在线观看| 国产午夜精品美女毛片视频| 亚洲v精品v日韩v欧美v专区| 欧美在线观看一区二区| 一区二区三区国产精品| 欧美日精品一区视频| 五月激情综合色| 欧美精品一二三四| 日韩—二三区免费观看av| 91精品国产欧美一区二区| 日本女优在线视频一区二区| 欧美一区二区三区在线视频 | 视频一区二区三区在线| 91福利在线看| 午夜视黄欧洲亚洲| 91精品国产综合久久久久| 美国毛片一区二区三区| 精品区一区二区| 国产精品一级二级三级| 国产精品久久久久久久久免费樱桃 | 极品美女销魂一区二区三区免费| 日韩丝袜情趣美女图片| 国产九色精品成人porny| 中文字幕免费在线观看视频一区| 97精品久久久久中文字幕 | 欧美精品一区二区在线播放| 国产伦精品一区二区三区视频青涩 | 欧美三级中文字幕| 人人超碰91尤物精品国产| 久久网这里都是精品| 91麻豆.com| 日韩高清在线不卡| 久久久www成人免费无遮挡大片| 成人黄色在线网站| 亚洲一级在线观看| 日韩视频在线你懂得| 成人国产精品免费网站| 有坂深雪av一区二区精品| 欧美成人欧美edvon| av不卡免费电影| 亚洲一区二区三区四区在线观看 | 日韩一区欧美二区| 国产精品污www在线观看| 欧美日韩在线播放一区| 激情av综合网| 亚洲与欧洲av电影| 2023国产精品视频| 欧美午夜不卡在线观看免费| 国产精品自拍网站| 亚洲图片欧美一区| 国产喂奶挤奶一区二区三区| 欧美挠脚心视频网站| 国产伦精品一区二区三区视频青涩 | 亚洲卡通欧美制服中文| 欧美成人官网二区| 欧美在线三级电影| gogogo免费视频观看亚洲一| 日本午夜精品视频在线观看| 亚洲欧美成aⅴ人在线观看| 精品久久久久久久久久久久包黑料 | 日本伊人午夜精品| 国产精品素人视频| 欧美成人video| 欧美日韩一区在线观看| 成人av一区二区三区| 狠狠色丁香九九婷婷综合五月| 亚洲无人区一区| 亚洲品质自拍视频| 国产日韩欧美综合一区| 欧美mv日韩mv| 91精品久久久久久久99蜜桃| 91福利资源站| 91色九色蝌蚪| 99久久精品国产毛片| 岛国一区二区在线观看| 国产一区二区在线影院| 老司机免费视频一区二区| 亚洲高清免费观看| 一区二区三区精品视频| 国产精品久久久久久久久免费丝袜 | 亚洲一级二级三级在线免费观看| 中文字幕免费观看一区| 国产日韩欧美亚洲| 久久婷婷成人综合色| 久久久不卡影院| 国产三级欧美三级| 中文字幕av资源一区| 国产精品欧美经典| 国产精品素人视频| 国产精品视频第一区| 亚洲欧美综合在线精品| 日韩一区欧美小说| 亚洲精品日韩专区silk| 亚洲人成影院在线观看| 亚洲视频小说图片| 亚洲综合免费观看高清完整版 | 91原创在线视频| 日本久久一区二区| 欧美日高清视频| 欧美精品色综合| 日韩一区二区免费电影| 精品国产免费一区二区三区香蕉| 精品88久久久久88久久久| 欧美激情在线一区二区三区| 中国av一区二区三区| 亚洲综合久久久| 日本不卡视频在线观看| 国产精品一级在线| 在线观看网站黄不卡| 欧美高清视频不卡网| 久久午夜电影网| 亚洲日本在线看| 日产欧产美韩系列久久99| 韩国视频一区二区| 色综合欧美在线视频区| 91麻豆精品国产| 久久伊人蜜桃av一区二区| 亚洲日本电影在线| 青青草原综合久久大伊人精品| 久久精品国产成人一区二区三区| 精品亚洲国产成人av制服丝袜| 成人99免费视频| 欧美日韩激情一区二区三区| 欧美精品一区男女天堂| 亚洲人成电影网站色mp4| 日本在线不卡一区| 成人一级黄色片| 欧美日韩高清在线播放| 国产亚洲综合性久久久影院| 亚洲国产你懂的| 国产精品一线二线三线| 欧美色综合网站| 久久久久久电影| 婷婷中文字幕一区三区| 国产精品白丝jk白祙喷水网站 | 精品国产91洋老外米糕| 亚洲精选视频在线| 精品一区二区三区视频 | 亚洲精品一区二区在线观看| 亚洲精品高清视频在线观看| 韩国v欧美v日本v亚洲v| 欧美精品在线一区二区| 亚洲天堂网中文字| 国产乱子伦一区二区三区国色天香| 91蝌蚪国产九色| 亚洲国产精品激情在线观看| 免费成人在线观看| 欧美影视一区在线| 国产精品色一区二区三区| 精东粉嫩av免费一区二区三区| 欧洲精品在线观看| 1024成人网色www| 国产乱子轮精品视频| 欧美成人在线直播| 日本不卡免费在线视频| 欧美人牲a欧美精品| 亚洲精品第一国产综合野| 不卡的电影网站| 中文字幕av在线一区二区三区| 国产精品一区二区久久不卡| 日韩欧美国产电影| 石原莉奈在线亚洲二区| 欧美精选一区二区| 午夜视频在线观看一区二区| 色哟哟国产精品| 亚洲少妇30p| 91一区二区三区在线观看| 中文字幕不卡三区| 成人黄色777网| 国产精品欧美久久久久一区二区 | 日本中文字幕一区二区有限公司| 在线国产电影不卡| 亚洲国产成人av网|