当前位置: 首页>>代码示例>>Java>>正文


Java Response.setDisplayUrl方法代码示例

本文整理汇总了Java中com.google.enterprise.adaptor.Response.setDisplayUrl方法的典型用法代码示例。如果您正苦于以下问题:Java Response.setDisplayUrl方法的具体用法?Java Response.setDisplayUrl怎么用?Java Response.setDisplayUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.enterprise.adaptor.Response的用法示例。


在下文中一共展示了Response.setDisplayUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDocumentContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
/** Copies the Documentum document content into the response.
 * @throws URISyntaxException */
private void getDocumentContent(Response resp, IDfSysObject sysObject,
    DocId id, boolean returnContent)
    throws DfException, IOException, URISyntaxException {
  if (!markAllDocsAsPublic) {
    getACL(resp, sysObject, id);
  }
  // Include document attributes as metadata.
  getMetadata(resp, sysObject, id);

  // If it is a virtual document, include links to the child documents.
  if (sysObject.isVirtualDocument()) {
    getVdocChildLinks(resp, sysObject, id);
  }

  // Return the content.
  resp.setDisplayUrl(new URI(MessageFormat.format(displayUrl,
      sysObject.getObjectId(), docIdToPath(id))));

  if (returnContent) {
    // getContent throws an exception when r_page_cnt is zero.
    // The GSA does not support files larger than 2 GB.
    // The GSA will not index empty documents with binary content types,
    // so include the content type only when supplying content.
    if (sysObject.getPageCount() > 0 && sysObject.getContentSize() > 0
        && sysObject.getContentSize() <= (2L << 30)) {
      String contentType = sysObject.getFormat().getMIMEType();
      logger.log(Level.FINER, "Content Type: {0}", contentType);
      resp.setContentType(contentType);

      try (InputStream inStream = sysObject.getContent()) {
        IOHelper.copyStream(inStream, resp.getOutputStream());
      }
    } else {
      // We must call getOutputStream to avoid a library error.
      // TODO(jlacey): This document will not be indexed.
      resp.getOutputStream();
    }
  }
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:42,代码来源:DocumentumAdaptor.java

示例2: getFolderContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
/** Returns the Folder's contents as links in a generated HTML document.
 * @throws URISyntaxException */
private void getFolderContent(Response resp, IDfFolder dmFolder, DocId id)
    throws DfException, IOException, URISyntaxException {
  resp.setNoIndex(!indexFolders);

  if (!markAllDocsAsPublic) {
    getACL(resp, dmFolder, id);
  }
  // Include folder attributes as metadata.
  getMetadata(resp, dmFolder, id);
  resp.setDisplayUrl(new URI(MessageFormat.format(displayUrl,
      dmFolder.getObjectId(), docIdToPath(id))));

  logger.log(Level.FINER, "Listing contents of folder: {0} ",
      dmFolder.getObjectName());
  IDfCollection dmCollection =
      dmFolder.getContents("i_chronicle_id, object_name");

  // TODO(bmj): Use maxHtmlSize in getFolderContent.
  try (HtmlResponseWriter htmlWriter = createHtmlResponseWriter(resp)) {
    htmlWriter.start(id, dmFolder.getObjectName());
    while (dmCollection.next()) {
      String chronicleId = dmCollection.getString("i_chronicle_id");
      String objName = dmCollection.getString("object_name");
      logger.log(Level.FINER, "Chronicle ID: {0}; Name: {1}",
          new Object[] {chronicleId, objName});
      DocId childDocId = docIdFromPath(docIdToPath(id), objName, chronicleId);
      htmlWriter.addLink(childDocId, objName);
    }
    htmlWriter.finish();
  } finally {
    try {
      dmCollection.close();
    } catch (DfException e) {
      logger.log(Level.WARNING, "Error closing collection", e);
    }
  }
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:40,代码来源:DocumentumAdaptor.java

示例3: getListDocContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
private void getListDocContent(Request request, Response response,
    String id) throws IOException {
  log.entering("SiteAdaptor", "getListDocContent",
      new Object[] {request, response, id});
  com.microsoft.schemas.sharepoint.soap.List l
      = siteDataClient.getContentList(id);
  Web w = siteDataClient.getContentWeb();

  if (TrueFalseType.TRUE.equals(l.getMetadata().getNoIndex())
      || isWebNoIndex(new CachedWeb(w))) {
    log.fine("Document marked for NoIndex");
    response.respondNotFound();
    log.exiting("SiteAdaptor", "getListDocContent");
    return;
  }

  boolean allowAnonymousAccess
      = isAllowAnonymousReadForList(new CachedList(l))
      && isAllowAnonymousPeekForWeb(new CachedWeb(w))
      && (!isDenyAnonymousAccessOnVirtualServer());

  if (!allowAnonymousAccess) {
    String scopeId
        = l.getMetadata().getScopeID().toLowerCase(Locale.ENGLISH);
    String webScopeId
        = w.getMetadata().getScopeID().toLowerCase(Locale.ENGLISH);

    DocId rootFolderDocId
        = encodeDocId(l.getMetadata().getRootFolder());

    Acl.Builder acl;
    if (scopeId.equals(webScopeId)) {
      acl = new Acl.Builder().setInheritFrom(new DocId(webUrl));
    } else {
      List<Permission> permissions
          = l.getACL().getPermissions().getPermission();
      acl = generateAcl(permissions, LIST_ITEM_MASK)
          .setInheritFrom(siteDocId, SITE_COLLECTION_ADMIN_FRAGMENT);
    }
    response.setAcl(new Acl.Builder().setInheritFrom(rootFolderDocId)
        .setInheritanceType(Acl.InheritanceType.PARENT_OVERRIDES)
        .build());
    context.getAsyncDocIdPusher().pushNamedResource(rootFolderDocId,
            acl.setInheritanceType(Acl.InheritanceType.PARENT_OVERRIDES)
                .build());
  }

  response.addMetadata(METADATA_OBJECT_TYPE,
      ObjectType.LIST.value());
  response.addMetadata(METADATA_PARENT_WEB_TITLE,
      w.getMetadata().getTitle());
  response.addMetadata(METADATA_LIST_GUID, l.getMetadata().getID());

  response.setDisplayUrl(sharePointUrlToUri(
        "/".equals(l.getMetadata().getDefaultViewUrl()) 
        ? l.getMetadata().getRootFolder() 
        : l.getMetadata().getDefaultViewUrl()));
  String lastModified = l.getMetadata().getLastModified();
  try {
    response.setLastModified(
        listLastModifiedDateFormat.get().parse(lastModified));
  } catch (ParseException ex) {
    log.log(Level.INFO, "Could not parse LastModified: {0}", lastModified);
  }
  HtmlResponseWriter writer = createHtmlResponseWriter(response);
  writer.start(request.getDocId(), ObjectType.LIST,
      l.getMetadata().getTitle());
  processFolder(id, "", writer);
  writer.finish();
  log.exiting("SiteAdaptor", "getListDocContent");
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:72,代码来源:SharePointAdaptor.java


注:本文中的com.google.enterprise.adaptor.Response.setDisplayUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。