Examples Entries and URLs for Service Properties

These examples of service.properties entries and URLs illustrate service configurations that differ. The examples involve a dinner menu service (command name is dinnerMenu) for late-working employees.

Note:

In this section, the protocol://host:port portion of each example URL is omitted for readability and to emphasize the portion specific to extended services. In actual usage, the full URL is necessary to access the extended service.

Example 1

For a named resource where the dinnerMenu service is handled by a servlet known to the Web server as DinnerMenuServlet, and where no prefix is specified, the service.properties entries are as follows:

dinnerMenu.resource=DinnerMenuServlet
dinnerMenu.type=$NAMED$

The type is specified as $NAMED$ because this is a named resource rather than a file path. Because no URL prefix was specified, the default prefix is used. The URL to access this extended service is:

/workspace/servlet/ext/dinnerMenu

If the service takes query parameters at runtime, the parameters are specified at the end of the URL. Assuming that the dinnerMenu service takes two parameters, dayOfWeek and month, the URL is:

/workspace/servlet/ext/dinnerMenu?dayOfWeek=Tuesday&month=September 

Example 2

Same as Example 1, except that the URL prefix is specified as hyperion. The service.properties entries are:

hyperion.dinnerMenu.resource=DinnerMenuServlet
hyperion.dinnerMenu.type=$NAMED$ 

The URL to access this extended service is:

/workspace/servlet/hyperion/dinnerMenu

Example 3

For a resource expressed as a path, where the dinner menu service is handled by a servlet, the service.properties entries are:

dinnerMenu.resource=/servlet/DinnerMenuServlet dinnerMenu.type=$PATH$ 

Because no URL prefix was specified, the default prefix is used. The URL to access this extended service is:

/workspace/servlet/ext/dinnerMenu   

Example 4

Same as Example 3, but passing static query arguments using the resource entry. The query arguments are named startTime and location, with values 19:00 and CA, respectively. The service.properties entries are as follows. (Differences from Example 3 are in bold.)

dinnerMenu.resource=/servlet/DinnerMenuServlet?startTime= 19:00&location=CA
dinnerMenu.type=$PATH$ 

The URL to access this extended service is the same as that in Example 3:

/workspace/servlet/ext/dinnerMenu

Example 5

For a file resource, where requests for the dinnerMenu service are handled by a JSP with the path /scripts/dinnerMenu.jsp, the service.properties entries are:

dinnerMenu.resource=/scripts/dinnerMenu.jsp
dinnerMenu.type=$PATH$ 

Because no URL prefix was specified, the default prefix is used. The URL to access this extended service is:

/workspace/servlet/ext/dinnerMenu  

Example 6

Same as Example 5, except that requests for the dinnerMenu service are handled by an HTML file, whose path is /wsmedia/docs/dinnerMenu.html. The service.properties entries are:

dinnerMenu.resource=/wsmedia/docs/dinnerMenu.html dinnerMenu.type=$PATH$