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

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

?? wapptr.java

?? jwap 協(xié)議 udp 可以用于手機(jī)通訊
?? JAVA
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
package net.sourceforge.jwap;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
import java.io.*;
import java.net.*;
import java.util.*;

import net.sourceforge.jwap.http.*;
import net.sourceforge.jwap.util.*;
import net.sourceforge.jwap.util.wbxml.*;
import net.sourceforge.jwap.wsp.*;
import net.sourceforge.jwap.wsp.pdu.*;
import net.sourceforge.jwap.wtp.*;
import org.apache.xml.serialize.*;
import org.w3c.dom.*;

/**
 * This class represents a WSP "User-Agent" which can be used for executing
 * WSP <code>GET</code> and <code>POST</code> methods.
 * <p>
 * <h3>Example</h3>
 * <pre>
 * WAPClient client = new WAPClient("localhost", 9201);
 * Request request = new GetRequest("http://localhost/");
 * client.connect();
 * Response response = client.execute(request);
 * client.disconnect();
 * </pre>
 * @author Michel Marti
 *
 */
public class WapPtr {

    /** Default connect/disconnect timeout in milliseconds: 30000 */
    public static final long DEFAULT_CONNECT_TIMEOUT = 10000;
    /** Default execute timeout in milliseconds: 500000 */
    public static final long DEFAULT_EXEC_TIMEOUT = 20000;

    public static final long DEFAULT_HTTP_TIMEOUT = 120000;

    private static final Logger log = Logger.getLogger(WapPtr.class);

    static {
        Logger.initLogSystem(true);
    }

    private static final String USAGE =
            "Usage: WAPClient <WAP-Gateway-address[:port]> [GET/POST] [options] <URL>\n" +
            "   if method (GET/POST) is unspecified, GET is assumed\n\n" +
            "   Common options:\n" +
            "      -u <user-agent>   The User-Agent (defaults to jWAP/1.x)\n" +
            "      -o <file>         write response to file\n" +
            "      -l [addr]:port    local port (and address) to bind to\n" +
            "      -tc <timeout>     connection timeout (seconds, default=30)\n" +
            "      -tx <timeout>     request timeout (seconds, default=180)\n" +
            "      -v                show response-headers\n\n" +
            "   POST options:\n" +
            "      -c <content-type> The content-type  of the response body\n" +
            "      -p <file>         A file containing the post data, use '-' to read" +
            " the post data from standard input";

    private static final String DEFAULT_CONTENT_TYPE = "application/unknown";
    private static final String CONNECTED = "CONNECTED";

    private InetAddress gwAddr;
    private InetAddress localAddr;
    private int gwPort;
    private int localPort;
    private CWSPSession session;
    private HttpSession http_session;
    private Hurl http_url = null;
    private long disconnectTimeout;
    private int downloadflg = 0;

    private byte[] sessionLock = new byte[0];

