congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
RequestMethod.valueOf
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-integration

public RequestMethod[] getRequestMethods() {
  RequestMethod[] requestMethods = new RequestMethod[this.methods.length];
  for (int i = 0; i < this.methods.length; i++) {
    requestMethods[i] = RequestMethod.valueOf(this.methods[i].name());
  }
  return requestMethods;
}
origin: org.locationtech.geogig/geogig-web-api

@Override
public RequestMethod getMethod() {
  return RequestMethod.valueOf(request.getMethod());
}
origin: org.springframework.boot/spring-boot-actuator

private RequestMappingInfo createRequestMappingInfo(WebOperation operation) {
  WebOperationRequestPredicate predicate = operation.getRequestPredicate();
  PatternsRequestCondition patterns = patternsRequestConditionForPattern(
      predicate.getPath());
  RequestMethodsRequestCondition methods = new RequestMethodsRequestCondition(
      RequestMethod.valueOf(predicate.getHttpMethod().name()));
  ConsumesRequestCondition consumes = new ConsumesRequestCondition(
      StringUtils.toStringArray(predicate.getConsumes()));
  ProducesRequestCondition produces = new ProducesRequestCondition(
      StringUtils.toStringArray(predicate.getProduces()));
  return new RequestMappingInfo(null, patterns, methods, null, null, consumes,
      produces, null);
}
origin: org.springframework.boot/spring-boot-actuator

private RequestMappingInfo createRequestMappingInfo(WebOperation operation) {
  WebOperationRequestPredicate predicate = operation.getRequestPredicate();
  PatternsRequestCondition patterns = new PatternsRequestCondition(pathPatternParser
      .parse(this.endpointMapping.createSubPath(predicate.getPath())));
  RequestMethodsRequestCondition methods = new RequestMethodsRequestCondition(
      RequestMethod.valueOf(predicate.getHttpMethod().name()));
  ConsumesRequestCondition consumes = new ConsumesRequestCondition(
      StringUtils.toStringArray(predicate.getConsumes()));
  ProducesRequestCondition produces = new ProducesRequestCondition(
      StringUtils.toStringArray(predicate.getProduces()));
  return new RequestMappingInfo(null, patterns, methods, null, null, consumes,
      produces, null);
}
origin: com.github.springdox/springdox-spi

public List<ResponseMessage> getGlobalResponseMessages(String forHttpMethod) {
 if (documentationContext.getGlobalResponseMessages().containsKey(RequestMethod.valueOf(forHttpMethod))) {
  return documentationContext.getGlobalResponseMessages().get(RequestMethod.valueOf(forHttpMethod));
 }
 return newArrayList();
}
origin: org.springframework.integration/spring-integration-http

public RequestMethod[] getRequestMethods() {
  RequestMethod[] requestMethods = new RequestMethod[this.methods.length];
  for (int i = 0; i < this.methods.length; i++) {
    requestMethods[i] = RequestMethod.valueOf(this.methods[i].name());
  }
  return requestMethods;
}
origin: spring-projects/spring-batch-admin

private List<ResourceInfo> buildResourcesFromProperties(Properties properties, Properties defaults) {
  Set<ResourceInfo> resources = new TreeSet<ResourceInfo>();
  if (properties == null) {
    if (defaults == null) {
      return new ArrayList<ResourceInfo>();
    }
    properties = defaults;
  }
  for (Enumeration<?> iterator = properties.propertyNames(); iterator.hasMoreElements();) {
    String key = (String) iterator.nextElement();
    String method = key.substring(0, key.indexOf("/"));
    String url = key.substring(key.indexOf("/"));
    String description = properties.getProperty(key, defaults.getProperty(key));
    resources.add(new ResourceInfo(url, RequestMethod.valueOf(method), description));
  }
  return new ArrayList<ResourceInfo>(resources);
}
origin: org.springframework.batch/spring-batch-admin-resources

private List<ResourceInfo> buildResourcesFromProperties(Properties properties, Properties defaults) {
  Set<ResourceInfo> resources = new TreeSet<ResourceInfo>();
  if (properties == null) {
    if (defaults == null) {
      return new ArrayList<ResourceInfo>();
    }
    properties = defaults;
  }
  for (Enumeration<?> iterator = properties.propertyNames(); iterator.hasMoreElements();) {
    String key = (String) iterator.nextElement();
    String method = key.substring(0, key.indexOf("/"));
    String url = key.substring(key.indexOf("/"));
    String description = properties.getProperty(key, defaults.getProperty(key));
    resources.add(new ResourceInfo(url, RequestMethod.valueOf(method), description));
  }
  return new ArrayList<ResourceInfo>(resources);
}
origin: cn.home1/oss-lib-errorhandle-spring-boot-1.4.1.RELEASE

 @Override
 protected void doFilterInternal( //
  final HttpServletRequest request, //
  final HttpServletResponse response, //
  final FilterChain filterChain //
 ) throws ServletException, IOException {
  final RequestMethod requestMethod = RequestMethod.valueOf(request.getMethod());

  final String contentType = request.getContentType();
  final Boolean interested = requestMethod != GET && requestMethod != OPTIONS && //
   contentType != null && (contentType.contains("xml") || contentType.contains("json"));

  if (interested) {
   final ContentCachingRequestWrapper found = findWrapper(request, ContentCachingRequestWrapper.class);
   if (found == null) {
    filterChain.doFilter(new ContentCachingRequestWrapper(request), response);
   } else {
    filterChain.doFilter(request, response);
   }
  } else {
   filterChain.doFilter(request, response);
  }
 }
}
origin: cn.home1/oss-lib-errorhandle-spring-boot-1.4.2.RELEASE

 @Override
 protected void doFilterInternal( //
  final HttpServletRequest request, //
  final HttpServletResponse response, //
  final FilterChain filterChain //
 ) throws ServletException, IOException {
  final RequestMethod requestMethod = RequestMethod.valueOf(request.getMethod());

  final String contentType = request.getContentType();
  final Boolean interested = requestMethod != GET && requestMethod != OPTIONS && //
   contentType != null && (contentType.contains("xml") || contentType.contains("json"));

  if (interested) {
   final ContentCachingRequestWrapper found = findWrapper(request, ContentCachingRequestWrapper.class);
   if (found == null) {
    filterChain.doFilter(new ContentCachingRequestWrapper(request), response);
   } else {
    filterChain.doFilter(request, response);
   }
  } else {
   filterChain.doFilter(request, response);
  }
 }
}
origin: io.springfox/springfox-swagger-common

@Override
public void apply(OperationContext context) {
 Optional<ApiOperation> apiOperationAnnotation = context.findAnnotation(ApiOperation.class);
 if (apiOperationAnnotation.isPresent() && StringUtils.hasText(apiOperationAnnotation.get().httpMethod())) {
  String apiMethod = apiOperationAnnotation.get().httpMethod();
  try {
   RequestMethod.valueOf(apiMethod);
   context.operationBuilder().method(HttpMethod.valueOf(apiMethod));
  } catch (IllegalArgumentException e) {
   log.error("Invalid http method: " + apiMethod + "Valid ones are [" + RequestMethod.values() + "]", e);
  }
 }
}
origin: osiam/server

public Group validateJsonGroup(HttpServletRequest request) throws IOException {
  String jsonInput = getRequestBody(request);
  Validator validator = validators.get(RequestMethod.valueOf(request.getMethod()));
  Group group;
  try {
    group = validator.validateGroup(jsonInput);
  } catch (JsonParseException ex) {
    throw new IllegalArgumentException("The JSON structure is invalid", ex);
  }
  if (group.getSchemas() == null || group.getSchemas().isEmpty() || !group.getSchemas().contains(Constants.GROUP_CORE_SCHEMA)) {
    throw new SchemaUnknownException();
  }
  return group;
}
origin: de.escalon.hypermedia/spring-hateoas-ext

