• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Response类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.sip.message.Response的典型用法代码示例。如果您正苦于以下问题:Java Response类的具体用法?Java Response怎么用?Java Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Response类属于javax.sip.message包,在下文中一共展示了Response类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processBye

import javax.sip.message.Response; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        logger.info("Dialog State = " + dialog.getState());
        Response response = protocolObjects.messageFactory.createResponse(
                200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:Shootist.java


示例2: processRequest

import javax.sip.message.Response; //导入依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
    try {
        if (requestEvent.getRequest().getMethod().equals(Request.NOTIFY)) {
            this.notifySeen = true;
        }
        Response response = this.messageFactory.createResponse(Response.OK,
                requestEvent.getRequest());
        ServerTransaction st = requestEvent.getServerTransaction();
        if (st == null) {
            st = sipProvider.getNewServerTransaction(requestEvent
                    .getRequest());
        }
        st.sendResponse(response);

    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Unexpected exception ");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:DeliverUnsolicitedNotifyTest.java


示例3: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    Dialog dialog = requestEvent.getDialog();
    System.out.println("local party = " + dialog.getLocalParty());
    try {
        System.out.println("shootme:  got a bye sending OK.");
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        System.out.println("Shootme : Dialog State is "
                + serverTransactionId.getDialog().getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:NoToTagOn1xxDialogLeakTest.java


示例4: processBye

import javax.sip.message.Response; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        logger.info("Dialog State = " + dialog.getState());
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:ClientTransactionCallingAlertTest.java


示例5: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    Dialog dialog = requestEvent.getDialog();
    logger.info("shootme: local party = " + dialog.getLocalParty());
    try {
        logger.info("shootme:  got a bye sending OK.");
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootme: Dialog State is "
                + serverTransactionId.getDialog().getState());

    } catch (Exception ex) {
        logger.error("UNexpected exception",ex);
        fail("UNexpected exception");

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:ServerTransactionRetransmissionTimerTest.java


示例6: processResponse

import javax.sip.message.Response; //导入依赖的package包/类
public void processResponse(ResponseEvent responseEvent) {
    Response response = responseEvent.getResponse();
    int code = response.getStatusCode();
    if (code == 180) {
        try {

            o_received180 = true;
            Request cancel = responseEvent.getClientTransaction().createCancel();
            ClientTransaction cancelTX = provider.getNewClientTransaction(cancel);
            cancelTX.sendRequest();
            System.out.println("Send CANCEL:\n" + cancel);
            o_sentCancel = true;

        } catch (SipException e) {
            e.printStackTrace();
            doFail(doMessage(e));
        }
    } else if (code == 200) {
        System.out.println("Receive Cancel200");
        o_receiver200Cancel = true;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:NoAutoDialogTest.java


示例7: processBye

import javax.sip.message.Response; //导入依赖的package包/类
public void processBye(Request request, ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        logger.info("Dialog State = " + dialog.getState());
        Response response = protocolObjects.messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:Shootist.java


示例8: processCancel

import javax.sip.message.Response; //导入依赖的package包/类
public void processCancel(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    try {
        logger.info("shootme:  got a cancel.");
        if (serverTransactionId == null) {
            logger.info("shootme:  null tid.");
            return;
        }
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        if (dialog.getState() != DialogState.CONFIRMED) {
            response = messageFactory.createResponse(
                    Response.REQUEST_TERMINATED, inviteRequest);
            inviteTid.sendResponse(response);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:25,代码来源:ServerTransactionRetransmissionTimerTest.java


示例9: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    final Request request = requestEvent.getRequest();
    final Dialog dialog = requestEvent.getDialog();
    try {
        final Response response = messageFactory.createResponse(200, request);
        if(serverTransactionId == null) {
        	serverTransactionId = ((SipProvider)requestEvent.getSource()).getNewServerTransaction(request);
        }
        serverTransactionId.sendResponse(response);
    } catch (Exception ex) {
        ex.printStackTrace();
        //System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:Shootme.java


示例10: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    final Request request = requestEvent.getRequest();
    
    try {
    	if (serverTransactionId == null) {
    		try {
    			serverTransactionId = ((SipProvider)requestEvent.getSource()).getNewServerTransaction(request);
} catch ( TransactionUnavailableException tae) {
	tae.printStackTrace();				
             return;
} catch ( TransactionAlreadyExistsException taex ) {
	// This is a retransmission so just return.
	return;				
}              	
        }
        final Response response = messageFactory.createResponse(200, request);            
        serverTransactionId.sendResponse(response);

    } catch (Exception ex) {
        ex.printStackTrace();
        //System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:29,代码来源:ShootmeDialogStateless.java


示例11: processInvite

import javax.sip.message.Response; //导入依赖的package包/类
public void processInvite(Request request, ServerTransaction st) {
    try {
        Dialog dialog = st.getDialog();
        Response response = protocolObjects.messageFactory.createResponse(
                Response.OK, request);
        ((ToHeader) response.getHeader(ToHeader.NAME))
                .setTag(((ToHeader) request.getHeader(ToHeader.NAME))
                        .getTag());

        Address address = protocolObjects.addressFactory
                .createAddress("Shootme <sips:" + myAddress + ":" + myPort
                        + ">");
        ContactHeader contactHeader = protocolObjects.headerFactory
                .createContactHeader(address);
        response.addHeader(contactHeader);
        st.sendResponse(response);
    } catch (Exception ex) {
        logger.error("unexpected exception",ex);
        TlsTest.fail("unexpected exception");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:Shootist.java


示例12: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    Dialog dialog = requestEvent.getDialog();
    System.out.println("local party = " + dialog.getLocalParty());
    try {
        System.out.println("shootme:  got a bye sending OK.");
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        System.out.println("Dialog State is "
                + serverTransactionId.getDialog().getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:Shootme.java


示例13: processBye

import javax.sip.message.Response; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Response response = protocolObjects.messageFactory.createResponse(
                200, request);
        serverTransactionId.sendResponse(response);
    } catch (Exception ex) {
        logger.error("unexpected exception",ex);
        fail("unexpected exception");

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:SelfroutingTest.java


示例14: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    Request request = requestEvent.getRequest();
    try {
        logger.info("shootme:  got a bye sending OK.");
        logger.info("shootme:  dialog = " + requestEvent.getDialog());
        logger.info("shootme:  dialogState = " + requestEvent.getDialog().getState());
        Response response = messageFactory.createResponse(200, request);
        if ( serverTransactionId != null) {
            serverTransactionId.sendResponse(response);
        }
        logger.info("shootme:  dialogState = " + requestEvent.getDialog().getState());

        this.byeSeen = true;


    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:Shootme.java


示例15: processResponse

import javax.sip.message.Response; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:25,代码来源:Shootme.java


示例16: processBye

import javax.sip.message.Response; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent, ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    try {
        System.out.println("shootme:  got a bye sending OK.");
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        System.out.println("Dialog State is " + serverTransactionId.getDialog().getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:19,代码来源:ShootmeAuth.java


示例17: processResponse

import javax.sip.message.Response; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:ShootmeNotImplementingListener.java


示例18: processResponse

import javax.sip.message.Response; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    Response response = (Response) responseReceivedEvent.getResponse();
    System.out.println("GOT RESPONSE:" + response.getStatusCode());
    if(responseReceivedEvent.getClientTransaction() == null) {
    	return;
    }
    try {
        if (response.getStatusCode() == Response.OK
                && ((CSeqHeader) response.getHeader(CSeqHeader.NAME))
                        .getMethod().equals(Request.INVITE)) {            	
        	System.out.println("Not Sending ACK to test dialog timeout");            	
        }
    } catch (Exception ex) {
        ex.printStackTrace();

        DialogTimeoutTest.fail(
                "Shootist: Exception on process respons/send info", ex);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:ShootistNotImplementingSipListenerExt.java


示例19: processBye

import javax.sip.message.Response; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        logger.info("Dialog State = " + dialog.getState());
        Response response = messageFactory.createResponse(
                200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:Shootist.java


示例20: processCancel

import javax.sip.message.Response; //导入依赖的package包/类
public void processCancel(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    try {
        System.out.println("shootme:  got a cancel.");
        if (serverTransactionId == null) {
            System.out.println("shootme:  null tid.");
            return;
        }
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        if (dialog.getState() != DialogState.CONFIRMED) {
            response = messageFactory.createResponse(
                    Response.REQUEST_TERMINATED, inviteRequest);
            inviteTid.sendResponse(response);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:25,代码来源:NoToTagOn1xxDialogLeakTest.java



注:本文中的javax.sip.message.Response类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProtocolDescription类代码示例发布时间:2022-05-22
下一篇:
Java MinguoDate类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap