Servlets

A servlet is a small program that runs on a web server to process and answer client requests. You can define Gosu classes as simple web servlets inside your PolicyCenter application. By using a servlet, you can define HTTP entry points to custom code. Use this technique to define arbitrary Gosu code that a user or tool can call from a configurable URL.

You use the @Servlet annotation in your Gosu class to identify the class as a servlet. This annotation specifies the servlet query path in the URL that launches the servlet. To specify the query servlet path, you can use a static String value or a pattern described by a Gosu block. The URL for a servlet is the base URL for your PolicyCenter application, followed by /service, and finally the servlet query path. The following line shows this syntax:

http://serverName:8180/pc/service/servletQueryPath

You register your servlet with PolicyCenter by adding an entry in the file PolicyCenter/configuration/config/servlet/servlets.xml. PolicyCenter determines from the URL the servlet that owns the HTTP request.

Servlets are separate from web services that use the SOAP protocol. Servlets provide no built-in object serialization or deserialization, such as the SOAP protocol supports. Servlets are also separate from the Guidewire PCF entry points feature.

The PolicyCenter application provides an informational servlet that lists the available servlets. In the base configuration, this servlet is disabled if the PolicyCenter application is in production mode. Use the following URL to display the list:

http://serverName:8180/pc/service/info

Viewing servlet analysis information

Guidewire provides a means to view servlet activity in PolicyCenter Profiler. To view this information, navigate to the following location in PolicyCenter Server Tools:
  • Guidewire Profiler > Configuration

For information on how to use Guidewire Profiler, see The Guidewire Profiler screens.