private static String getModelProperty(String href, ActionDescriptor actionDescriptor) {
  RequestMethod httpMethod = RequestMethod.valueOf(actionDescriptor.getHttpMethod());
  StringBuffer model = new StringBuffer();
  switch (httpMethod) {
    case POST:
    case PUT:
    case PATCH: {
      List<UberField> uberFields = new ArrayList<UberField>();
      recurseBeanCreationParams(uberFields, actionDescriptor.getRequestBody()
          .getParameterType(), actionDescriptor, actionDescriptor.getRequestBody(), actionDescriptor
          .getRequestBody()
          .getValue(), "", Collections.<String>emptySet());
      for (UberField uberField : uberFields) {
        if (model.length() > 0) {
          model.append("&");
        }
        model.append(String.format(MODEL_FORMAT, uberField.getName(), uberField.getName()));
      }
      break;
    }
    default:
  }
  return model.length() == 0 ? null : model.toString();
}
origin: dschulten/hydra-java

private static String getModelProperty(String href, ActionDescriptor actionDescriptor) {
  RequestMethod httpMethod = RequestMethod.valueOf(actionDescriptor.getHttpMethod());
  StringBuffer model = new StringBuffer();
  switch (httpMethod) {
    case POST:
    case PUT:
    case PATCH: {
      List<UberField> uberFields = new ArrayList<UberField>();
      recurseBeanCreationParams(uberFields, actionDescriptor.getRequestBody()
          .getParameterType(), actionDescriptor, actionDescriptor.getRequestBody(), actionDescriptor
          .getRequestBody()
          .getValue(), "", Collections.<String>emptySet());
      for (UberField uberField : uberFields) {
        if (model.length() > 0) {
          model.append("&");
        }
        model.append(String.format(MODEL_FORMAT, uberField.getName(), uberField.getName()));
      }
      break;
    }
    default:
  }
  return model.length() == 0 ? null : model.toString();
}
origin: osiam/server

public User validateJsonUser(HttpServletRequest request) throws IOException {
  String jsonInput = getRequestBody(request);
  Validator validator = validators.get(RequestMethod.valueOf(request.getMethod()));
  User user;
  try {
    user = validator.validateJsonUser(jsonInput);
  } catch (JsonParseException ex) {
    throw new IllegalArgumentException("The JSON structure is invalid", ex);
  }
  if (user.getSchemas() == null || user.getSchemas().isEmpty() || !user.getSchemas().contains(Constants.USER_CORE_SCHEMA)) {
    throw new SchemaUnknownException();
  }
  if (user.getId() != null && !user.getId().isEmpty()) {
    user = new User.Builder(user).setId(null).build();
  }
  return user;
}
origin: com.github.springdox/springdox-swagger-common

@Override
public void apply(OperationContext context) {
 HandlerMethod handlerMethod = context.getHandlerMethod();
 ApiOperation apiOperationAnnotation = handlerMethod.getMethodAnnotation(ApiOperation.class);
 if (apiOperationAnnotation != null && StringUtils.hasText(apiOperationAnnotation.httpMethod())) {
  String apiMethod = apiOperationAnnotation.httpMethod();
  try {
   RequestMethod.valueOf(apiMethod);
   context.operationBuilder().method(apiMethod);
  } catch (IllegalArgumentException e) {
   log.error("Invalid http method: " + apiMethod + "Valid ones are [" + RequestMethod.values() + "]", e);
  }
 }
}
origin: com.mangofactory/swagger-springmvc

 @Override
 public void execute(RequestMappingContext context) {
  RequestMethod currentHttpMethod = (RequestMethod) context.get("currentHttpMethod");
  HandlerMethod handlerMethod = context.getHandlerMethod();

  String requestMethod = currentHttpMethod.toString();
  ApiOperation apiOperationAnnotation = handlerMethod.getMethodAnnotation(ApiOperation.class);

  if (apiOperationAnnotation != null && StringUtils.hasText(apiOperationAnnotation.httpMethod())) {
   String apiMethod = apiOperationAnnotation.httpMethod();
   try {
    RequestMethod.valueOf(apiMethod);
    requestMethod = apiMethod;
   } catch (IllegalArgumentException e) {
    log.error("Invalid http method: " + apiMethod + "Valid ones are [" + RequestMethod.values() + "]", e);
   }
  }
  context.put("httpRequestMethod", requestMethod);
 }
}
origin: jtalks-org/jcommune

