RestFilter Class

The RestFilter class holds pre-filter and post-filter delegates for the REST request.


Properties

PropertyProperty valueDescription
RestFilter.OperationRestHandlerOpCodeThe Operation property contains unique ID of the REST resource or operation.
RestFilter.PreFilterRESTPreFilterHandlerThe PreFilter delegate must be called before calling intercepted HandleRESTRequest.
RestFilter.PostFilterRESTPostFilterHandlerThe 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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
    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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
    private byte[] PostFilterRootLegend ( RestRequestParameters restInput, byte[] originalResponse )
    {
      if (null == _authorizedLayerSet)
         return null;
      return MyCustomLegend(restInput, originalResponse);
    }

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.