Apache NetBeans
Apache NetBeans
Latest release

Apache NetBeans 23

Download

What is MimePath?

Basically, MimePath is an ordered list of mime types.

The reason why we have come up with the concept of MimePath is that we need to support embedded languages. In the simple world where code is written only in one language and stored in files dedicated for that language it is enough to know the mime type of a file in order to know its language and to load appropriate editor features. The world, however, is not simple anymore and the reality requires us to deal with situations when one file contains a mixture of several different languages. An example is a web applications development when people write JSP files that contain snippets of code in JSP, HTML, an expression language, Java, JavaScript and possibly some other languages. The whole JSP file can be broken up into sections containing code in different languages and user expects to get features like coloring and code completion that are appropriate for the mime type of each section. This is called language embedding.

In order to be able to describe the exact 'type' of each embedded block of text Netbeans use an ordered list of mime types that describe languages along the way from the top level language (i.e. the mime type of the file itself) to the embedded block. So, for example a java scriplet in a JSP file can be identified by the list of two mime types text/x-jsp, text/x-java. The list can be encoded in one String using the forward slash character as a separator and that’s what MimePath is. In our example the MimePath of java scriplet in a JSP file is text/x-jsp/text/x-java.

The embedding can go indefinitely deep and you can have MimePath like text/x-jsp/text/html/text/el for an expression language used in an HTML attribute inside a JSP file - <a href="${myLink}">…​</a>.

Since MimePath is required when you want MimeLookup and since MimeLookup is the way for pluging-in language specific editor features it is possible to provide features tailored specifically for any type of language embedding. If you want to know more about the contents of MimeLookup generally and for compound and embedded mime types, read more in How is MimeLookup composed?].


Applies to: NetBeans 5.x, 6.x

Platforms: All