/**
 * {@inheritDoc}
 */
@Override
protected HandlerMethod getHandlerInternal(HttpServletRequest request) throws Exception {
  String lookupPath = getUrlPathHelper().getLookupPathForRequest(request);
  MethodAwareKey key = new MethodAwareKey(RequestMethod.valueOf(request.getMethod()), getUniformUrl(lookupPath));
  //We should clear map in case if plugin version was changed
  pluginHandlerMethods.clear();
  //We should update Web plugins before resolving handler
  pluginLoader.reloadPlugins(new TypeFilter(WebControllerPlugin.class));
  HandlerMethod handlerMethod = findHandlerMethod(key);
  if (handlerMethod != null) {
    RequestMappingInfo mappingInfo = getMappingForMethod(handlerMethod.getMethod(), handlerMethod.getBeanType());
    //IMPORTANT: Should be called to set request attributes which allows resolve path variables
    handleMatch(mappingInfo, lookupPath, request);
    return handlerMethod;
  } else {
    return super.getHandlerInternal(request);
  }
}
origin: dschulten/hydra-java

/**
 * Converts single link to uber node.
 *
 * @param href
 *         to use
 * @param actionDescriptor
 *         to use for action and model, never null
 * @param rels
 *         of the link
 * @return uber link
 */
public static UberNode toUberLink(String href, ActionDescriptor actionDescriptor, List<String> rels) {
  Assert.notNull(actionDescriptor, "actionDescriptor must not be null");
  UberNode uberLink = new UberNode();
  uberLink.setRel(rels);
  PartialUriTemplateComponents partialUriTemplateComponents = new PartialUriTemplate(href).expand(Collections
      .<String, Object>emptyMap());
  uberLink.setUrl(partialUriTemplateComponents.toString());
  uberLink.setTemplated(partialUriTemplateComponents.hasVariables() ? Boolean.TRUE : null);
  uberLink.setModel(getModelProperty(href, actionDescriptor));
  if (actionDescriptor != null) {
    RequestMethod requestMethod = RequestMethod.valueOf(actionDescriptor.getHttpMethod());
    uberLink.setAction(UberAction.forRequestMethod(requestMethod));
  }
  return uberLink;
}
origin: de.escalon.hypermedia/spring-hateoas-ext

/**
 * Converts single link to uber node.
 *
 * @param href
 *         to use
 * @param actionDescriptor
 *         to use for action and model, never null
 * @param rels
 *         of the link
 * @return uber link
 */
public static UberNode toUberLink(String href, ActionDescriptor actionDescriptor, List<String> rels) {
  Assert.notNull(actionDescriptor, "actionDescriptor must not be null");
  UberNode uberLink = new UberNode();
  uberLink.setRel(rels);
  PartialUriTemplateComponents partialUriTemplateComponents = new PartialUriTemplate(href).expand(Collections
      .<String, Object>emptyMap());
  uberLink.setUrl(partialUriTemplateComponents.toString());
  uberLink.setTemplated(partialUriTemplateComponents.hasVariables() ? Boolean.TRUE : null);
  uberLink.setModel(getModelProperty(href, actionDescriptor));
  if (actionDescriptor != null) {
    RequestMethod requestMethod = RequestMethod.valueOf(actionDescriptor.getHttpMethod());
    uberLink.setAction(UberAction.forRequestMethod(requestMethod));
  }
  return uberLink;
}
org.springframework.web.bind.annotationRequestMethodvalueOf

Popular methods of RequestMethod

  • name
  • toString
  • values
  • equals
  • hashCode
  • compareTo

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • IsNull (org.hamcrest.core)
    Is the value null?
  • PhpStorm for WordPress
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