The RestFilter class holds pre-filter and post-filter delegates for the REST request.
Properties
Property | Property value | Description |
---|---|---|
RestFilter.Operation | RestHandlerOpCode | The Operation property contains unique ID of the REST resource or operation. |
RestFilter.PreFilter | RESTPreFilterHandler | The PreFilter delegate must be called before calling intercepted HandleRESTRequest. |
RestFilter.PostFilter | RESTPostFilterHandler | The PostFilter delegate must be called after calling intercepted HandleRESTRequest. |
RestFilter.Operation Property
The Operation property contains unique ID of the REST resource or operation.
RestFilter.PreFilter Property
The PreFilter delegate must be called before calling intercepted HandleRESTRequest. It modifies REST request input.
Usage: This example shows simple pre-filter method.
private static RestRequestParameters PreFilterExport ( RestRequestParameters restInput )
{
JavaScriptSerializer sr = new JavaScriptSerializer { MaxJsonLength = int.MaxValue };
var operationInputJson = sr.DeserializeObject(restInput.OperationInput) as IDictionary<string, object>;
operationInputJson["layers"] = "show:" + String.Join(",", _authorizedLayerSet);
restInput.OperationInput = sr.Serialize(operationInputJson);
return restInput;
}
RestFilter.PostFilter Property
The PostFilter delegate must be called after calling intercepted HandleRESTRequest. It modifies REST handler response.
Usage: This example shows simple post-filter method.
private byte[] PostFilterRootLegend ( RestRequestParameters restInput, byte[] originalResponse )
{
if (null == _authorizedLayerSet)
return null;
return MyCustomLegend(restInput, originalResponse);
}