XPages webmail – Using Mime Inspector to debug Mime

In a previous post in this series I did a bit of an overview on how MIME works. We also did a little bit about how MIME works in XPages + Domino land. With this knowledge in hand we can now start to analyse the different ways a ‘Pretty words, pictures and attachments’ can be stored in the document.

During development of the ‘XPages Webmail’ interface, I encountered many problems which could only be solved by investigating the MIME content in detail.

To help me do this, I developed a simple control (Mime Inspector) that I could use during debugging, which allowed me to see details of Mime Entities and the relation between them.

Overview

To use the MIME Inspector, I just bind it to a “rich text/Mime” field, and then view the output in the XPage. There are 2 control properties that can be control the level of detail

  • showHeaders – will output the MimeHeader entries of each MimeEntity
  • showContent – will output the actual content of each MimeEntity

The output starts with a summary of the status of the DominoRichTextItem (which is a wrapper for the RichTextItem. This is less useful but can still be helpful to know in some situations.

  • Are there Embedded Images that have not been saved yet
  • are there attachments that are not saved yet
  • is the wrapped field a MIME field (or otherwise still rich text)
  • Is the backend item discarded

Then the control will output the visual representation of the Mime Structure.

It does this in a ‘Nested List’ of MIMEEntities so that you can see sibling / parent / child relationship (which is very important when debugging MIME problems)

Each Mime Entity will output:

  • content type e.g. text/html
  • encoding details
  • mime headers (if set to do so with showHeaders)
  • content (if set to do so with showContent)

Demonstration Video

Here is as short demonstration video of the control in action

Installation / usage

You can either install the GregorbyteXspLibrary and use from that, or you can rip out the necessary files and use within an NSF

To do it via installing the library:

  • Download the GregorbyteXspLibrary from the project’s github releases page
  • Install the library to your Domino Designer (same method as IBM ExtLib)
  • Install the library to your Domino Server (same method as IBM ExtLib)
  • Enable the library in your NSF (Xsp Properties page, ‘Page Generation’ section choose ‘com.gregorbyte.xsp.library’
  • Drag the ‘Mime Inspector’ onto your page

To do it the ‘non-library’ way:

  • Copy the MimeUtil class and paste it in your java elements section (you will need to removeh/comment out all statements referencing the GregorbyteLogger
  • Copy the UIMimeInspector class and paste it in your java elements section
  • Copy the gregorbyte-mimeinspector.xsp-config file and put it in your WebContent\WEB-INF directory in your NSF
  • There is no renderer because the control renders itself, so no need for renderer or faces-conig.xml entries

Here is an example of the code in the XPages Markup:

Here is an example of some output with ‘showHeaders’ and ‘showContent’. In this example the mime being looked at is just a single text/html MimeEntity.

Let me know if you have any trouble, I hope this helps somebody!

You may also like...

3 Responses

  1. Howard Greenberg says:

    Cool, why not put it on OpenNTF!

    • camerongregor says:

      Thanks Howard It’s a good point. My intention is to post my ‘GregorbyteXspLibrary’ project on OpenNTF. It really is just a matter of me making it a priority.
      Although it not complicated, performing the necessary steps to make sure it is compatible with OpenNTF submission guidelines does take time. I was going to add a few more controls before going through that. I suppose I thought at least by posting it on github it is available.
      I also need to look to make sure the contents are compatible with the licenses that must be used on OpenNTF. I just realised I currently haven’t specified a licence yet! that is my next task…

  1. February 14, 2017

    […] Debugging mime using the MimeInspector (patent pending) […]

Leave a Reply

Your email address will not be published. Required fields are marked *