The IRestDispatchPlugin plugin
The IRestDispatchPlugin plugin is an optional plugin interface that you
can implement to do the following:
- Preprocess incoming REST API requests
- Rewrite outgoing API responses
- Control how and what PolicyCenter logs for each API request
Default plugin implementation
If you do not implement your version of the
IRestDispatchPlugin plugin,
PolicyCenter uses the default
DefaultRestDispatchPlugin class instead. The default class does the
following:- Performs a minimal rewrite of 401 and 403 errors to remove details of authorization or authentication failure.
- Adds an intentional logging pattern (
PLLoggingMarker.REST_REQUEST) that provides detailed information about each API request suitable for feeding to a modern log system.
It is also possible to use the DefaultRestDispatchPlugin class as the superclass for your plugin implementation as this class implements the IRestDispatchPlugin interface.
Example of a log message for a successful request
The following server log message is an example of a successful REST API request.
aapplegate e1148f7b-a606-40f5-b43a-f86b3652279b 11:36:54,585 INFO
REST.Request <RestRequest> REST API Request {path="/activities/v1/activities",
query="includeTotal=true", pathTemplate="/activities/v1/activities",
apiFqn="gw.pc.activities.activities-10.0", method="GET", from="0:0:0:0:0:0:0:1",
user="aapplegate", status=200, error="", elapsedTimeMs=25}
Example of a log message for an unsuccessful request
The following server log message is an example of a REST API request that did not succeed.
aapplegate 7081b3c7-62ce-4897-9987-f7c7226af992 11:39:39,707 INFO
REST.Request <RestRequest> REST API Request
{path="/activities/v1/activities/pc:203/notes", query=null,
pathTemplate="/activities/v1/activities/{activityId}/notes",
apiFqn="gw.pc.activities.activities-10.0", method="POST", from="0:0:0:0:0:0:0:1",
user="aapplegate", status=400, error="gw.api.rest.exceptions.BadInputException",
elapsedTimeMs=2}
