Translate by MIME Type

These are the basic steps to prepare for MIME-based filtering:

Steps 1 through 3: Prepare the MTFilter servlet for use. These are the same as Steps 1 through 3 in Translate Using Servlet List Filtering.

Step 4: Set up the Web Application to do MIME-based filtering.

Step 5: Run the sample to demonstrate automatic translation.

The instructions assume that you did a custom install, creating the Application Server named "Default Server," as described in Translate Using Servlet List Filtering.

 

Steps 1 through 3: Prepare the MTFilter servlet for use

Make sure you have completed Steps 1 through 3 in Translate Using Servlet List Filtering. This sets up the MTFilter servlet, which can then be used for MIME-based filtering.


Step 4: Set up the Web Application to do MIME-based filtering

In this step, you will specify that all responses of MIME-type text/html from the examples Web Application be processed through MTFilter servlet.

  1. Start the Console GUI:
    • On the Topology tab, expand the tree, then select and expand the Default Server tree.
    • Expand the servletEngine tree.
    • Select the examples Web Application.

  2. On the Advanced tab:
    • Enter the following values for filters:
      Mime Type: text/html
      Servlet URI: MTFilter
    • Click Apply.

Step 5: Run the sample

Use your browser (the one that you set to German) to request the index.html file from the examples Web Application:

  • Start the Default Server.
  • Enter: http://yourserver/webapp/examples/index.html in the browser's URL field.

    When you press Enter, the html file is translated from English and returned to you in German.

You can also test the servlets within the examples Web Application that are designed to produce client responses, such as simpleJSP, SourceCodeViewer, and showCfg. The responses will be in German.

  • Note in particular that without MIME-based filtering in effect, simpleJSP returns English.
  • With MIME-based filtering in effect, all responses within the scope of the filtering are translated. This is in contrast to translating by servlet list filtering, where a specific servlet is linked explicitly to the MTFilter.