Package br.com.caelum.vraptor.resource

Examples of br.com.caelum.vraptor.resource.DefaultResourceClass


    control.fillIntoRequest(uri, request);
    String webLogic = request.getParameter("webLogic");
    String webMethod = request.getParameter("webMethod");
    String typeName = type.apply("webLogic", webLogic);
    try {
      DefaultResourceClass resource = new DefaultResourceClass(Class.forName(typeName));
      Method resourceMethod = method(resource.getType(), this.method.apply("webMethod", webMethod));
      return new DefaultResourceMethod(resource, resourceMethod);
    } catch (ClassNotFoundException e) {
      logger.debug("Unable to find type " + typeName + " for strategy " + this);
      throw new IllegalStateException("You must call canHandle before calling this method");
    }
View Full Code Here


  public FixedMethodStrategy(String originalUri, Class<?> type, Method method, Set<HttpMethod> methods,
      ParametersControl control, int priority) {
    this.originalUri = originalUri;
    this.methods = methods.isEmpty() ? EnumSet.allOf(HttpMethod.class) : EnumSet.copyOf(methods);
    this.parameters = control;
    this.resourceMethod = new DefaultResourceMethod(new DefaultResourceClass(type), method);
    this.priority = priority;
  }
View Full Code Here

    new LinkToHandler(context, router).start();
  }

  public void handle(Class<?> annotatedType) {
    logger.debug("Found resource: {}", annotatedType);
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(annotatedType));
    for (Route route : routes) {
      router.add(route);
    }
    context.setAttribute(annotatedType.getSimpleName(), annotatedType);
  }
View Full Code Here

  }

  public void handle(Class<?> type) {
    logger.debug("registering vraptor2 component {}", type);
    components.register(type, type);
    List<Route> rules = parser.rulesFor(new DefaultResourceClass(type));
    for (Route route : rules) {
      router.add(route);
    }
  }
View Full Code Here

  public Method getMethod() {
    return method.getMethod();
  }

  public ResourceClass getResource() {
    return new DefaultResourceClass(method.getDeclaringResource().getResourceClass());
  }
View Full Code Here

    this.parser = parser;
  }

  public void handle(Class<?> annotatedType) {
    logger.debug("Found resource: " + annotatedType);
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(annotatedType));
    for (Route route : routes) {
      router.add(route);
    }
  }
View Full Code Here

    assertThat(route.allowedMethods(), is(EnumSet.of(HttpMethod.POST)));
  }

  @Test
  public void supportOverrideTypeHttpMethodAnnotation() throws SecurityException, NoSuchMethodException {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(AnnotatedController.class));
    Route route = getRouteMatching(routes, "/annotated/overridden");
    assertThat(route.allowedMethods(), is(EnumSet.of(HttpMethod.GET)));
  }
View Full Code Here

    };
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/relativePath");

    assertThat(route, canHandle(GetAnnotatedController.class, "withRelativePath"));
  }
View Full Code Here

    assertThat(route, canHandle(GetAnnotatedController.class, "withRelativePath"));
  }

  @Test
  public void priorityForGetAnnotationShouldBeDefault() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(GetAnnotatedController.class));
    Route route = getRouteMatching(routes, "/prefix/relativePath");

    assertThat(route.getPriority(), is(Path.DEFAULT));
  }
View Full Code Here

    assertThat(route.getPriority(), is(Path.DEFAULT));
  }

  @Test
  public void addsAPrefixToMethodsWhenTheGetControllerEndsWithSlashAndTheMethodAreAnnotatedWithRelativePath() throws Exception {
    List<Route> routes = parser.rulesFor(new DefaultResourceClass(EndSlashAnnotatedGetController.class));
    Route route = getRouteMatching(routes, "/endSlash/relativePath");

    assertThat(route, canHandle(EndSlashAnnotatedGetController.class, "withRelativePath"));
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.resource.DefaultResourceClass

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.