Package gov.nist.javax.sip.header

Examples of gov.nist.javax.sip.header.ContentType


                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


                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

   */
  public String getMessageContent() throws UnsupportedEncodingException {
    if (this.messageContent == null && this.messageContentBytes == null)
      return null;
    else if (this.messageContent == null) {
      ContentType contentTypeHeader = getContentTypeHeader();
      if (contentTypeHeader != null) {
        String charset = contentTypeHeader.getCharset();
        if (charset != null) {
          this.messageContent = new String(messageContentBytes,
              charset);
        } else {
          this.messageContent = new String(messageContentBytes,
View Full Code Here

          && this.messageContentObject == null) {
        return null;
      } else if (this.messageContentObject != null) {
        String messageContent = this.messageContentObject.toString();
        byte[] messageContentBytes;
        ContentType contentTypeHeader = getContentTypeHeader();
        if (contentTypeHeader != null) {
          String charset = contentTypeHeader.getCharset();
          if (charset != null) {
            messageContentBytes = messageContent.getBytes(charset);
          } else {
            messageContentBytes = messageContent
                .getBytes(contentEncodingCharset);
          }
        } else
          messageContentBytes = messageContent
              .getBytes(contentEncodingCharset);
        return messageContentBytes;
      } else if (this.messageContent != null) {
        byte[] messageContentBytes;
        ContentType contentTypeHeader = getContentTypeHeader();
        if (contentTypeHeader != null) {
          String charset = contentTypeHeader.getCharset();
          if (charset != null) {
            messageContentBytes = this.messageContent
                .getBytes(charset);
          } else {
            messageContentBytes = this.messageContent
View Full Code Here

   */
  public void setMessageContent(String type, String subType,
      String messageContent) {
    if (messageContent == null)
      throw new IllegalArgumentException("messgeContent is null");
    ContentType ct = new ContentType(type, subType);
    this.setHeader(ct);
    this.messageContent = messageContent;
    this.messageContentBytes = null;
    this.messageContentObject = null;
    // Could be double byte so we need to compute length
View Full Code Here

   * @param messageContent
   *            is the message content as a byte array.
   */
  public void setMessageContent(String type, String subType,
      byte[] messageContent) {
    ContentType ct = new ContentType(type, subType);
    this.setHeader(ct);
    this.setMessageContent(messageContent);

    computeContentLength(messageContent);
  }
View Full Code Here

  private void computeContentLength(Object content) {
    int length = 0;
    if (content != null) {
      if (content instanceof String) {
        String charset = null;
        ContentType contentTypeHeader = getContentTypeHeader();
        if (contentTypeHeader != null) {
          charset = contentTypeHeader.getCharset();
        }
        if (charset == null) {
          charset = contentEncodingCharset;
        }
        try {
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

     * @param messageContent is the messge content as a string.
     */
    public void setMessageContent(String type, String subType, String messageContent) {
        if (messageContent == null)
            throw new IllegalArgumentException("messgeContent is null");
        ContentType ct = new ContentType(type, subType);
        this.setHeader(ct);
        this.messageContent = messageContent;
        this.messageContentBytes = null;
        this.messageContentObject = null;
        // Could be double byte so we need to compute length
View Full Code Here

     * @param type is the messge type.
     * @param subType is the message subType.
     * @param messageContent is the message content as a byte array.
     */
    public void setMessageContent(String type, String subType, byte[] messageContent) {
        ContentType ct = new ContentType(type, subType);
        this.setHeader(ct);
        this.setMessageContent(messageContent);

        computeContentLength(messageContent);
    }
View Full Code Here

TOP

Related Classes of gov.nist.javax.sip.header.ContentType

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.