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

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

?? wapptr.java~349~

?? jwap 協(xié)議 udp 可以用于手機(jī)通訊
?? JAVA~349~
?? 第 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) {
                    if (request instanceof GetRequest) {

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产91高潮流白浆在线麻豆| 91豆麻精品91久久久久久| 国产成人在线视频网站| 99这里只有精品| 欧美一区二区精品久久911| 欧美激情在线一区二区三区| 日本一区中文字幕| 白白色 亚洲乱淫| 精品久久久久久久久久久院品网| 亚洲免费大片在线观看| 国产成人综合在线播放| 欧美精品九九99久久| 亚洲特黄一级片| 九一久久久久久| 欧美欧美午夜aⅴ在线观看| 亚洲欧美一区二区三区极速播放| 国产一区二区在线影院| 欧美一区二区三区小说| 亚洲成人1区2区| 色先锋资源久久综合| 国产精品人妖ts系列视频| 激情综合网av| 精品国产一区二区三区久久久蜜月 | 亚洲高清在线精品| 成年人网站91| 中文字幕国产一区| 福利电影一区二区| 久久精品在这里| 国产麻豆精品在线观看| 久久免费看少妇高潮| 蜜乳av一区二区三区| 欧美一区国产二区| 视频一区视频二区中文字幕| 欧美色图激情小说| 亚洲一区二区欧美| 精品视频全国免费看| 亚洲国产成人tv| 在线播放中文一区| 美日韩一区二区| 欧美高清一级片在线| 亚洲不卡av一区二区三区| 欧美亚洲国产bt| 天天综合天天做天天综合| 欧美日韩国产免费一区二区| 日本不卡视频一二三区| 欧美一区二区大片| 精品中文字幕一区二区| 久久久久久久久久久久久久久99 | 国产成人精品综合在线观看| 亚洲国产精品黑人久久久| 成人黄色综合网站| 成人免费一区二区三区在线观看| 91在线无精精品入口| 亚洲综合色噜噜狠狠| 在线电影一区二区三区| 免费亚洲电影在线| 国产亚洲欧美激情| av网站免费线看精品| 亚洲综合男人的天堂| 欧美日韩国产另类一区| 久久er99精品| 亚洲天堂免费看| 91麻豆精品国产91久久久久久| 奇米精品一区二区三区在线观看一| 精品国产百合女同互慰| 成人高清免费在线播放| 亚洲图片自拍偷拍| 精品国产乱码久久久久久蜜臀| 不卡欧美aaaaa| 日韩精品1区2区3区| 久久久久久一级片| 欧美色视频一区| 国产精品一区二区在线观看网站 | 国产欧美日产一区| 欧美综合一区二区| 国产精品自拍一区| 一区二区免费看| 久久精品亚洲国产奇米99| 91麻豆免费观看| 久久av资源网| 亚洲一区免费在线观看| 中文字幕久久午夜不卡| 欧美区一区二区三区| 99久久伊人网影院| 麻豆精品在线看| 一区二区三区中文字幕精品精品 | 精品亚洲成a人| 亚洲国产一区二区在线播放| 久久久精品免费免费| 9191精品国产综合久久久久久| gogogo免费视频观看亚洲一| 久久福利资源站| 奇米777欧美一区二区| 亚洲麻豆国产自偷在线| 国产午夜精品一区二区三区四区| 91麻豆精品国产91久久久久久久久| 91免费国产视频网站| 国产精品中文有码| 老司机精品视频在线| 日韩精品免费视频人成| 亚洲人123区| 亚洲欧洲日产国产综合网| 久久综合久久久久88| 91精品国产综合久久精品麻豆 | 粉嫩一区二区三区性色av| 日日欢夜夜爽一区| 一卡二卡三卡日韩欧美| 中文字幕制服丝袜成人av| 国产日韩欧美在线一区| 久久无码av三级| 欧美xxx久久| 欧美一级生活片| 欧美一区二区视频在线观看2022| 色综合天天狠狠| 一本久久精品一区二区| 色综合久久66| 色欧美乱欧美15图片| 99久久99久久久精品齐齐| jizzjizzjizz欧美| 色综合天天综合在线视频| 91麻豆自制传媒国产之光| 色哟哟在线观看一区二区三区| 色丁香久综合在线久综合在线观看| 99久久久久免费精品国产 | 亚洲激情五月婷婷| 亚洲女同女同女同女同女同69| 亚洲欧美另类在线| 一区二区三区鲁丝不卡| 亚洲成人免费电影| 日韩电影在线一区| 久久国产精品色| 国产盗摄一区二区三区| 91在线观看下载| 欧美影院午夜播放| 欧美一区二区精品| 久久精品亚洲精品国产欧美| 日韩美女啊v在线免费观看| 亚洲欧美视频在线观看| 午夜天堂影视香蕉久久| 久久精品国产成人一区二区三区| 国产在线播放一区| 91麻豆福利精品推荐| 欧美久久久久久久久| 精品欧美一区二区久久 | 精品国产免费视频| 国产精品网站导航| 亚洲综合免费观看高清完整版在线| 日本欧美大码aⅴ在线播放| 国产在线播放一区二区三区| 91麻豆.com| 欧美tickling网站挠脚心| 国产精品久久久久国产精品日日| 亚洲制服丝袜av| 国产精品一区在线观看你懂的| 在线观看亚洲专区| 欧美精品一区二区三区在线播放| 亚洲免费在线播放| 国模大尺度一区二区三区| 在线观看视频一区二区| 欧美精品一区二区三| 一区二区三区四区乱视频| 国产综合成人久久大片91| 色妹子一区二区| 久久这里只有精品首页| 亚洲电影一级片| 99久久综合99久久综合网站| 精品日韩99亚洲| 亚洲大片在线观看| 成人午夜av电影| 精品三级av在线| 亚洲成av人片在线观看无码| 成人国产精品免费观看动漫| 日韩精品一区二区三区蜜臀| 一级特黄大欧美久久久| 国产乱人伦偷精品视频不卡| 欧美顶级少妇做爰| 一区二区三区美女视频| 成人午夜av影视| 久久香蕉国产线看观看99| 日本中文一区二区三区| 91麻豆免费观看| 成人免费在线播放视频| 丁香天五香天堂综合| 精品国产1区二区| 日韩高清中文字幕一区| 欧美亚洲免费在线一区| 伊人夜夜躁av伊人久久| 97精品久久久久中文字幕| 国产亚洲女人久久久久毛片| 精品伊人久久久久7777人| 91精品国产麻豆国产自产在线| 亚洲一区二区三区自拍| 色综合夜色一区| 一区二区高清在线| 欧洲视频一区二区| 一区二区高清视频在线观看| 在线免费观看一区| 一区2区3区在线看| 欧美伊人久久大香线蕉综合69| 亚洲综合图片区|