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

How to use
name
method
in
org.springframework.web.bind.annotation.RequestMethod

Best Java code snippets using org.springframework.web.bind.annotation.RequestMethod.name (Showing top 20 results out of 675)

origin: spring-projects/spring-framework

/**
 * Return declared HTTP methods.
 */
public Set<HttpMethod> getAllowedMethods() {
  return this.partialMatches.stream().
      flatMap(m -> m.getInfo().getMethodsCondition().getMethods().stream()).
      map(requestMethod -> HttpMethod.resolve(requestMethod.name())).
      collect(Collectors.toSet());
}
origin: spring-projects/spring-framework

/**
 * Return declared HTTP methods.
 */
public Set<String> getAllowedMethods() {
  Set<String> result = new LinkedHashSet<>();
  for (PartialMatch match : this.partialMatches) {
    for (RequestMethod method : match.getInfo().getMethodsCondition().getMethods()) {
      result.add(method.name());
    }
  }
  return result;
}
origin: spring-projects/spring-framework

@Nullable
private RequestMethodsRequestCondition matchRequestMethod(@Nullable HttpMethod httpMethod) {
  if (httpMethod != null) {
    for (RequestMethod method : getMethods()) {
      if (httpMethod.matches(method.name())) {
        return new RequestMethodsRequestCondition(method);
      }
    }
    if (httpMethod == HttpMethod.HEAD && getMethods().contains(RequestMethod.GET)) {
      return GET_CONDITION;
    }
  }
  return null;
}
origin: spring-projects/spring-framework

private RequestMappingInfo assertComposedAnnotationMapping(RequestMethod requestMethod) throws Exception {
  String methodName = requestMethod.name().toLowerCase();
  String path = "/" + methodName;
  return assertComposedAnnotationMapping(methodName, path, requestMethod);
}
origin: spring-projects/spring-framework

private RequestMappingInfo assertComposedAnnotationMapping(RequestMethod requestMethod) throws Exception {
  String methodName = requestMethod.name().toLowerCase();
  String path = "/" + methodName;
  return assertComposedAnnotationMapping(methodName, path, requestMethod);
}
origin: spring-projects/spring-framework

@Nullable
private RequestMethodsRequestCondition matchRequestMethod(String httpMethodValue) {
  HttpMethod httpMethod = HttpMethod.resolve(httpMethodValue);
  if (httpMethod != null) {
    for (RequestMethod method : getMethods()) {
      if (httpMethod.matches(method.name())) {
        return new RequestMethodsRequestCondition(method);
      }
    }
    if (httpMethod == HttpMethod.HEAD && getMethods().contains(RequestMethod.GET)) {
      return GET_CONDITION;
    }
  }
  return null;
}
origin: spring-projects/spring-framework

private void testNoMatch(RequestMethodsRequestCondition condition, RequestMethod method) {
  MockHttpServletRequest request = new MockHttpServletRequest(method.name(), "");
  assertNull(condition.getMatchingCondition(request));
}
origin: spring-projects/spring-framework

private void testNoMatch(RequestMethodsRequestCondition condition, RequestMethod method) throws Exception {
  ServerWebExchange exchange = getExchange(method.name());
  assertNull(condition.getMatchingCondition(exchange));
}
origin: spring-projects/spring-framework

private void testMatch(RequestMethodsRequestCondition condition, RequestMethod method) {
  MockHttpServletRequest request = new MockHttpServletRequest(method.name(), "");
  RequestMethodsRequestCondition actual = condition.getMatchingCondition(request);
  assertNotNull(actual);
  assertEquals(Collections.singleton(method), actual.getContent());
}
origin: spring-projects/spring-framework

private void testMatch(RequestMethodsRequestCondition condition, RequestMethod method) throws Exception {
  ServerWebExchange exchange = getExchange(method.name());
  RequestMethodsRequestCondition actual = condition.getMatchingCondition(exchange);
  assertNotNull(actual);
  assertEquals(Collections.singleton(method), actual.getContent());
}
origin: spring-projects/spring-framework

@Test
public void preflightRequestWithoutCorsConfigurationProvider() throws Exception {
  this.request.setMethod(RequestMethod.OPTIONS.name());
  this.request.setRequestURI("/foo");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertNotNull(chain.getHandler());
  assertTrue(chain.getHandler().getClass().getSimpleName().equals("PreFlightHandler"));
}
origin: spring-projects/spring-framework

@Test
public void preflightRequestWithCorsConfigurationProvider() throws Exception {
  this.request.setMethod(RequestMethod.OPTIONS.name());
  this.request.setRequestURI("/cors");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertNotNull(chain.getHandler());
  assertTrue(chain.getHandler().getClass().getSimpleName().equals("PreFlightHandler"));
  CorsConfiguration config = getCorsConfiguration(chain, true);
  assertNotNull(config);
  assertArrayEquals(config.getAllowedOrigins().toArray(), new String[]{"*"});
}
origin: spring-projects/spring-framework

