Package javax.sip.header

Examples of javax.sip.header.ContentTypeHeader


            RouteHeader routeHeader = protocolObjects.headerFactory
                    .createRouteHeader(protocolObjects.addressFactory
                            .createAddress(sipuri));

            // Create ContentTypeHeader
            ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
                    .createContentTypeHeader("application", "sdp");

            // Create a new CallId header
            CallIdHeader callIdHeader = sipProvider.getNewCallId();
            // JvB: Make sure that the implementation matches the messagefactory
View Full Code Here


    }
   
  
    public void testCreateMultipartMimeContent() throws Exception {
        MessageExt sipMessage = (MessageExt) messageFactory.createRequest(messageString);
        ContentTypeHeader cth = headerFactory.createContentTypeHeader("multipart", "alternative");
        cth.setParameter("boundary","myboundary");
        MultipartMimeContent mmc = messageFactory.createMultipartMimeContent(cth, type, subtype, content);
        Iterator<Content> contentIterator = mmc.getContents();
       
        int i  = 0;
        while (contentIterator.hasNext() ) {
            Content contentImpl = contentIterator.next();
            assertEquals("Content must match",contentImpl.getContent(), content[i]);
            assertEquals("Content Type match", contentImpl.getContentTypeHeader().getContentType(),type[i]);
            assertEquals("Content subtype match",contentImpl.getContentTypeHeader().getContentSubType(),subtype[i]);
            i++;
        }
       
        String mmcContentString = mmc.toString();
        sipMessage.setContent(mmcContentString, cth);
        MultipartMimeContent mmc1 = sipMessage.getMultipartMimeContent();
        contentIterator = mmc1.getContents();
       
        i  = 0;
        while (contentIterator.hasNext() ) {
            Content contentImpl = contentIterator.next();
            assertEquals("Content must match",contentImpl.getContent(), content[i]);
            assertEquals("Content Type match", contentImpl.getContentTypeHeader().getContentType(),type[i]);
            assertEquals("Content subtype match",contentImpl.getContentTypeHeader().getContentSubType(),subtype[i]);
            i++;
        }
       
        MessageExt message1 = (MessageExt) messageFactory.createRequest(messageSting1);
        ContentTypeHeader cth1 = (ContentTypeHeader)((HeaderFactoryExt)headerFactory).createHeader(contentType1);
        message1.setContent(contentString1, cth1);
       
        System.out.println("SIP Message after adding content " + message1);
       
        MultipartMimeContent mmc2 = message1.getMultipartMimeContent();
View Full Code Here

            // add via headers
            viaHeaders.add(viaHeader);

            // Create ContentTypeHeader
            ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
                    .createContentTypeHeader("application", "sdp");

            // Create a new CallId header
            CallIdHeader callIdHeader = provider.getNewCallId();
            // JvB: Make sure that the implementation matches the messagefactory
View Full Code Here

        return retval;
    }

    public boolean equals(Object other) {
        if (other instanceof ContentTypeHeader) {
            final ContentTypeHeader o = (ContentTypeHeader) other;
            return this.getContentType().equalsIgnoreCase( o.getContentType() )
                && this.getContentSubType().equalsIgnoreCase( o.getContentSubType() )
                && equalParameters( o );
        }
        return false;
    }
View Full Code Here

                ContentLengthHeader.NAME.length()  < 1300) {

            /*
             * Check to see we are within one UDP packet.
             */
            ContentTypeHeader cth = new ContentType("message", "sipfrag");
            buf.append("\r\n" + cth.toString());
            ContentLength clengthHeader = new ContentLength(clength);
            buf.append("\r\n" + clengthHeader.toString());
            buf.append("\r\n\r\n" + badReq);
        } else {
            ContentLength clengthHeader = new ContentLength(0);
View Full Code Here

             * having received PRACKs for all unacknowledged reliable provisional responses,
             * unless the final response is 2xx and any of the unacknowledged reliable provisional
             * responses contained a session description. In that case, it MUST NOT send a final
             * response until those provisional responses are acknowledged.
             */
            final ContentTypeHeader contentTypeHeader = ((SIPResponse)response).getContentTypeHeader();
            if (this.pendingReliableResponseAsBytes != null
                    && this.getDialog() != null
                    && this.getInternalState() != TransactionState._TERMINATED
                    && statusCode / 100 == 2
                    && contentTypeHeader != null
                    && contentTypeHeader.getContentType()
                            .equalsIgnoreCase(CONTENT_TYPE_APPLICATION)
                    && contentTypeHeader.getContentSubType()
                            .equalsIgnoreCase(CONTENT_SUBTYPE_SDP)) {
                if (!interlockProvisionalResponses ) {
                    throw new SipException("cannot send response -- unacked provisional");
                } else {
                    try {
View Full Code Here


            }
            byte[] content = request.getRawContent();
            if (content != null) {
                ContentTypeHeader contentTypeHeader =
                headerFactory.createContentTypeHeader("application", "sdp");
                // System.out.println("response = " + response);
                response.setContent(content, contentTypeHeader);
            }
            Dialog dialog = st.getDialog();
View Full Code Here

                null);
        // add via headers
        viaHeaders.add(viaHeader);

        // Create ContentTypeHeader
        ContentTypeHeader contentTypeHeader = headerFactory
                .createContentTypeHeader("application", "sdp");

        // Create a new CallId header
        CallIdHeader callIdHeader;
        callIdHeader = sipProvider.getNewCallId();
View Full Code Here

        Request request = messageFactory.createRequest(dstSipURI, method,
                callId, cSeq, from, to, via, maxForwards);
        request.addHeader(contact);
        if (contentType != null && contentSubType != null && content != null) {
            ContentTypeHeader contentTypeHdr = headerFactory
                    .createContentTypeHeader(contentType, contentSubType);
            request.setContent(content, contentTypeHdr);
        }
        // pass the headerFactory - issue17 by larryb@dev.java.net
        addStatus(headerFactory, request);
View Full Code Here

      FromHeader fromHeader = null;
      CSeqHeader cseqHeader = null;
      ViaHeader viaHeader = null;
      CallIdHeader callIdHeader = null;
      MaxForwardsHeader maxForwardsHeader = null;
      ContentTypeHeader contentTypeHeader = null;
      RouteHeader routeHeader = null;
      // LETS CREATEOUR HEADERS

      try {
        cseqHeader = headerFactory.createCSeqHeader(1L, Request.INVITE);
View Full Code Here

TOP

Related Classes of javax.sip.header.ContentTypeHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.