Package org.springframework.web

Examples of org.springframework.web.HttpRequestMethodNotSupportedException


      throws ServletException {

    // Check whether we should support the request method.
    String method = request.getMethod();
    if (this.supportedMethods != null && !this.supportedMethods.contains(method)) {
      throw new HttpRequestMethodNotSupportedException(
          method, StringUtils.toStringArray(this.supportedMethods));
    }

    // Check whether a session is required.
    if (this.requireSession) {
View Full Code Here


      throws ServletException {

    // Check whether we should support the request method.
    String method = request.getMethod();
    if (!this.supportedMethods.contains(method)) {
      throw new HttpRequestMethodNotSupportedException(method);
    }

    // Check whether a session is required.
    if (this.requireSession) {
      if (request.getSession(false) == null) {
View Full Code Here

          producibleMediaTypes.addAll(info.getProducesCondition().getProducibleMediaTypes());
        }
      }
    }
    if (!allowedMethods.isEmpty()) {
      throw new HttpRequestMethodNotSupportedException(request.getMethod(), allowedMethods);
    }
    else if (!consumableMediaTypes.isEmpty()) {
      MediaType contentType = null;
      if (StringUtils.hasLength(request.getContentType())) {
        contentType = MediaType.parseMediaType(request.getContentType());
View Full Code Here

      throws ServletException {

    // Check whether we should support the request method.
    String method = request.getMethod();
    if (this.supportedMethods != null && !this.supportedMethods.contains(method)) {
      throw new HttpRequestMethodNotSupportedException(
          method, StringUtils.toStringArray(this.supportedMethods));
    }

    // Check whether a session is required.
    if (this.requireSession) {
View Full Code Here

    if (!ServletAnnotationMappingUtils.checkRequestMethod(mappedMethods, request)) {
      String[] supportedMethods = new String[mappedMethods.length];
      for (int i = 0; i < mappedMethods.length; i++) {
        supportedMethods[i] = mappedMethods[i].name();
      }
      throw new HttpRequestMethodNotSupportedException(request.getMethod(), supportedMethods);
    }

    String[] mappedParams = mapping.params();
    if (!ServletAnnotationMappingUtils.checkParameters(mappedParams, request)) {
      throw new UnsatisfiedServletRequestParameterException(mappedParams, request.getParameterMap());
View Full Code Here

    if (patternMatches.isEmpty()) {
      return null;
    }
    else if (patternAndMethodMatches.isEmpty() && !allowedMethods.isEmpty()) {
      throw new HttpRequestMethodNotSupportedException(request.getMethod(), allowedMethods);
    }

    Set<MediaType> consumableMediaTypes;
    Set<MediaType> producibleMediaTypes;
View Full Code Here

        }
        return targetHandlerMethods.get(bestMappingMatch);
      }
      else {
        if (!allowedMethods.isEmpty()) {
          throw new HttpRequestMethodNotSupportedException(request.getMethod(), StringUtils.toStringArray(allowedMethods));
        }
        throw new NoSuchRequestHandlingMethodException(lookupPath, request.getMethod(), request.getParameterMap());
      }
    }
View Full Code Here

        }
        return targetHandlerMethods.get(bestMappingMatch);
      }
      else {
        if (!allowedMethods.isEmpty()) {
          throw new HttpRequestMethodNotSupportedException(request.getMethod(), StringUtils.toStringArray(allowedMethods));
        }
        throw new NoSuchRequestHandlingMethodException(lookupPath, request.getMethod(), request.getParameterMap());
      }
    }
View Full Code Here

    if (!ServletAnnotationMappingUtils.checkRequestMethod(mappedMethods, request)) {
      String[] supportedMethods = new String[mappedMethods.length];
      for (int i = 0; i < mappedMethods.length; i++) {
        supportedMethods[i] = mappedMethods[i].name();
      }
      throw new HttpRequestMethodNotSupportedException(request.getMethod(), supportedMethods);
    }

    String[] mappedParams = mapping.params();
    if (!ServletAnnotationMappingUtils.checkParameters(mappedParams, request)) {
      throw new UnsatisfiedServletRequestParameterException(mappedParams, request.getParameterMap());
View Full Code Here

   * @param method method (such as "GET") which should be rejected
   * @throws ServletException if the given HTTP request is rejected
   */
  public static void rejectRequestMethod(HttpServletRequest request, String method) throws ServletException {
    if (request.getMethod().equals(method)) {
      throw new HttpRequestMethodNotSupportedException(method);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.HttpRequestMethodNotSupportedException

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.