congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SimpMessageTypeMatcher
Code IndexAdd Tabnine to your IDE (free)

How to use
SimpMessageTypeMatcher
in
org.springframework.security.messaging.util.matcher

Best Java code snippets using org.springframework.security.messaging.util.matcher.SimpMessageTypeMatcher (Showing top 11 results out of 315)

origin: spring-projects/spring-security

/**
 * Maps a {@link List} of {@link SimpDestinationMessageMatcher} instances.
 *
 * @param typesToMatch the {@link SimpMessageType} instance to match on
 * @return the {@link Constraint} associated to the matchers.
 */
public Constraint simpTypeMatchers(SimpMessageType... typesToMatch) {
  MessageMatcher<?>[] typeMatchers = new MessageMatcher<?>[typesToMatch.length];
  for (int i = 0; i < typesToMatch.length; i++) {
    SimpMessageType typeToMatch = typesToMatch[i];
    typeMatchers[i] = new SimpMessageTypeMatcher(typeToMatch);
  }
  return matchers(typeMatchers);
}
origin: spring-projects/spring-security

  @Test
  public void matchesMessageNullFalse() {
    Message<String> message = MessageBuilder.withPayload("Hi").build();

    assertThat(matcher.matches(message)).isFalse();
  }
}
origin: spring-projects/spring-security

@Test
public void matchesMessageMessageTrue() {
  Message<String> message = MessageBuilder
      .withPayload("Hi")
      .setHeader(SimpMessageHeaderAccessor.MESSAGE_TYPE_HEADER,
          SimpMessageType.MESSAGE).build();
  assertThat(matcher.matches(message)).isTrue();
}
origin: spring-projects/spring-security

/**
 * <p>
 * Creates a new instance with the specified pattern, {@link SimpMessageType}, and
 * {@link PathMatcher}.
 *
 * @param pattern the pattern to use
 * @param type the {@link SimpMessageType} to match on or null if any
 * {@link SimpMessageType} should be matched.
 * @param pathMatcher the {@link PathMatcher} to use.
 */
private SimpDestinationMessageMatcher(String pattern, SimpMessageType type,
    PathMatcher pathMatcher) {
  Assert.notNull(pattern, "pattern cannot be null");
  Assert.notNull(pathMatcher, "pathMatcher cannot be null");
  if (!isTypeWithDestination(type)) {
    throw new IllegalArgumentException("SimpMessageType " + type
        + " does not contain a destination and so cannot be matched on.");
  }
  this.matcher = pathMatcher;
  this.messageTypeMatcher = type == null ? ANY_MESSAGE
      : new SimpMessageTypeMatcher(type);
  this.pattern = pattern;
}
origin: spring-projects/spring-security

@Test
public void matchesMessageConnectFalse() {
  Message<String> message = MessageBuilder
      .withPayload("Hi")
      .setHeader(SimpMessageHeaderAccessor.MESSAGE_TYPE_HEADER,
          SimpMessageType.CONNECT).build();
  assertThat(matcher.matches(message)).isFalse();
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorNullType() {
  new SimpMessageTypeMatcher(null);
}
origin: spring-projects/spring-security

@Before
public void setup() {
  matcher = new SimpMessageTypeMatcher(SimpMessageType.MESSAGE);
}
origin: spring-projects/spring-security

@Test
public void typeConstructorParameterIsTransmitted() throws Exception {
  matcher = SimpDestinationMessageMatcher.createMessageMatcher("/match",
      pathMatcher);
  MessageMatcher<Object> expectedTypeMatcher = new SimpMessageTypeMatcher(
      SimpMessageType.MESSAGE);
  assertThat(matcher.getMessageTypeMatcher()).isEqualTo(expectedTypeMatcher);
}
origin: org.springframework.security/spring-security-config

/**
 * Maps a {@link List} of {@link SimpDestinationMessageMatcher} instances.
 *
 * @param typesToMatch the {@link SimpMessageType} instance to match on
 * @return the {@link Constraint} associated to the matchers.
 */
public Constraint simpTypeMatchers(SimpMessageType... typesToMatch) {
  MessageMatcher<?>[] typeMatchers = new MessageMatcher<?>[typesToMatch.length];
  for (int i = 0; i < typesToMatch.length; i++) {
    SimpMessageType typeToMatch = typesToMatch[i];
    typeMatchers[i] = new SimpMessageTypeMatcher(typeToMatch);
  }
  return matchers(typeMatchers);
}
origin: apache/servicemix-bundles

/**
 * Maps a {@link List} of {@link SimpDestinationMessageMatcher} instances.
 *
 * @param typesToMatch the {@link SimpMessageType} instance to match on
 * @return the {@link Constraint} associated to the matchers.
 */
public Constraint simpTypeMatchers(SimpMessageType... typesToMatch) {
  MessageMatcher<?>[] typeMatchers = new MessageMatcher<?>[typesToMatch.length];
  for (int i = 0; i < typesToMatch.length; i++) {
    SimpMessageType typeToMatch = typesToMatch[i];
    typeMatchers[i] = new SimpMessageTypeMatcher(typeToMatch);
  }
  return matchers(typeMatchers);
}
origin: apache/servicemix-bundles

/**
 * <p>
 * Creates a new instance with the specified pattern, {@link SimpMessageType}, and
 * {@link PathMatcher}.
 *
 * @param pattern the pattern to use
 * @param type the {@link SimpMessageType} to match on or null if any
 * {@link SimpMessageType} should be matched.
 * @param pathMatcher the {@link PathMatcher} to use.
 */
private SimpDestinationMessageMatcher(String pattern, SimpMessageType type,
    PathMatcher pathMatcher) {
  Assert.notNull(pattern, "pattern cannot be null");
  Assert.notNull(pathMatcher, "pathMatcher cannot be null");
  if (!isTypeWithDestination(type)) {
    throw new IllegalArgumentException("SimpMessageType " + type
        + " does not contain a destination and so cannot be matched on.");
  }
  this.matcher = pathMatcher;
  this.messageTypeMatcher = type == null ? ANY_MESSAGE
      : new SimpMessageTypeMatcher(type);
  this.pattern = pattern;
}
org.springframework.security.messaging.util.matcherSimpMessageTypeMatcher

Javadoc

A MessageMatcher that matches if the provided Message has a type that is the same as the SimpMessageType that was specified in the constructor.

Most used methods

  • <init>
  • matches

Popular in Java

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now