The Web Graph Database


Viewlet Framework: Multiple Output Formats, MIME Types and Internationalization

The InfoGrid ViewletFramework has built-in support for:

  • emitting the same information in multiple output formats, such as different MIME types
  • emitting the same information in multiple languages.

The ObjectSetViewlet (part of MeshWorld) can serve as an example.

Multiple output formats

If MIME type text/html is requested, JSP file /v/org/infogrid/jee/viewlet/objectset/ObjectViewlet.jsp is run. This is the default.

If a different MIME type is requested, and an appropriate JSP file can be found, that JSP file is run instead. For example:

Requested MIME type JSP executed (if exists)
text/json /v/org/infogrid/jee/viewlet/objectset/ObjectSetViewlet/text/json/ObjectSetViewlet.jsp
application/atom+xml /v/org/infogrid/jee/viewlet/objectset/ObjectSetViewlet/application/atom+xml/ObjectSetViewlet.jsp

A different MIME type is requested by either:

  • specifying the requested content type in the HTTP header of the request
  • by appending the parameter lid-format=mime:MIME to the URL, such as lid-format=mime:text/json.


When the ViewletFramework looks for a JSP file, it attempts to take the locale into account. The default algorithm is defined in InfoGridWebApp.findLocalizedRequestDispatcher but it can be overridden by the application developer. By default, if the name of the JSP file is Test.jsp, and the current locale is en-US, the following files will be considered:

  • Test_en_US.jsp
  • Test_en.jsp
  • Test.jsp.

See also:

Last modified 9 years ago Last modified on 01/19/10 06:26:54