    private IWSPUpperLayer2 upperLayerImpl;
    private HttpUpperLayer upperlayerhttp;
    private Hashtable pendingRequests;
    public FileWork filework = null;
    public String[] LogStr = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
                             "0", "0"};
    public String FileType = "wml";
    public String DownLoadFileName = "";
    public String AgentName = "Nokio";
    public int Sendflg = 0;
    public int downmms = 0;
    public int xhtml_wml = 0;
    public int waitfor = 0;
    public long downtime = 0;
    public int linkgate = 1;
    public WapPtr() {

    }

    /**
     * Construct a new WAP Client
     * @param wapGateway hostname of the WAP gateway to use
     * @param port port-number
     * @throws UnknownHostException if the hostname cannot be resolved
     */
    public WapPtr(String wapGateway, int port) throws UnknownHostException {
        this(InetAddress.getByName(wapGateway), port);
    }

    /**
     * Construct a new WAP Client
     * @param wapGateway the address of the WAP gateway to use
     * @param port the WAP gateway port number
     */
    public WapPtr(InetAddress wapGateway, int port) {
        this(wapGateway, port, null, CWTPSocket.DEFAULT_PORT);
    }

    /**
     * Construct a new WAP Client
     * @param wapGateway the addresss of the WAP gateway to use
     * @param wapPort the WAP gateway port number
     * @param localAddress the local address to bind to
     * @param localPort the local port to bind to (0 to let the OS pick a free port)
     */
    public WapPtr(InetAddress wapGateway, int wapPort,
                  InetAddress localAddress,
                  int localPort) {
        gwAddr = wapGateway;
        gwPort = wapPort;
        this.localAddr = localAddress;
        this.localPort = localPort;
        upperLayerImpl = new UpperLayerImpl();
        pendingRequests = new Hashtable();
        filework = new FileWork();

    }

    public WapPtr(InetAddress localAddress, int localPort, int type) {

        if (!ReadJwapConf()) {
            log.error("WapPtr 讀取配置文件失敗");
            System.exit(1);
        }

        this.localAddr = localAddress;
        this.localPort = localPort;
        upperLayerImpl = new UpperLayerImpl();
        pendingRequests = new Hashtable();
        filework = new FileWork();

    }


    /**
     * Execute a request. The client must be connected to the gateway.
     * @param request the request to execute
     * @return the response
     * @throws SocketException if a timeout occurred
     * @throws IllegalStateException if the client is not connected
     */
    public Response execute(Request request) throws SocketException,
            IllegalStateException {
        return execute(request, DEFAULT_EXEC_TIMEOUT);
    }


    /**
     * Execute a request. The client must be connected to the gateway.
     * @param request the request to execute
     * @param timeout timeout in milliseconds
     * @return the response
     * @throws SocketException if a timeout occurred
     * @throws IllegalStateException if the client is not connected
     */
    public int execute_http(Request request, long timeout) throws
            SocketException,
            IllegalStateException {
        int code = -1;
        String basheader = "";
        synchronized (this) {
            if (http_session == null) {
                throw new IllegalStateException("Not yet connected");
            }

            basheader = "User-Agent:" + AgentName + "\r\n";
            basheader = basheader + "Accept: www/source;text/html;" +
                        "application/vnd.wap.xhtml+xml;" +
                        "application/xhtml+xml;" +
                        "application/wml+xml; application/vnd.wap.wmlc;" +
                        "text/vnd.wap.wml; image/vnd.wap.wbmp; image/png; image/jpeg; image/gif; image/tiff; */*\r\n";

            if (request instanceof GetRequest) {
                System.out.println("Executing GET Request for URL " +
                                   request.getURL());
                if (log.isDebugEnabled()) {
                    log.debug("Executing GET Request for URL " + request.getURL());
                }
                try {
                    code = http_session.s_get(basheader, request.getURL());
                } catch (Exception ex) {
                }
            } else if (request instanceof PostRequest) {
                System.out.println("Executing POST Request for URL " +
                                   request.getURL());
                if (log.isDebugEnabled()) {
                    log.debug("Executing POST Request for URL " +
                              request.getURL());
                }
                PostRequest post = (PostRequest) request;

                code = http_session.s_post(basheader, post.getRequestBody(),
                                           post.getContentType(), post.getURL());
            }

        }
        // Wait until the method shows up in our hashtable
        /*
                 if (httpwaitForCompletion(DEFAULT_HTTP_TIMEOUT) == 1) {
            code = -1;
                 } else {
            code = 200;

                 }*/
        int count = 0;
        for (count = 0; count < 3; count++) {
            if (httpwaitForCompletion(DEFAULT_HTTP_TIMEOUT) == 1) {
                code = -1;
                waitfor = 0;
                //http_session.pThreadClose();

                if (http_session.Sconnect() == 7) {
                    if (count >= 2) {
                        break;
                    }
                } else {
                    if (count < 2) {
                        if (request instanceof GetRequest) {
                            System.out.println(count +
                                               " Executing GET Request for URL " +
                                               request.getURL());
                            http_session.s_get(basheader, request.getURL());
                        } else if (request instanceof PostRequest) {
                            System.out.println(count +
                                               " Executing POST Request for URL " +
                                               request.getURL());
                            PostRequest post = (PostRequest) request;

                            code = http_session.s_post(basheader,
                                    post.getRequestBody(),
                                    post.getContentType(), post.getURL());

                        }
                    } else {
                        code = -1;
                        break;
                    }

                }
            } else {
                code = 200;
                break;
            }

        }

        if (log.isDebugEnabled()) {
            log.debug("Waiting " + timeout + "ms for execute completion...");
        }

        return code;
    }

    /**
     * Execute a request. The client must be connected to the gateway.
     * @param request the request to execute
     * @param timeout timeout in milliseconds
     * @return the response
     * @throws SocketException if a timeout occurred
     * @throws IllegalStateException if the client is not connected
     */
    public Response execute(Request request, long timeout) throws
            SocketException,
            IllegalStateException {
        CWSPMethodManager mgr = null;
        CWSPHeaders headers = request.getWSPHeaders();
        synchronized (this) {
            if (session == null) {
                throw new IllegalStateException("Not yet connected");
            }

            if (headers.getHeader("Encoding-Version") == null) {
                headers.setHeader("Encoding-Version", "2.0");
            }

            if (headers.getHeader("Accept") == null) {
                headers.setHeader("Accept", "*/*");
                headers.addHeader("Accept", "application/vnd.wap.wmlc");
                headers.addHeader("Accept",
                                  "application/vnd.wap.multipart.mixed");
                headers.addHeader("Accept", "application/vnd.wap.wmlcscriptc");
                headers.addHeader("Accept",
                                  "application/vnd.wap.multipart.related");
                headers.addHeader("Accept", "application/octet-stream");
                headers.addHeader("Accept", "text/plain");
                headers.addHeader("Accept", "text/css");
                headers.addHeader("Accept", "image/bmp");
                headers.addHeader("Accept", "image/gif");
                headers.addHeader("Accept", "image/jpg");
                headers.addHeader("Accept", "image/png");
                headers.addHeader("Accept", "image/vnd.wap.wbmp");
                headers.addHeader("Accept", "application/smil");
                headers.addHeader("Accept", "application/vnd.wap.mms-message");
                headers.addHeader("Accept", "text/vnd.sun.j2me.app-descriptor");
                headers.addHeader("Accept", "application/java-archive");

                headers.setHeader("Profile", "URIx");
                headers.addHeader("Profile", "URIy");

            }

            String uh = headers.getHeader("User-Agent");
            if (uh == null) {

                headers.setHeader("User-Agent", AgentName);
            } else if ("".equals(uh)) {
                headers.setHeader("User-Agent", AgentName);
            }

            if (request instanceof GetRequest) {
                System.out.println("Executing GET Request for URL " +
                                   request.getURL());
                if (log.isDebugEnabled()) {
                    log.debug("Executing GET Request for URL " + request.getURL());
                }
                mgr = session.s_get(headers, request.getURL());
            } else if (request instanceof PostRequest) {
                System.out.println("Executing POST Request for URL " +
                                   request.getURL());
                if (log.isDebugEnabled()) {
                    log.debug("Executing POST Request for URL " +
                              request.getURL());
                }
                PostRequest post = (PostRequest) request;
                mgr = session.s_post(post.getWSPHeaders(), post.getRequestBody(),
                                     post.getContentType(), post.getURL());
            }
        }
        // Wait until the method shows up in our hashtable
        if (log.isDebugEnabled()) {
            log.debug("Waiting " + timeout + "ms for execute completion...");
        }
        int count = 0;
        Response response = null;
        for (count = 0; count < 3; count++) {
            response = null;
            response = (Response) waitForCompletion(mgr, timeout);
            if (response == null) {
                if (count < 2) {

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品视频在线观看免费| av电影天堂一区二区在线观看| 26uuu亚洲综合色欧美| 99精品国产一区二区三区不卡| 日韩精品欧美成人高清一区二区| 国产精品成人网| 精品日本一线二线三线不卡| 欧美体内she精高潮| 成人av动漫网站| 国产一区三区三区| 日韩经典中文字幕一区| 亚洲激情一二三区| 国产精品美女久久久久aⅴ | thepron国产精品| 免播放器亚洲一区| 亚洲福中文字幕伊人影院| 亚洲欧美自拍偷拍| 国产片一区二区三区| 欧美成人一区二区三区在线观看| 正在播放一区二区| 欧美色爱综合网| 色婷婷综合久久久久中文| 成人性生交大片免费看视频在线| 九九精品一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 色狠狠色噜噜噜综合网| 丁香啪啪综合成人亚洲小说| 国产精品自拍三区| 国产一区二区影院| 激情小说亚洲一区| 九九精品视频在线看| 久久精品免费观看| 久久爱www久久做| 国产一区二区视频在线| 国内精品视频一区二区三区八戒| 捆绑变态av一区二区三区| 免费亚洲电影在线| 精品影院一区二区久久久| 麻豆精品视频在线观看| 91在线小视频| 99九九99九九九视频精品| 99久久国产综合精品色伊| 91在线云播放| 欧美三级日本三级少妇99| 91精品国产综合久久国产大片| 宅男噜噜噜66一区二区66| 欧美一区二区久久久| 日韩亚洲国产中文字幕欧美| 久久先锋资源网| 国产午夜精品久久久久久久| 国产精品欧美久久久久一区二区 | 日韩专区一卡二卡| 全国精品久久少妇| 极品瑜伽女神91| 粉嫩高潮美女一区二区三区| 成人黄动漫网站免费app| 97精品久久久午夜一区二区三区 | 欧美成人乱码一区二区三区| 久久九九99视频| 自拍偷拍亚洲综合| 国产又黄又大久久| 久久久不卡影院| 国产丝袜在线精品| 国产精品免费视频网站| 一区二区三区影院| 亚洲18影院在线观看| 麻豆成人免费电影| 粉嫩13p一区二区三区| 成人精品小蝌蚪| 欧美少妇一区二区| 久久久99久久| 中文字幕日本乱码精品影院| 午夜成人在线视频| 国产精品18久久久久久久久久久久 | 99精品国产热久久91蜜凸| 欧美日韩成人综合在线一区二区| 欧美成va人片在线观看| 亚洲日本一区二区三区| 日韩高清不卡一区二区| 国产精品一区在线观看你懂的| 91免费在线看| 精品久久一区二区三区| 亚洲精品国产精品乱码不99| 国产福利一区二区三区视频| 日韩一区二区中文字幕| 91在线观看免费视频| 欧美日韩中文一区| 欧美成人激情免费网| 国产精品传媒在线| 人人狠狠综合久久亚洲| 成人av片在线观看| 91精品国产麻豆国产自产在线 | 亚洲国产精品久久人人爱蜜臀| 久久不见久久见免费视频1| 一本一本久久a久久精品综合麻豆| 欧美一区二区三区在线观看视频| 国产精品卡一卡二| 久久不见久久见免费视频1| 91久久精品国产91性色tv| 国产性天天综合网| 日本不卡一区二区三区| 91官网在线免费观看| 国产欧美一区二区精品忘忧草| 日韩电影在线一区二区三区| 色天天综合色天天久久| 中文字幕国产一区| 久久精品久久综合| 欧美日韩高清一区二区三区| 成人免费不卡视频| 国产在线不卡一卡二卡三卡四卡| 国产91色综合久久免费分享| 日韩精品一区二区三区视频播放| 一区二区三区日韩欧美| 成人精品国产免费网站| 精品国产一区久久| 蓝色福利精品导航| 欧美一区国产二区| 天天综合色天天综合色h| 欧美专区在线观看一区| 亚洲日本在线a| 99久久精品免费精品国产| 欧美激情一区二区三区蜜桃视频| 九一久久久久久| 欧美成人精品3d动漫h| 青青草原综合久久大伊人精品优势 | 日韩一区二区三区视频在线观看| 亚洲综合男人的天堂| 99在线视频精品| 亚洲天堂a在线| 成人99免费视频| 中文字幕一区二区三区在线观看| 国产激情视频一区二区三区欧美| 26uuu另类欧美亚洲曰本| 国产一区二区三区四区五区美女 | 色综合天天综合网天天狠天天| 国产精品女同一区二区三区| 国v精品久久久网| 国产精品无人区| 99久久99久久久精品齐齐| 亚洲视频在线观看一区| 91在线观看一区二区| 亚洲免费观看高清在线观看| 色欲综合视频天天天| 一区二区三国产精华液| 欧美午夜精品久久久| 丝袜亚洲精品中文字幕一区| 欧美一区二区三区影视| 青青草97国产精品免费观看 | 亚洲一区二区精品久久av| 欧美日韩午夜影院| 青青草原综合久久大伊人精品 | 欧美精品一区视频| 黄网站免费久久| 国产精品欧美一区二区三区| 在线观看成人免费视频| 日本特黄久久久高潮| 欧美sm极限捆绑bd| 成人99免费视频| 偷拍日韩校园综合在线| 精品国内二区三区| 欧美一区二区免费视频| 激情偷乱视频一区二区三区| 国产精品你懂的| 欧美人xxxx| 国产精品一线二线三线精华| 亚洲欧美激情插| 91精品啪在线观看国产60岁| 国产一区二区三区在线观看免费| 国产精品久久久久婷婷| 欧美日韩在线三级| 国产精品亚洲成人| 亚洲国产一区视频| 精品福利一二区| 色视频成人在线观看免| 精品一区二区在线播放| 一区二区三区欧美视频| 日韩精品综合一本久道在线视频| av在线免费不卡| 麻豆高清免费国产一区| 亚洲日穴在线视频| 日韩欧美色综合网站| 91在线观看地址| 国产亚洲成aⅴ人片在线观看 | av不卡在线播放| 午夜在线电影亚洲一区| 久久综合久久综合久久| 色88888久久久久久影院野外| 美脚の诱脚舐め脚责91 | 国产精品国产三级国产aⅴ原创| 欧美在线观看视频一区二区三区| 精品亚洲免费视频| 亚洲一区免费观看| 国产欧美精品一区二区三区四区| 欧美日韩精品专区| 成人免费毛片高清视频| 青青青爽久久午夜综合久久午夜| 亚洲人成人一区二区在线观看| 精品处破学生在线二十三| 9191成人精品久久| 91免费视频大全|