Testing on a Web Preview Server

Use the Web Preview Server when you want to compile, test, and run resources quickly in an Ajax application. For example, you can test a Dojo-enabled web project on a Web Preview Server.

About this task

The Web Preview Server is a lightweight Liberty-based server ideally suited for developing and testing Ajax applications. It quickly performs module publishing and server restart. It supports basic web artifacts such as servlets, JSP files, HTML, XML, JavaScript CSS files, and JAX-RS. It contains a proxy module that can be used to create Ajax proxy requests. External project references can be used by modules during both the development and runtime stages on this server.

You can use the Web Preview Server as a convenient way to check for errors before you do a final test on an external application server. The server supports incremental publishing and hot deployment. You can change existing artifacts or add new artifacts to a running server without stopping and restarting the application server. If you change the Java™ source files in a referenced project, the server automatically restarts and loads the changes.

A Web Preview Server is automatically created for you when you open a new or existing workspace. If you want to create a Web Preview Server for previewing your resources in a web project, complete the following steps:

Procedure

  1. In the Servers view, right-click and select New > Server.
  2. Under the Select the server type list, expand the IBM folder and select Web Preview Server. Click Next.
  3. In the Add and Remove page, under the Available projects list, select the web project and click Add. Click Finish. The Web Preview Server is created in the Servers view.
  4. In the Project Explorer view, navigate to your web project and right-click your resource you want to test.
  5. Select Run As > Run on Server.
  6. In the Run on Server wizard, verify that Choose an existing server is selected.
  7. Under the Select the server that you want to use list, select the recently created Web Preview Server. Click Next.
  8. The Add and Remove page opens. Verify the web project that you are testing is listed under the Configured list. Click Finish.

Results

The internal web browser opens and shows the web content.
Attention: When using the internal browser to test your web application, cached results may be displayed, resulting in issues such as out-of-date results and incremental updates not displayed. To work around this problem, ensure the browser is not caching web pages. For example, in Microsoft Internet Explorer 8,
  1. Click Tools > Internet Options.
  2. In the Browser history section, click Settings.
  3. Under the option for Check for newer versions of stored pages, select the Every time I visit the webpage radio button instead of the default Automatically.
  4. Click OK twice to save your settings.
By default, the Web Preview Server uses port 8080. If that port is already in use, a new port is automatically assigned. If you create multiple instances of the Web Preview Server, each server instance has its own copy of the Ajax proxy and unique port settings.

The resources in the web project you are testing must be located under the directory that serves as the context root of the project.


Feedback