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

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


        for (Method javaMethod : actualType.getDeclaredMethods()) {
      if (!isEligible(javaMethod) || isGetter(javaMethod)) {
                continue;
            }
      String uri = getUriFor(javaMethod, baseType);
      RouteBuilder builder = router.builderFor(uri);
      for (HttpMethod m : HttpMethod.values()) {
        if (javaMethod.isAnnotationPresent(m.getAnnotation())) {
          builder.with(m);
        }
      }
      builder.is(baseType, javaMethod);
      routes.add(builder.build());
        }
    registerRulesFor(actualType.getSuperclass(), baseType, routes);
  }
View Full Code Here


  private void registerRulesFor(Class<?> baseType, List<Route> routes) {
    List<Method> methods = new Mirror().on(baseType).reflectAll().methodsMatching(suitableMethod());
    for (Method javaMethod : methods) {
      String uri = getUriFor(javaMethod, baseType);
      RouteBuilder builder = router.builderFor(uri);
      for (HttpMethod m : HttpMethod.values()) {
        if (javaMethod.isAnnotationPresent(m.getAnnotation())) {
          builder.with(m);
        }
      }
      builder.is(baseType, javaMethod);
      routes.add(builder.build());
    }
  }
View Full Code Here

   
    if(!locale.getCountry().isEmpty()) {
       localePrefix += "[\\-|_]" + locale.getCountry();
    }
   
    RouteBuilder rule = router.builderFor(localePrefix + uri);

    EnumSet<HttpMethod> methods = getHttpMethods(javaMethod);
    EnumSet<HttpMethod> typeMethods = getHttpMethods(type);

    rule.with(methods.isEmpty() ? typeMethods : methods);

    if(javaMethod.isAnnotationPresent(Path.class)){
      rule.withPriority(javaMethod.getAnnotation(Path.class).priority());
    }

    if (getUris(javaMethod).length > 0) {
      rule.withPriority(Path.DEFAULT);
    }

    rule.is(type, javaMethod);
    return rule.build();
  }
View Full Code Here

        for (Method javaMethod : actualType.getDeclaredMethods()) {
      if (!isEligible(javaMethod) || isGetter(javaMethod)) {
                continue;
            }
      String uri = getUriFor(javaMethod, baseType);
      RouteBuilder builder = new RouteBuilder(proxifier, finder, uri);
      for (HttpMethod m : HttpMethod.values()) {
        if (javaMethod.isAnnotationPresent(m.getAnnotation())) {
          builder.with(m);
        }
      }
      builder.is(baseType, javaMethod);
      routes.add(builder.build());
        }
    registerRulesFor(actualType.getSuperclass(), baseType, routes);
  }
View Full Code Here

   
    if(!locale.getCountry().isEmpty()) {
       localePrefix += "[\\-|_]" + locale.getCountry();
    }
   
    RouteBuilder rule = router.builderFor(localePrefix + uri);

    EnumSet<HttpMethod> methods = getHttpMethods(javaMethod);
    EnumSet<HttpMethod> typeMethods = getHttpMethods(type);

    rule.with(methods.isEmpty() ? typeMethods : methods);

    if(javaMethod.isAnnotationPresent(Path.class)){
      rule.withPriority(javaMethod.getAnnotation(Path.class).priority());
    }

    if (getUris(javaMethod).length > 0) {
      rule.withPriority(Path.DEFAULT);
    }

    rule.is(type, javaMethod);
    return rule.build();
  }
View Full Code Here

TOP

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

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.