Package juzu.impl.router

Examples of juzu.impl.router.Route$RouteMatcher


    //
    HashMap<MethodHandle, Route> forwardRoutes = new HashMap<MethodHandle, Route>();
    HashMap<Route, RouteDescriptor> backwardRoutes = new HashMap<Route, RouteDescriptor>();

    //
    Route root = new Router();
    RouterService router = bridge.getApplication().resolveBean(RouterService.class);
    if (router != null) {
      RouterDescriptor desc = router.getDescriptor();
      if (desc != null) {
        Map<RouteDescriptor, Route> ret = desc.popupate(root);
View Full Code Here


    // No method -> not found
    if (requestTarget == null) {
      bridge.getRequestContext().setStatus(404);
    } else {
      if (requestMatch == null) {
        Route requestRoute = getRoute(requestTarget.getHandle());
        if (requestRoute != null) {
          requestMatch = requestRoute.matches(Collections.<String, String>emptyMap());
          if (requestMatch != null) {
            StringBuilder sb = new StringBuilder();
            requestMatch.render(new UriBuilder(sb));
            if (!sb.toString().equals(requestPath)) {
              StringBuilder redirect = new StringBuilder();
View Full Code Here

  }

  public Map<RouteDescriptor, Route> popupate(Route parent) {
    Map<RouteDescriptor, Route> ret = new LinkedHashMap<RouteDescriptor, Route>();
    for (RouteDescriptor routeDescriptor : routes) {
      Route route = routeDescriptor.popupate(parent);
      ret.put(routeDescriptor, route);
    }
    return ret;
  }
View Full Code Here

  public final DispatchBridge createDispatch(Phase phase, final MethodHandle target, final Map<String, ResponseParameter> parameters) {
    ControllerHandler handler = bridge.getApplication().resolveBean(ControllerService.class).getDescriptor().getMethodByHandle(target);

    //
    Route route = this.handler.getRoute(handler.getHandle());
    if (route == null) {
      if (bridge.getApplication().resolveBean(ControllerService.class).getResolver().isIndex(handler)) {
        route = this.handler.getRoot();
      }
    }

    //
    if (route != null) {
      Map<String, String> params;
      if (parameters.isEmpty()) {
        params = Collections.emptyMap();
      } else {
        params = new HashMap<String, String>(parameters.size());
        for (ResponseParameter parameter : parameters.values()) {
          params.put(parameter.getName(), parameter.get(0));
        }
      }

      //
      final RouteMatch match = route.matches(params);
      if (match != null) {
        return new DispatchBridge() {

          public MethodHandle getTarget() {
            return target;
View Full Code Here

TOP

Related Classes of juzu.impl.router.Route$RouteMatcher

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.