Package br.com.caelum.vraptor.http.route

Examples of br.com.caelum.vraptor.http.route.MethodNotAllowedException


  @Test
  public void shouldHandle405() throws IOException, InterceptionException {
    EnumSet<HttpMethod> allowedMethods = EnumSet.of(HttpMethod.GET);
   
  when(translator.translate(info)).thenThrow(new MethodNotAllowedException(allowedMethods, HttpMethod.POST.toString()));
   
  lookup.intercept(null, null, null);
  verify(methodNotAllowedHandler).deny(info, allowedMethods);
  }
View Full Code Here


  private HttpMethod getHttpMethod(MutableRequest request, String controllerName) {
    try {
      return HttpMethod.of(request);
    } catch (IllegalArgumentException e) {
      throw new MethodNotAllowedException(router.allowedMethodsFor(controllerName), request.getMethod());
    }
  }
View Full Code Here

  private HttpMethod getHttpMethod(MutableRequest request, String controllerName) {
    try {
      return HttpMethod.of(request);
    } catch (IllegalArgumentException e) {
      throw new MethodNotAllowedException(router.allowedMethodsFor(controllerName), request.getMethod());
    }
  }
View Full Code Here

    HttpMethod method;
    try {
      method = HttpMethod.of(request);
    } catch (IllegalArgumentException e) {
      throw new MethodNotAllowedException(router.allowedMethodsFor(controllerName), request.getMethod());
    }
    ControllerMethod controller = router.parse(controllerName, method, request);

    logger.debug("found controller {}", controller);
    return controller;
View Full Code Here

  private HttpMethod getHttpMethod(MutableRequest request, String controllerName) {
    try {
      return HttpMethod.of(request);
    } catch (IllegalArgumentException e) {
      throw new MethodNotAllowedException(router.allowedMethodsFor(controllerName), request.getMethod());
    }
  }
View Full Code Here

  }

  @Test
  public void shouldHandle405() throws Exception {
    EnumSet<HttpMethod> allowedMethods = EnumSet.of(HttpMethod.GET);
    when(translator.translate(webRequest)).thenThrow(new MethodNotAllowedException(allowedMethods, POST.toString()));
    observer.handle(requestStarted);
    verify(methodNotAllowedHandler).deny(webRequest, webResponse, allowedMethods);
    verify(interceptorStack, never()).start();
  }
View Full Code Here

    HttpMethod method;
    try {
      method = HttpMethod.of(request);
    } catch (IllegalArgumentException e) {
      throw new MethodNotAllowedException(router.allowedMethodsFor(resourceName), request.getMethod());
    }
    ResourceMethod resource = router.parse(resourceName, method, request);

    logger.debug("found resource {}", resource);
    return resource;
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.http.route.MethodNotAllowedException

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.