Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.Consumes


  public boolean accepts(ResourceMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = mime(request.getContentType());
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported(String.format("Request with media type [%s]. Expecting one of %s.",
          contentType, supported));
View Full Code Here


  public boolean accepts(ResourceMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = mime(request.getContentType());
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported(String.format("Request with media type [%s]. Expecting one of %s.",
          contentType, supported));
View Full Code Here

  public boolean accepts(ResourceMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    if(request.getContentType() == null) {
      logger.warn("Request does not have Content-Type and parameters will be not deserialized");
      stack.next(method, resourceInstance);
      return;
View Full Code Here

  public boolean accepts(ResourceMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = request.getContentType();
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported(String.format("Request with media type [%s]. Expecting one of %s.",
          contentType, supported));
View Full Code Here

    return method.containsAnnotation(Consumes.class);
  }

  @Override
  public void intercept(InterceptorStack stack, ControllerMethod method, Object controllerInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = mime(request.getContentType());
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported("Request with media type [%s]. Expecting one of %s.", contentType, supported);
      return;
View Full Code Here

  public boolean accepts(ResourceMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supportedMimeTypes =  Arrays.asList(consumesAnnotation.value());

    String contentType = request.getContentType();
    if (!supportedMimeTypes.contains(contentType)) {
      String errorMessage = String.format("Request with media type [%s]. Expecting one of %s.",
              contentType, supportedMimeTypes);
View Full Code Here

    return method.containsAnnotation(Consumes.class);
  }

  @Override
  public void intercept(InterceptorStack stack, ControllerMethod method, Object controllerInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = mime(request.getContentType());
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported("Request with media type [%s]. Expecting one of %s.", contentType, supported);
      return;
View Full Code Here

  public boolean accepts(ControllerMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ControllerMethod method, Object controllerInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = mime(request.getContentType());
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported("Request with media type [%s]. Expecting one of %s.", contentType, supported);
      return;
View Full Code Here

  public boolean accepts(ResourceMethod method) {
    return method.containsAnnotation(Consumes.class);
  }

  public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
    Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
    List<String> supported =  Arrays.asList(consumesAnnotation.value());

    String contentType = mime(request.getContentType());
    if (!supported.isEmpty() && !supported.contains(contentType)) {
      unsupported(String.format("Request with media type [%s]. Expecting one of %s.",
          contentType, supported));
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.Consumes

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.