@Test
public void getMatchingConditionWithEmptyConditions() throws Exception {
  RequestMethodsRequestCondition condition = new RequestMethodsRequestCondition();
  for (RequestMethod method : RequestMethod.values()) {
    if (method != OPTIONS) {
      ServerWebExchange exchange = getExchange(method.name());
      assertNotNull(condition.getMatchingCondition(exchange));
    }
  }
  testNoMatch(condition, OPTIONS);
}
origin: spring-projects/spring-framework

@Test
public void getMatchingConditionWithEmptyConditions() {
  RequestMethodsRequestCondition condition = new RequestMethodsRequestCondition();
  for (RequestMethod method : RequestMethod.values()) {
    if (method != OPTIONS) {
      HttpServletRequest request = new MockHttpServletRequest(method.name(), "");
      assertNotNull(condition.getMatchingCondition(request));
    }
  }
  testNoMatch(condition, OPTIONS);
}
origin: spring-projects/spring-framework

@Test
public void preflightRequestWithMappedCorsConfiguration() throws Exception {
  CorsConfiguration config = new CorsConfiguration();
  config.addAllowedOrigin("*");
  this.handlerMapping.setCorsConfigurations(Collections.singletonMap("/foo", config));
  this.request.setMethod(RequestMethod.OPTIONS.name());
  this.request.setRequestURI("/foo");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertNotNull(chain.getHandler());
  assertTrue(chain.getHandler().getClass().getSimpleName().equals("PreFlightHandler"));
  config = getCorsConfiguration(chain, true);
  assertNotNull(config);
  assertArrayEquals(config.getAllowedOrigins().toArray(), new String[]{"*"});
}
origin: spring-projects/spring-framework

@Test
public void preflightRequestWithCorsConfigurationSource() throws Exception {
  this.handlerMapping.setCorsConfigurationSource(new CustomCorsConfigurationSource());
  this.request.setMethod(RequestMethod.OPTIONS.name());
  this.request.setRequestURI("/foo");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertNotNull(chain.getHandler());
  assertTrue(chain.getHandler().getClass().getSimpleName().equals("PreFlightHandler"));
  CorsConfiguration config = getCorsConfiguration(chain, true);
  assertNotNull(config);
  assertArrayEquals(new String[]{"*"}, config.getAllowedOrigins().toArray());
  assertEquals(true, config.getAllowCredentials());
}
origin: spring-projects/spring-framework

@Test
public void actualRequestWithoutCorsConfigurationProvider() throws Exception {
  this.request.setMethod(RequestMethod.GET.name());
  this.request.setRequestURI("/foo");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertTrue(chain.getHandler() instanceof SimpleHandler);
}
origin: spring-projects/spring-framework

@Test
public void actualRequestWithCorsConfigurationProvider() throws Exception {
  this.request.setMethod(RequestMethod.GET.name());
  this.request.setRequestURI("/cors");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertTrue(chain.getHandler() instanceof CorsAwareHandler);
  CorsConfiguration config = getCorsConfiguration(chain, false);
  assertNotNull(config);
  assertArrayEquals(config.getAllowedOrigins().toArray(), new String[]{"*"});
}
origin: spring-projects/spring-framework

@Test
public void actualRequestWithMappedCorsConfiguration() throws Exception {
  CorsConfiguration config = new CorsConfiguration();
  config.addAllowedOrigin("*");
  this.handlerMapping.setCorsConfigurations(Collections.singletonMap("/foo", config));
  this.request.setMethod(RequestMethod.GET.name());
  this.request.setRequestURI("/foo");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertTrue(chain.getHandler() instanceof SimpleHandler);
  config = getCorsConfiguration(chain, false);
  assertNotNull(config);
  assertArrayEquals(config.getAllowedOrigins().toArray(), new String[]{"*"});
}
origin: spring-projects/spring-framework

@Test
public void actualRequestWithCorsConfigurationSource() throws Exception {
  this.handlerMapping.setCorsConfigurationSource(new CustomCorsConfigurationSource());
  this.request.setMethod(RequestMethod.GET.name());
  this.request.setRequestURI("/foo");
  this.request.addHeader(HttpHeaders.ORIGIN, "http://domain2.com");
  this.request.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET");
  HandlerExecutionChain chain = handlerMapping.getHandler(this.request);
  assertNotNull(chain);
  assertTrue(chain.getHandler() instanceof SimpleHandler);
  CorsConfiguration config = getCorsConfiguration(chain, false);
  assertNotNull(config);
  assertArrayEquals(new String[]{"*"}, config.getAllowedOrigins().toArray());
  assertEquals(true, config.getAllowCredentials());
}
org.springframework.web.bind.annotationRequestMethodname

Popular methods of RequestMethod

  • toString
  • valueOf
  • values
  • equals
  • hashCode
  • compareTo

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Socket (java.net)
    Provides a client-side TCP socket.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ImageIO (javax.imageio)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top 17 PhpStorm Plugins
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