waprequest.java~1~

来自「封装了SQL、Socket、WAP、MIME等功能的通用组件」· JAVA~1~ 代码 · 共 86 行

JAVA~1~
86
字号
package com.lazybug.wap;

import com.lazybug.net.Packet;
import com.lazybug.util.Log;
import com.lazybug.util.Tools;
import com.lazybug.util.ConfigUtil;
import net.sourceforge.jwap.wsp.pdu.CWSPHeaders;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: Kehaoinfo</p>
 *
 * @author David Lau
 * @version 1.0
 */
public abstract class WAPRequest
{
    public static final int HTTP_METHOD_GET = 0;
    public static final int HTTP_METHOD_POST = 1;
    public static final String HTTP_METHOD_LABLES[] = {"GET", "POST"};
    /*事务编号,在事务管理中通过事务ID来获得*/
    private int tid;
    /*事务超时时间*/
    private int expired;
    /*事务关联的会话*/
    protected WAPSession session;

    protected WAPRequest( WAPSession session )
    {
        this.session = session;
        this.expired = ConfigUtil.getInteger("transcation_expired");
    }

    public WAPSession getSession()
    {
        return session;
    }

    public void setTid( int tid )
    {
        this.tid = tid;
    }

    public int getTid()
    {
        return tid;
    }

    public int getExpired()
    {
        return expired;
    }

    public Object ID()
    {
        return String.valueOf( this.tid );
    }

    /*设置请求事务包*/
    public abstract void setRequestPacket( Packet out );

    /*设置中止事务包*/
    public void setAbortPacket( Packet out )
    {
        out.write8( ( byte ) session.getPort() );
        out.write32( com.lazybug.util.Tools.intToBytes( tid ) );
        Log.logWarning( this,
                        "Send WAP-Abort.req(port=" + session.getPort() + ",tid=" +
                        tid + ")" );
    }

    public String toString()
    {
        StringBuffer sb = new StringBuffer();
        sb.append("Tid:"+tid);
        sb.append("\nExpired:"+Tools.getFormatTime("HH:mm:ss", this.expired));
        sb.append("\n"+this.session.toString());
        return sb.toString();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?