org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression Java Examples
The following examples show how to use
org.springframework.web.servlet.mvc.condition.HeadersRequestCondition.HeaderExpression.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConsumesRequestCondition.java From spring-analysis-note with MIT License | 6 votes |
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes, @Nullable String[] headers) { Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Content-Type".equalsIgnoreCase(expr.name) && expr.value != null) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ConsumeMediaTypeExpression(mediaType, expr.isNegated)); } } } } for (String consume : consumes) { result.add(new ConsumeMediaTypeExpression(consume)); } return result; }
Example #2
Source File: ProducesRequestCondition.java From spring-analysis-note with MIT License | 6 votes |
private Set<ProduceMediaTypeExpression> parseExpressions(String[] produces, @Nullable String[] headers) { Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Accept".equalsIgnoreCase(expr.name) && expr.value != null) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ProduceMediaTypeExpression(mediaType, expr.isNegated)); } } } } for (String produce : produces) { result.add(new ProduceMediaTypeExpression(produce)); } return result; }
Example #3
Source File: ConsumesRequestCondition.java From java-technology-stack with MIT License | 6 votes |
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes, @Nullable String[] headers) { Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Content-Type".equalsIgnoreCase(expr.name) && expr.value != null) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ConsumeMediaTypeExpression(mediaType, expr.isNegated)); } } } } for (String consume : consumes) { result.add(new ConsumeMediaTypeExpression(consume)); } return result; }
Example #4
Source File: ProducesRequestCondition.java From java-technology-stack with MIT License | 6 votes |
private Set<ProduceMediaTypeExpression> parseExpressions(String[] produces, @Nullable String[] headers) { Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Accept".equalsIgnoreCase(expr.name) && expr.value != null) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ProduceMediaTypeExpression(mediaType, expr.isNegated)); } } } } for (String produce : produces) { result.add(new ProduceMediaTypeExpression(produce)); } return result; }
Example #5
Source File: ConsumesRequestCondition.java From lams with GNU General Public License v2.0 | 6 votes |
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes, String[] headers) { Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<ConsumeMediaTypeExpression>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Content-Type".equalsIgnoreCase(expr.name)) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ConsumeMediaTypeExpression(mediaType, expr.isNegated)); } } } } if (consumes != null) { for (String consume : consumes) { result.add(new ConsumeMediaTypeExpression(consume)); } } return result; }
Example #6
Source File: ProducesRequestCondition.java From lams with GNU General Public License v2.0 | 6 votes |
private Set<ProduceMediaTypeExpression> parseExpressions(String[] produces, String[] headers) { Set<ProduceMediaTypeExpression> result = new LinkedHashSet<ProduceMediaTypeExpression>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Accept".equalsIgnoreCase(expr.name)) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ProduceMediaTypeExpression(mediaType, expr.isNegated)); } } } } if (produces != null) { for (String produce : produces) { result.add(new ProduceMediaTypeExpression(produce)); } } return result; }
Example #7
Source File: ConsumesRequestCondition.java From spring4-understanding with Apache License 2.0 | 6 votes |
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes, String[] headers) { Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<ConsumeMediaTypeExpression>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Content-Type".equalsIgnoreCase(expr.name)) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ConsumeMediaTypeExpression(mediaType, expr.isNegated)); } } } } if (consumes != null) { for (String consume : consumes) { result.add(new ConsumeMediaTypeExpression(consume)); } } return result; }
Example #8
Source File: ProducesRequestCondition.java From spring4-understanding with Apache License 2.0 | 6 votes |
private Set<ProduceMediaTypeExpression> parseExpressions(String[] produces, String[] headers) { Set<ProduceMediaTypeExpression> result = new LinkedHashSet<ProduceMediaTypeExpression>(); if (headers != null) { for (String header : headers) { HeaderExpression expr = new HeaderExpression(header); if ("Accept".equalsIgnoreCase(expr.name)) { for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) { result.add(new ProduceMediaTypeExpression(mediaType, expr.isNegated)); } } } } if (produces != null) { for (String produce : produces) { result.add(new ProduceMediaTypeExpression(produce)); } } return result; }
Example #9
Source File: HeadersRequestConditionTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void combine() { HeadersRequestCondition condition1 = new HeadersRequestCondition("foo=bar"); HeadersRequestCondition condition2 = new HeadersRequestCondition("foo=baz"); HeadersRequestCondition result = condition1.combine(condition2); Collection<HeaderExpression> conditions = result.getContent(); assertEquals(2, conditions.size()); }
Example #10
Source File: HeadersRequestConditionTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void combine() { HeadersRequestCondition condition1 = new HeadersRequestCondition("foo=bar"); HeadersRequestCondition condition2 = new HeadersRequestCondition("foo=baz"); HeadersRequestCondition result = condition1.combine(condition2); Collection<HeaderExpression> conditions = result.getContent(); assertEquals(2, conditions.size()); }
Example #11
Source File: HeadersRequestConditionTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void combine() { HeadersRequestCondition condition1 = new HeadersRequestCondition("foo=bar"); HeadersRequestCondition condition2 = new HeadersRequestCondition("foo=baz"); HeadersRequestCondition result = condition1.combine(condition2); Collection<HeaderExpression> conditions = result.getContent(); assertEquals(2, conditions.size()); }