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


Java Response.respondNotFound方法代码示例

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


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

示例1: getDocContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
@Override
public void getDocContent(Request request, Response response)
    throws IOException {
  long startMillis = System.currentTimeMillis();
  log.entering("SharePointAdaptor", "getDocContent",
      new Object[] {request, response});
  DocId id = request.getDocId();    
  SiteAdaptor adptorForDocId = getAdaptorForDocId(id);
  if (adptorForDocId == null) {
    log.log(Level.FINE,
        "responding not found as site adptor for {0} is null", id);
    response.respondNotFound();
    log.exiting("SharePointAdaptor", "getDocContent");
    return;
  }
  
  if (id.equals(virtualServerDocId)) {
    adptorForDocId.getVirtualServerDocContent(request, response);
  } else {
    adptorForDocId.getDocContent(request, response); 
  }   
  log.log(Level.FINE, "Duration: getDocContent {0} : {1,number,#} ms",
      new Object[] {request.getDocId(),
      System.currentTimeMillis() - startMillis});
  log.exiting("SharePointAdaptor", "getDocContent");
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:27,代码来源:SharePointAdaptor.java

示例2: getDocContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
@Override
public void getDocContent(Request req, Response resp) throws IOException {
  log.entering("LdapAdaptor", "getDocContent", new Object[] {req, resp});
  DocId id = req.getDocId();
  ParsedDocId parsed = parseDocId(id);

  if (parsed == null
      || !id.equals(makeDocId(parsed.serverNumber, parsed.dn))) {
    log.warning(id + " is not a valid id generated by this adaptor.");
    resp.respondNotFound();
    return;
  }

  LdapPerson fetched;
  try {
    LdapServer server = servers.get(parsed.serverNumber);
    fetched = server.fetchOne(parsed.dn);
    if (null == fetched) {
      log.finer("No results found for DN " + parsed.dn + "");
      resp.respondNotFound();
      log.exiting("LdapAdaptor", "getDocContent", 0);
      return;
    }
    for (Entry<String, String> metadatum : fetched.asMetadata().entrySet()) {
      resp.addMetadata(metadatum.getKey(), metadatum.getValue());
    }
    InputStream input = new ByteArrayInputStream(fetched.asDoc(
        server.getDisplayTemplate()).getBytes(CHARSET));
    resp.setContentType("text/html; charset=" + CHARSET.name() + "");
    IOHelper.copyStream(input, resp.getOutputStream());
    log.exiting("LdapAdaptor", "getDocContent", 1);
  } catch (InterruptedNamingException e) {
    log.exiting("LdapAdaptor", "getDocContent", 2);
    throw new IOException(e);
  }
}
 
开发者ID:googlegsa,项目名称:ldap,代码行数:37,代码来源:LdapAdaptor.java

示例3: doContainer

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
@VisibleForTesting
void doContainer(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node containerNode, Response response)
    throws IOException {

  List<Node> containerContents;
  try {
    // The second argument causes listNodes to return partial
    // content, but that content includes the name.
    containerContents = documentManagement.listNodes(containerNode.getID(),
        true);
  } catch (SOAPFaultException soapFaultException) {
    if (isPermissionsFailure(soapFaultException)) {
      log.log(Level.FINE, "{0}: {1}",
          new Object[] {
            soapFaultException.getFault().getFaultString(), opentextDocId });
      response.respondNotFound();
    } else {
      log.log(Level.WARNING,
          "Error retrieving container contents: " + opentextDocId,
          soapFaultException);
    }
    return;
  }

  response.setContentType("text/html; charset=" + CHARSET.name());
  Writer writer = new OutputStreamWriter(response.getOutputStream(),
      CHARSET);
  HtmlResponseWriter responseWriter = new HtmlResponseWriter(
      writer, this.context.getDocIdEncoder(), ENGLISH);
  responseWriter.start(opentextDocId.getDocId(),
      opentextDocId.getDocId().getUniqueId());
  for (Node node : containerContents) {
    responseWriter.addLink(
        getChildDocId(opentextDocId, node.getName(), node.getID()),
        node.getName());
  }
  responseWriter.finish();
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:40,代码来源:OpentextAdaptor.java

示例4: getDocContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
/** This adaptor does not serve documents. */
@Override
public void getDocContent(Request req, Response resp) throws IOException {
  resp.respondNotFound();
}
 
开发者ID:googlegsa,项目名称:activedirectory,代码行数:6,代码来源:AdAdaptor.java

示例5: 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

示例6: getAspxDocContent

import com.google.enterprise.adaptor.Response; //导入方法依赖的package包/类
private void getAspxDocContent(Request request, Response response)
    throws IOException {
  log.entering("SiteAdaptor", "getAspxDocContent",
      new Object[] {request, response});

  CachedWeb w = rareModCache.getWeb(siteDataClient);
  if (isWebNoIndex(w)) {
    log.fine("Document marked for NoIndex");
    response.respondNotFound();
    log.exiting("SiteAdaptor", "getAspxDocContent");
    return;
  }

  String aspxId = request.getDocId().getUniqueId();
  String parentId = aspxId.substring(0, aspxId.lastIndexOf('/'));
  boolean isDirectChild = webUrl.equalsIgnoreCase(parentId);
  // Check for valid ASPX pages
  // Process only direct child for current web
  if (!isDirectChild) {
    // Alternative approach to this string comparison is to make a
    // additional web service call for SiteData.GetContentWeb and
    // check if ASPX page is available under Web.getFPFolder().getFiles()
    log.log(Level.FINE, "Document [{0}] is not a direct child of Web [{1}]",
        new Object[] {aspxId, webUrl});
    response.respondNotFound();
    log.exiting("SiteAdaptor", "getAspxDocContent");
    return;
  }

  boolean allowAnonymousAccess
      = isAllowAnonymousReadForWeb(w)
      // Check if anonymous access is denied by web application policy
      && (!isDenyAnonymousAccessOnVirtualServer());
  if (!allowAnonymousAccess) {
    response.setAcl(new Acl.Builder()
        .setInheritFrom(new DocId(parentId))
        .build());
  }
  response.addMetadata(METADATA_OBJECT_TYPE, "Aspx");      
  response.addMetadata(METADATA_PARENT_WEB_TITLE, w.webTitle);
  getFileDocContent(request, response, true);
  log.exiting("SiteAdaptor", "getAspxDocContent");
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:44,代码来源:SharePointAdaptor.java


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