Interface WebServiceMessageSender.DestinationPolicy<D extends WebServiceMessageSender.DestinationDescriptor>

Type Parameters:
D - concrete descriptor type supplied by the sender implementation
Enclosing interface:
WebServiceMessageSender
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface WebServiceMessageSender.DestinationPolicy<D extends WebServiceMessageSender.DestinationDescriptor>
Decides which destinations a sender may open a connection to.

A policy is required to send to a WebServiceMessageSender.UriSource.REMOTE destination: when a sender has no policy, every remote destination is rejected. Express the destinations that the application considers legitimate, ideally as an explicit allowlist. Transport-specific factories are available to cover the common case and leave WebServiceMessageSender.UriSource.APPLICATION destinations untouched.

A policy is consulted for every destination, whatever its source, so a policy that only means to constrain remote destinations should either check WebServiceMessageSender.DestinationDescriptor.uriSource() or be built with forRemoteDestinations(Predicate).

Since:
3.1.9
  • Method Details

    • accept

      boolean accept(D descriptor)
      Whether the given destination is acceptable.
      Parameters:
      descriptor - transport-specific view of the destination
      Returns:
      whether the destination is acceptable
      Since:
      3.1.10
    • forRemoteDestinations

      static <D extends WebServiceMessageSender.DestinationDescriptor> WebServiceMessageSender.DestinationPolicy<D> forRemoteDestinations(Predicate<D> remotePolicy)
      Return a policy that applies the given predicate to WebServiceMessageSender.UriSource.REMOTE destinations and accepts every other destination.
      Type Parameters:
      D - concrete descriptor type supplied by the sender implementation
      Parameters:
      remotePolicy - the predicate to apply to remote destinations
      Returns:
      a policy that only constrains remote destinations
      Since:
      3.1.10