例: getParamVal method

次のエージェントは、Content-Type ヘッダーの値とその「boundary」パラメータを取得します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here)
      // Do not convert MIME to rich text
      session.setConvertMIME(false);
      DocumentCollection dc = agentContext.getUnprocessedDocuments();
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        MIMEEntity mime = doc.getMIMEEntity();
        if (mime != null) {
          MIMEHeader header = mime.getNthHeader("Content-Type");
          if (header != null) {
            String boundary= header.getParamVal("boundary");
            if (boundary.equals("")) boundary = "No boundary";
            System.out.println("boundary= " + boundary);
          }
          else
            System.out.println("No Content-Type header!");
        }
        else
        {
          System.out.println
            ("Not MIME - " + doc.getItemValueString("Subject"));
        }
        doc = dc.getNextDocument(doc);
      }
      // Restore conversion
      session.setConvertMIME(true);
     
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}