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


Java Response类代码示例

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


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

示例1: doCollection

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doCollection(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node, Response response)
    throws IOException {
  List<Node> collectionContents;
  try {
    collectionContents = documentManagement.listNodes(node.getID(), true);
  } catch (SOAPFaultException soapFaultException) {
    log.log(Level.WARNING,
        "Error retrieving collection contents: " + opentextDocId,
        soapFaultException);
    // If we can't fetch the collection contents, at least send
    // the collection node itself.
    doNode(documentManagement, opentextDocId, node, response);
    return;
  }
  String[] bodyText = new String[collectionContents.size()];
  for (int i = 0; i < collectionContents.size(); i++) {
    bodyText[i] = collectionContents.get(i).getName();
  }
  writeHtmlResponse(response, node, node.getName(), bodyText);
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:23,代码来源:OpentextAdaptor.java

示例2: doEmail

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doEmail(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node,
    Request request, Response response) throws IOException {
  Metadata metadata = node.getMetadata();
  if (metadata != null) {
    List<AttributeGroup> attributeGroups = metadata.getAttributeGroups();
    if (attributeGroups != null) {
      for (AttributeGroup attributeGroup : attributeGroups) {
        if (!"OTEmailProperties".equals(attributeGroup.getType())) {
          continue;
        }
        cacheEmailMetadataDefinition(documentManagement, attributeGroup);
        doAttributeGroup(
            response, null, attributeGroup, this.emailAttributeDefinitions);
      }
    }
  }
  doDocument(documentManagement, opentextDocId, node, request, response);
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:21,代码来源:OpentextAdaptor.java

示例3: addChildAnchors

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
private void addChildAnchors(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Response response) {
  try {
    List<Node> children =
        documentManagement.listNodes(opentextDocId.getNodeId(), true);
    for (Node child : children) {
      DocId docId =
          getChildDocId(opentextDocId, child.getName(), child.getID());
      response.addAnchor(this.context.getDocIdEncoder().encodeDocId(docId),
          child.getName());
    }
  } catch (SOAPFaultException soapFaultException) {
    log.log(Level.WARNING,
        "Error retrieving children of node: " + opentextDocId,
        soapFaultException);
  }
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:18,代码来源:OpentextAdaptor.java

示例4: writeHtmlResponse

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
private void writeHtmlResponse(Response response, Node node,
    String header, String... body) throws IOException {
  response.setContentType("text/html; charset=" + CHARSET.name());
  Writer writer = new OutputStreamWriter(response.getOutputStream(),
      CHARSET);
  writer.write("<!DOCTYPE html>\n<html><head><title>");
  writer.write(escapeContent(node.getName()));
  writer.write("</title></head><body><h1>");
  if (header != null) {
    writer.write(escapeContent(header));
  } else {
    writer.write(escapeContent(node.getName()));
  }
  writer.write("</h1>");
  for (String contentString : body) {
    writer.write("<p>");
    writer.write(escapeContent(contentString));
    writer.write("</p>");
  }
  writer.write("</body></html>");
  writer.flush();
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:23,代码来源:OpentextAdaptor.java

示例5: doAttributeGroup

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
private void doAttributeGroup(Response response, MemberService memberService,
    AttributeGroup attributeGroup,
    Map<String, Attribute> attributeDefinitions) {
  List<DataValue> dataValues = attributeGroup.getValues();

  for (DataValue dataValue : dataValues) {
    if (dataValue instanceof PrimitiveValue) {
      doPrimitiveValue(
          (PrimitiveValue) dataValue, response,
              attributeDefinitions, memberService);
    } else if (dataValue instanceof RowValue) {
      doRowValue((RowValue) dataValue, response,
          attributeDefinitions, memberService);
    } else if (dataValue instanceof TableValue) {
      doTableValue((TableValue) dataValue, response,
          attributeDefinitions, memberService);
    }
  }
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:20,代码来源:OpentextAdaptor.java

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

示例7: getVdocChildLinks

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
/** Supplies VDoc children as external link metadata in the response. */
private void getVdocChildLinks(Response resp, IDfSysObject sysObject,
    DocId id) throws DfException, IOException {
  IDfVirtualDocument vDoc = sysObject.asVirtualDocument("CURRENT", false);
  IDfVirtualDocumentNode root = vDoc.getRootNode();
  int count = root.getChildCount();
  for (int i = 0; i < count; i++) {
    IDfSysObject child = root.getChild(i).getSelectedObject();
    String chronicleId = child.getString("i_chronicle_id");
    String objName = child.getString("object_name");
    logger.log(Level.FINER, "VDoc Child chronicle ID: {0}; Name: {1}",
        new Object[] {chronicleId, objName});
    DocId childDocId = docIdFromPath(docIdToPath(id), objName, chronicleId);
    logger.log(Level.FINER, "VDoc Child Object DocId: {0}",
        childDocId.toString());
    resp.addAnchor(docIdEncoder.encodeDocId(childDocId), objName);
  }
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:19,代码来源:DocumentumAdaptor.java

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

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

示例10: sendUrlResponse

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
private void sendUrlResponse(Response response,
    String urlString, String llCookie) throws IOException {
  URLConnection conn = new URL(urlString).openConnection();
  if (llCookie != null) {
    conn.addRequestProperty(COOKIE, "LLCookie=" + llCookie);
  }
  conn.setConnectTimeout(this.connectTimeout);
  conn.setReadTimeout(this.readTimeout);
  try (InputStream in = conn.getInputStream()) {
    IOHelper.copyStream(in, response.getOutputStream());
  }
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:13,代码来源:OpentextAdaptor.java

示例11: doNode

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doNode(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node, Response response)
    throws IOException {
  response.setContentType("text/html; charset=" + CHARSET.name());
  Writer writer = new OutputStreamWriter(response.getOutputStream(),
      CHARSET);
  writer.write("<!DOCTYPE html>\n<html><head><title>");
  writer.write(escapeContent(node.getName()));
  writer.write("</title></head><body><h1>");
  writer.write(escapeContent(node.getName()));
  writer.write("</h1>");
  writer.write("</body></html>");
  writer.flush();
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:16,代码来源:OpentextAdaptor.java

示例12: doNews

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doNews(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node, Response response)
    throws IOException {
  Collaboration collaboration =
      this.soapFactory.newCollaboration(documentManagement);
  NewsInfo newsInfo = null;
  try {
    newsInfo = collaboration.getNews(node.getID());
  } catch (SOAPFaultException soapFaultException) {
    log.log(Level.WARNING, "Error retrieving news item: " + opentextDocId,
        soapFaultException);

    // Some types of children that can be added using the UI
    // seem to cause an error in getNews when loading the
    // attachments. If that happens, we can't get the
    // News-specific data like Headline and Story, but we can
    // still treat the node as a generic container.
    doContainer(documentManagement, opentextDocId, node, response);
    return;
  }
  addChildAnchors(documentManagement, opentextDocId, response);
  addDateMetadata("EffectiveDate", newsInfo.getEffectiveDate(), response);
  addDateMetadata("ExpirationDate", newsInfo.getExpirationDate(), response);
  writeHtmlResponse(response, node,
      newsInfo.getHeadline(), newsInfo.getStory());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:28,代码来源:OpentextAdaptor.java

示例13: doTopicReply

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doTopicReply(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node, Response response)
    throws IOException {
  Collaboration collaboration =
      this.soapFactory.newCollaboration(documentManagement);
  DiscussionItem discussionItem = null;
  try {
    discussionItem = collaboration.getTopicReply(node.getID());
  } catch (SOAPFaultException soapFaultException) {
    log.log(Level.WARNING,
        "Error retrieving discussion item: " + opentextDocId,
        soapFaultException);

    // Some types of children that can be added using the UI
    // seem to cause an error in getTopicReply when loading the
    // attachments. If that happens, we can't get the
    // DiscussionItem-specific data like Subject and Content,
    // but we can still treat the node as a generic container.
    doContainer(documentManagement, opentextDocId, node, response);
    return;
  }
  addChildAnchors(documentManagement, opentextDocId, response);
  addDateMetadata("PostedDate", discussionItem.getPostedDate(), response);
  addMemberMetadata("PostedBy", discussionItem.getPostedBy(),
      response, this.soapFactory.newMemberService(documentManagement));
  writeHtmlResponse(response, node,
      discussionItem.getSubject(), discussionItem.getContent());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:30,代码来源:OpentextAdaptor.java

示例14: doTask

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doTask(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node, Response response)
    throws IOException {
  Collaboration collaboration =
      this.soapFactory.newCollaboration(documentManagement);
  TaskInfo taskInfo = null;
  try {
    taskInfo = collaboration.getTask(node.getID());
  } catch (SOAPFaultException soapFaultException) {
    log.log(Level.WARNING,
        "Error retrieving task: " + opentextDocId, soapFaultException);
    // If we can't fetch the TaskInfo, at least treat the node
    // as a generic container.
    doContainer(documentManagement, opentextDocId, node, response);
    return;
  }
  addChildAnchors(documentManagement, opentextDocId, response);
  addMemberMetadata("AssignedTo", taskInfo.getAssignedTo(),
      response, this.soapFactory.newMemberService(documentManagement));
  addDateMetadata("CompletionDate", taskInfo.getCompletionDate(), response);
  addDateMetadata("DateAssigned", taskInfo.getDateAssigned(), response);
  addDateMetadata("DueDate", taskInfo.getDueDate(), response);
  addDateMetadata("StartDate", taskInfo.getStartDate(), response);
  addStringMetadata("Priority", taskInfo.getPriority().value(), response);
  addStringMetadata("Status", taskInfo.getStatus().value(), response);
  writeHtmlResponse(response, node,
      node.getName(), taskInfo.getComments(), taskInfo.getInstructions());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:30,代码来源:OpentextAdaptor.java

示例15: doProject

import com.google.enterprise.adaptor.Response; //导入依赖的package包/类
@VisibleForTesting
void doProject(DocumentManagement documentManagement,
    OpentextDocId opentextDocId, Node node, Response response)
    throws IOException {
  Collaboration collaboration =
      this.soapFactory.newCollaboration(documentManagement);
  ProjectInfo projectInfo = null;
  try {
    projectInfo = collaboration.getProject(node.getID());
  } catch (SOAPFaultException soapFaultException) {
    log.log(Level.WARNING,
        "Error retrieving project: " + opentextDocId, soapFaultException);
    // If we can't fetch the ProjectInfo, at least treat the node
    // as a generic container.
    doContainer(documentManagement, opentextDocId, node, response);
    return;
  }
  addChildAnchors(documentManagement, opentextDocId, response);
  addDateMetadata("StartDate", projectInfo.getStartDate(), response);
  addDateMetadata("TargetDate", projectInfo.getTargetDate(), response);
  addStringMetadata("Goals", projectInfo.getGoals(), response);
  addStringMetadata("Initiatives", projectInfo.getInitiatives(), response);
  addStringMetadata("Mission", projectInfo.getMission(), response);
  addStringMetadata("Objectives", projectInfo.getObjectives(), response);
  addStringMetadata("Status", projectInfo.getStatus().value(), response);
  writeHtmlResponse(response, node, node.getName());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:28,代码来源:OpentextAdaptor.java


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