Package org.eclipse.wst.wsi.internal.core.log

Examples of org.eclipse.wst.wsi.internal.core.log.MimePart


      result = AssertionResult.RESULT_NOT_APPLICABLE;
    }
    else
    {
      MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();     
      MimePart part = mimeParts.getRootPart();
      if (part == null)
      {
        result = AssertionResult.RESULT_NOT_APPLICABLE;
      }
      else
      {
        String xmlEncoding = null;
        String charset = MIMEUtils.getMimeHeaderSubAttribute(
          part.getHeaders(),
          MIMEConstants.HEADER_CONTENT_TYPE,
          "charset");
        try
        {
          // The HTTP Content-Type header's charset value is either UTF-8 or UTF-16.
          if((charset != null) && (charset.equalsIgnoreCase("utf-8") ||
              charset.equalsIgnoreCase("utf-16")))
          {
            // Looking at the messageContent element of the logged message, either
            // (1) it has a BOM attribute which maps the charset value in the Content-Type header, or
            int bom = 0;
            if ((bom = entryContext.getMessageEntry().getBOM()) != 0)
            {
              if ((bom == WSIConstants.BOM_UTF8
                && !charset.equalsIgnoreCase("utf-8"))
                || ((bom == WSIConstants.BOM_UTF16
                  && !charset.equalsIgnoreCase("utf-16")))
                || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN
                  && !charset.equalsIgnoreCase("utf-16"))))
              {
                throw new AssertionFailException("The BOM (" + bom +
                    ") and charset value (" + charset + ")do not match.");
              }
            }
            // (2) it has an XML declaration which matches the charset value in the Content-Type header, or
            else if (((xmlEncoding =
              Utils.getXMLEncoding(part.getContent())) != null) &&
              !xmlEncoding.equals("")) 
            {
              if(!xmlEncoding.equalsIgnoreCase(charset))
              {
                throw new AssertionFailException("The XML declaration encoding (" +
View Full Code Here


    Iterator iparts = parts.iterator();
    int i = 0;
    while (iparts.hasNext())
    {
      i = i + 1;
      MimePart part = (MimePart)iparts.next();
      String m_partName = MIMEUtils.getMimeHeaderAttribute(
          part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);

      // check value format <partname=UID@hostname>
      if ((m_partName != null) && m_partName.startsWith("<") && m_partName.endsWith(">"))
      {
        int idx, atIdx;
View Full Code Here

      else
      {
        // check each part for the encoding match
        Iterator iparts = parts.getParts().iterator();
        int i = 0;
        MimePart root = parts.getRootPart();
        while (iparts.hasNext())
        {
          i = 1;
          try
          {
          MimePart part = (MimePart)iparts.next();
         
            // get encoding from header
            String encoding =  HTTPUtils.getHttpHeaderAttribute(part.getHeaders(),
              HTTPConstants.HEADER_CONTENT_TRANSFER_ENCODING);
         
             if ((part == root) ||
               ((encoding != null) && encoding.equalsIgnoreCase("base64")))
              checkPart(part, encoding, false);
View Full Code Here

    if(partName == null)
       return null;
    Iterator iparts = parts.iterator();
    while (iparts.hasNext())
    {
      MimePart part = (MimePart)iparts.next();
      String m_partName = MIMEUtils.getMimeHeaderAttribute(
          part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);

      // check value format <partname=UID@host>
      if ((m_partName != null) && (m_partName.startsWith("<")) &&
          (m_partName.indexOf("=") != -1) &&
          (encodePartName(m_partName.substring(1, m_partName.indexOf("="))).equals(partName)))
View Full Code Here

TOP

Related Classes of org.eclipse.wst.wsi.internal.core.log.MimePart

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.