Package javax.sip.header

Examples of javax.sip.header.Header


                String headers = nextPart.substring(0, position);
                ContentImpl content = new ContentImpl(rest, boundary);

                String[] headerArray = headers.split("\r\n");
                for (String hdr : headerArray) {
                    Header header = headerFactory.createHeader(hdr);
                    if (header instanceof ContentTypeHeader) {
                        content.setContentTypeHeader((ContentTypeHeader) header);
                    } else if (header instanceof ContentDispositionHeader) {
                        content.setContentDispositionHeader((ContentDispositionHeader) header);
                    } else {
                        throw new ParseException("Unexpected header type " + header.getName(), 0);
                    }
                    contentList.add(content);
                }

            }
View Full Code Here


                    if(h1 == null && h2 != null) return false;
                    if(h2 == null && h1 != null) return false;
                    // The following check should not be needed but we add it for findbugs.
                    if(h1 == null && h2 == null) continue;
                    try {
                        Header header1 = headerFactory.createHeader(hname, UriDecoder.decode(h1));
                        Header header2 = headerFactory.createHeader(hname, UriDecoder.decode(h2));
                        // those present in both must match according to the equals method of the corresponding header
                        if (!header1.equals(header2)) return false;
                    } catch (ParseException e) {
                        Debug.logError("Cannot parse one of the header of the sip uris to compare " + a + " " + b, e);
                        return false;
View Full Code Here

            assertEquals(newRequest,request);
            newRequest.setMethod("FOOBAR");
            assertFalse(newRequest.equals(request));
            newRequest = (Request) request.clone();
            // Add the extension header.
            Header extensionHeader = tiHeaderFactory.createHeader("My-Header",
                    "my header value");
            request.addHeader(extensionHeader);
            assertFalse( newRequest.equals(request) );
            request.removeHeader("My-Header");
            assertEquals(newRequest, request);
View Full Code Here

            Response newResponse = (Response) response.clone();
            assertEquals(newResponse, response);
            assertNotSame(newResponse, response);
            newResponse = (Response) response.clone();
            // Add the extension header.
            Header extensionHeader = tiHeaderFactory.createHeader("My-Header",
                    "my header value");
            newResponse.addHeader(extensionHeader);
            assertFalse(newResponse.equals(response));
            newResponse.removeHeader("My-Header");
            assertEquals(newResponse, response);
View Full Code Here

                        // Make sure that the return type matches.
                        assertTrue(fInterfaces[k].isAssignableFrom(testValue.getClass()));
                        String refhdrString = refType.toString();
                        String testhdrString = testValue.toString();
                        // Use the factory to test for equivalence
                        Header riHeader = createRiHeaderFromString(refhdrString);
                        if (riHeader == null)
                            throw new TckInternalError( "could not parse "  + refhdrString );

                        // Create a RI header from the string to test
                        // for equivalence. Note that we cannot compare
                        // ti header to RI header otherwise.
                        Header tiHeader = createRiHeaderFromString(testhdrString);
                        assertNotNull(tiHeader);
                        assertEquals("Retrieved header did not match RI",riHeader,tiHeader);
                    }
                } else if (refType == null) {
                    assertTrue(testValue == null);
View Full Code Here

                    ticontentType, contentObject);
            request.addHeader(tiextensionHeader);
            ListIterator  viaHeaders = request.getHeaders(ViaHeader.NAME);
            ViaHeader viaHeader = (ViaHeader) viaHeaders.next();
            assertTrue ( viaHeader.equals(tivia.iterator().next())) ;
            Header header  = request.getHeader("My-Header");
            assertTrue (header != null && header.equals(tiextensionHeader));
            request.removeHeader("My-Header");
            assertNull( request.getHeader("My-Header") ) ;
            Response response = tiMessageFactory.createResponse
            (statusCode,  ticallId, ticSeq,  tifrom,  tito,  tivia,
                    timaxForwards,  ticontentType, contentObject);
View Full Code Here

                + "a=rtpmap:18 G729A/8000\r\n" + "a=ptime:20\r\n";
        byte[] contents = sdpData.getBytes();

        request.setContent(contents, contentTypeHeader);

        Header callInfoHeader = headerFactory.createHeader("Call-Info",
                "<http://www.antd.nist.gov>");
        request.addHeader(callInfoHeader);

        return request;
    }
View Full Code Here

    // issue 17 on dev.java.net specify the headerFactory to use
    // report and fix thereof larryb@dev.java.net
    protected void addStatus(HeaderFactory headerFactory, Request request) {
        try {
            Header extension = headerFactory.createHeader(EXTENSION_HDR,
                    new Integer(counter++).toString());
            request.addHeader(extension);
        } catch (ParseException ex) {
            // do nothing
        }
View Full Code Here

            // do nothing
        }
    }

    protected void addStatus(Request request, Response response) {
        Header extension = request.getHeader(EXTENSION_HDR);
        if (extension != null)
            response.addHeader(extension);
    }
View Full Code Here

            contactHeader = headerFactory.createContactHeader(contactAddress);
            request.addHeader(contactHeader);

            // Add the extension header.
            Header extensionHeader = headerFactory.createHeader("My-Header",
                    "my header value");
            request.addHeader(extensionHeader);

            Header callInfoHeader = headerFactory.createHeader("Call-Info",
                    "<http://www.antd.nist.gov>");
            request.addHeader(callInfoHeader);

            SipURI myUri = addressFactory.createSipURI(null, host);
            myUri.setLrParam();
View Full Code Here

TOP

Related Classes of javax.sip.header.Header

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.