Class AbstractGwtRpcRequestMatcher

java.lang.Object
com.hitachivantara.security.web.impl.model.matcher.RegexRequestMatcher
org.pentaho.platform.web.gwt.rpc.matcher.AbstractGwtRpcRequestMatcher
All Implemented Interfaces:
com.hitachivantara.security.web.model.matcher.RequestMatcher, Predicate<javax.servlet.http.HttpServletRequest>
Direct Known Subclasses:
PluginGwtRpcRequestMatcher, SystemGwtRpcRequestMatcher

public abstract class AbstractGwtRpcRequestMatcher extends com.hitachivantara.security.web.impl.model.matcher.RegexRequestMatcher
The AbstractGwtRpcRequestMatcher class is the base class for GWT-RPC request matchers.

This request matcher class allows matching the GWT-RPC service method name of each request against a list of method names. The service method name is present in the request body, which is encoded in the GWT-RPC request format.

The abstract getGwtRpc(HttpServletRequest) method is responsible for obtaining the AbstractGwtRpc object for the given request.

The service method name of the request is then obtained from the returned AbstractGwtRpc object.

Parsing the GWT-RPC request bodies requires a SerializationPolicy object, which is typically the result of loading a file from disk. To make this process performant, this class optionally accepts an instance of IGwtRpcSerializationPolicyCache, where these objects are stored and loaded from.

  • Constructor Details

    • AbstractGwtRpcRequestMatcher

      public AbstractGwtRpcRequestMatcher(@NonNull String pattern, @Nullable Collection<String> rpcMethodNames, @Nullable IGwtRpcSerializationPolicyCache serializationPolicyCache)
      Constructs a GWT-RPC request matcher given a path pattern, collection of RPC method names, and a GWT-RPC serialization policy cache.

      The request matcher created with this constructor applies matches the request path with the given pattern in a case-sensitive manner. Note that the RPC method name is always matched in a case-sensitive manner.

      Parameters:
      pattern - The request path pattern.
      rpcMethodNames - The collection of service method names. Can be null, in which case all methods match.
      serializationPolicyCache - The serialization policy cache. Can be null, in which case no caching occurs.
    • AbstractGwtRpcRequestMatcher

      public AbstractGwtRpcRequestMatcher(@NonNull String pattern, boolean isCaseInsensitive, @Nullable Collection<String> rpcMethodNames, @Nullable IGwtRpcSerializationPolicyCache serializationPolicyCache)
      Constructs a GWT-RPC request matcher given a path pattern, collection of RPC method names, and a GWT-RPC serialization policy cache.
      Parameters:
      pattern - The request path pattern.
      isCaseInsensitive - Indicates whether the given pattern matches the request path in a case-insensitive manner. Note that the RPC method name is always matched in a case-sensitive manner.
      rpcMethodNames - The collection of service method names. Can be null, in which case all methods match.
      serializationPolicyCache - The serialization policy cache. Can be null, in which case no caching occurs.
  • Method Details

    • getSerializationPolicyCache

      @Nullable public IGwtRpcSerializationPolicyCache getSerializationPolicyCache()
      Gets the serialization policy cache, if any.
    • getRpcMethodNames

      @Nullable public Collection<String> getRpcMethodNames()
      Gets the collection of matching GWT-RPC service method names. When null, all methods match.
    • test

      public boolean test(@NonNull javax.servlet.http.HttpServletRequest httpRequest)
      Specified by:
      test in interface Predicate<javax.servlet.http.HttpServletRequest>
      Overrides:
      test in class com.hitachivantara.security.web.impl.model.matcher.RegexRequestMatcher
    • getGwtRpc

      @NonNull protected abstract AbstractGwtRpc getGwtRpc(@NonNull javax.servlet.http.HttpServletRequest httpRequest)
      Gets the AbstractGwtRpc instance associated with the given request, creating one if it has not yet been created.
      Parameters:
      httpRequest - The HTTP request.
      Returns:
      The associated AbstractGwtRpc instance.
      Throws:
      GwtRpcProxyException - if the AbstractGwtRpc instance fails to be created.