Package com.google.enterprise.connector.spi.SpiConstants

Examples of com.google.enterprise.connector.spi.SpiConstants.ContentEncoding


    if (metadataAllowed) {
      xmlWrapMetadata(prefix, document);
    }

    StringBuilder suffix = new StringBuilder();
    ContentEncoding documentContentEncoding = null;
    ContentEncoding alternateEncoding = null;
    if (contentAllowed) {
      // Determine the content encoding to specify.
      String documentContentEncodingStr = DocUtils.getOptionalString(
          document, SpiConstants.PROPNAME_CONTENT_ENCODING);

      if (!Strings.isNullOrEmpty(documentContentEncodingStr)) {
        documentContentEncoding =
            ContentEncoding.findContentEncoding(documentContentEncodingStr);
        if (documentContentEncoding == ContentEncoding.ERROR
            || supportedEncodings.indexOf(documentContentEncodingStr) < 0) {
          String message =
              "Unsupported content encoding: " + documentContentEncodingStr;
          LOGGER.log(Level.WARNING, message);
          throw new RepositoryDocumentException(message);
        }
      }
      alternateEncoding = (documentContentEncoding == null)
          ? contentEncoding : documentContentEncoding;
 
      // If including document content, wrap it with <content> tags.
      prefix.append("<");
      prefix.append(XML_CONTENT);
      XmlUtils.xmlAppendAttr(XML_ENCODING,
          alternateEncoding.toString(), prefix);
      prefix.append(">\n");

      suffix.append('\n');
      XmlUtils.xmlAppendEndTag(XML_CONTENT, suffix);
    }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.SpiConstants.ContentEncoding

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.