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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? wapptr.java~353~

?? jwap 協議 udp 可以用于手機通訊
?? JAVA~353~
?? 第 1 頁 / 共 5 頁
字號:
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) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区在线免费观看 | 久久影院午夜论| 天堂成人国产精品一区| 欧美亚洲一区二区在线| 一级女性全黄久久生活片免费| 一本大道久久a久久综合婷婷| 亚洲三级在线免费| 色妞www精品视频| 五月婷婷色综合| 日韩视频国产视频| 国产美女精品人人做人人爽| 国产欧美一区二区三区在线老狼| av在线播放一区二区三区| 一区视频在线播放| 欧美午夜理伦三级在线观看| 日本欧美肥老太交大片| 久久精品一区二区三区不卡牛牛 | 欧美日韩精品是欧美日韩精品| 午夜av区久久| 久久网站最新地址| 一本到三区不卡视频| 免费观看久久久4p| 中文一区一区三区高中清不卡| 91成人在线精品| 美女视频一区在线观看| 国产精品三级在线观看| 欧美色倩网站大全免费| 国内国产精品久久| 亚洲免费av网站| 欧美一级在线免费| 91在线国内视频| 日韩不卡一区二区| 亚洲视频香蕉人妖| 精品乱码亚洲一区二区不卡| 播五月开心婷婷综合| 亚洲与欧洲av电影| 久久久国产一区二区三区四区小说 | 欧美日韩一区久久| 国产毛片精品视频| 亚洲第一激情av| 欧美激情一区二区三区四区| 欧美老肥妇做.爰bbww| 国产91精品欧美| 日韩黄色免费电影| 亚洲婷婷国产精品电影人久久| 91精品国产91久久久久久最新毛片 | 久久91精品国产91久久小草| 亚洲色图清纯唯美| 久久久不卡网国产精品二区| 欧美日韩电影一区| 不卡电影一区二区三区| 免费在线观看一区二区三区| 久久99久久精品| 亚洲伦理在线免费看| 久久伊人蜜桃av一区二区| 精品视频1区2区| 丁香天五香天堂综合| 久久爱www久久做| 亚洲高清不卡在线| 亚洲免费av高清| 亚洲欧美国产高清| 中文字幕一区二区三区av| 久久久久久免费| 久久午夜电影网| 久久久精品欧美丰满| 精品日韩欧美在线| 欧美一区二区免费视频| 欧美日韩国产综合一区二区三区 | 亚洲成人精品一区二区| 亚洲视频精选在线| 国产精品久久久久久户外露出| 久久婷婷综合激情| 欧美草草影院在线视频| 欧美一区二区三区男人的天堂| 欧美最猛性xxxxx直播| 在线免费一区三区| 欧美色综合天天久久综合精品| 欧美丝袜自拍制服另类| 91官网在线免费观看| 色婷婷精品久久二区二区蜜臀av| 99精品国产一区二区三区不卡| 成人精品视频网站| av综合在线播放| 日本黄色一区二区| 欧美日韩一二三区| 欧美丰满嫩嫩电影| 91精品一区二区三区在线观看| 7777精品伊人久久久大香线蕉完整版| 欧美高清激情brazzers| 日韩一级片在线播放| 亚洲欧美影音先锋| 亚洲精品亚洲人成人网| 一区二区三区在线免费| 一个色妞综合视频在线观看| 亚洲福中文字幕伊人影院| 日韩中文欧美在线| 蜜桃av一区二区三区| 伦理电影国产精品| 国产精品99久久不卡二区| 成人一区二区三区| 色婷婷激情综合| 这里只有精品免费| 国产视频一区不卡| 亚洲一区二区三区免费视频| 日韩精彩视频在线观看| 国产成人综合精品三级| 日本电影欧美片| 日韩精品一区二区三区四区视频| 久久久久久久精| 亚洲靠逼com| 日本视频免费一区| 国内久久精品视频| 色94色欧美sute亚洲线路一ni| 欧美精品一级二级三级| 久久久蜜臀国产一区二区| 一区二区三区在线免费| 国产一区二区91| 欧洲在线/亚洲| 久久精品视频在线看| 亚洲一区二区在线视频| 国产一区91精品张津瑜| 欧美色视频在线观看| 国产日韩精品一区| 亚洲va国产va欧美va观看| 粉嫩av亚洲一区二区图片| 欧美日本乱大交xxxxx| 欧美国产在线观看| 美国十次了思思久久精品导航| 99久久精品免费| 久久婷婷国产综合精品青草| 亚洲最大成人综合| 成人avav影音| 欧美精品一区二区在线播放| 一区二区三区四区激情| 国产一区二区三区美女| 欧美一区二区网站| 亚洲一区影音先锋| 国产91丝袜在线观看| 日韩欧美一级二级三级久久久| 一区二区三区在线观看动漫| 欧美嫩在线观看| 中文字幕亚洲区| 国产老妇另类xxxxx| 91精品在线观看入口| 亚洲一二三四在线| 91麻豆6部合集magnet| 久久综合久久综合亚洲| 亚洲一区二区三区视频在线播放 | 国产精品一区二区你懂的| 欧美久久一二区| 亚洲mv在线观看| 91久久人澡人人添人人爽欧美| 最新不卡av在线| 99久久精品免费| 亚洲天堂2014| 92国产精品观看| 中文字幕一区二区5566日韩| 国产福利一区二区三区视频在线| 精品999在线播放| 国产在线视频精品一区| 日韩三级视频在线看| 美女视频一区在线观看| 日韩精品一区二区三区swag| 美国三级日本三级久久99 | 精品剧情v国产在线观看在线| 首页国产欧美久久| 欧美日韩精品福利| 日韩在线一区二区| 日韩一区二区三区四区五区六区| 日本亚洲最大的色成网站www| 欧美一级国产精品| 欧美aaa在线| 精品国产一区二区国模嫣然| 国产一区二区三区日韩| 久久久久国产一区二区三区四区| 国产成人一区二区精品非洲| 国产亚洲午夜高清国产拍精品| 成人永久免费视频| 亚洲黄色小视频| 欧美浪妇xxxx高跟鞋交| 美美哒免费高清在线观看视频一区二区| 日韩一区二区三区电影| 国产乱子轮精品视频| 国产精品久久福利| 欧美性受极品xxxx喷水| 三级亚洲高清视频| 久久综合久色欧美综合狠狠| 成人天堂资源www在线| 亚洲欧美激情插| 欧美成人女星排名| 99这里只有久久精品视频| 一区二区三区成人在线视频| 91精品国产欧美一区二区18| 国产一区二区三区四区五区入口| 亚洲人成亚洲人成在线观看图片 | 国产在线国偷精品产拍免费yy| 久久婷婷一区二区三区| 一本到一区二区三区| 免费观看久久久4p| 中文在线一区二区|