Package org.springframework.web.servlet.mvc.condition

Examples of org.springframework.web.servlet.mvc.condition.HeadersRequestCondition$HeaderExpression


    request.addHeader("foo", "bar");

    RequestMappingInfo info =
        new RequestMappingInfo(
            new PatternsRequestCondition("/foo"), null, null,
            new HeadersRequestCondition("foo=bar"), null, null, null);
    RequestMappingInfo match = info.getMatchingCondition(request);

    assertNotNull(match);

    info = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"), null, null,
        new HeadersRequestCondition("foo!=bar"), null, null, null);
    match = info.getMatchingCondition(request);

    assertNull(match);
  }
View Full Code Here


  public void equals() {
    RequestMappingInfo info1 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    RequestMappingInfo info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertEquals(info1, info2);
    assertEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo", "/NOOOOOO"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertFalse(info1.equals(info2));
    assertNotEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET, RequestMethod.POST),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertFalse(info1.equals(info2));
    assertNotEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("/NOOOOOO"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertFalse(info1.equals(info2));
    assertNotEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("/NOOOOOO"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertFalse(info1.equals(info2));
    assertNotEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/NOOOOOO"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertFalse(info1.equals(info2));
    assertNotEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/NOOOOOO"),
        new ParamsRequestCondition("customFoo=customBar"));

    assertFalse(info1.equals(info2));
    assertNotEquals(info1.hashCode(), info2.hashCode());

    info2 = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"),
        new RequestMethodsRequestCondition(RequestMethod.GET),
        new ParamsRequestCondition("foo=bar"),
        new HeadersRequestCondition("foo=bar"),
        new ConsumesRequestCondition("text/plain"),
        new ProducesRequestCondition("text/plain"),
        new ParamsRequestCondition("customFoo=NOOOOOO"));

    assertFalse(info1.equals(info2));
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.mvc.condition.HeadersRequestCondition$HeaderExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.