Search in sources :

Example 1 with RouteImpl

use of org.webpieces.router.impl.RouteImpl in project webpieces by deanhiller.

the class AbstractRouteBuilder method addContentRoute.

public void addContentRoute(HttpMethod method, String path, String controllerMethod) {
    UrlPath p = new UrlPath(routerInfo, path);
    Route route = new RouteImpl(method, p, controllerMethod, isHttpsOnlyRoutes);
    addRoute(route, null);
}
Also used : RouteImpl(org.webpieces.router.impl.RouteImpl) UrlPath(org.webpieces.router.impl.UrlPath) Route(org.webpieces.router.impl.Route) MultiRoute(org.webpieces.router.api.routing.MultiRoute)

Example 2 with RouteImpl

use of org.webpieces.router.impl.RouteImpl in project webpieces by deanhiller.

the class DevRoutingService method fetchNotFoundRoute.

public NotFoundInfo fetchNotFoundRoute(NotFoundException e, RouterRequest req) {
    //Production app's notFound route TBD and used in iframe later
    RouteMeta origMeta = routeLoader.fetchNotFoundRoute(req.domain);
    if (req.queryParams.containsKey("webpiecesShowPage")) {
        //This is actually a callback from the below code's iframe!!!
        if (origMeta.getControllerInstance() == null) {
            finder.loadControllerIntoMetaObject(origMeta, false);
            finder.loadFiltersIntoMeta(origMeta, origMeta.getFilters(), false);
        }
        Service<MethodMeta, Action> svc = origMeta.getService222();
        return new NotFoundInfo(origMeta, svc, req);
    }
    log.error("(Development only log message) Route not found!!! Either you(developer) typed the wrong url OR you have a bad route.  Either way,\n" + " something needs a'fixin.  req=" + req, e);
    RouteImpl r = new RouteImpl("/org/webpieces/devrouter/impl/NotFoundController.notFound", RouteType.NOT_FOUND);
    RouteModuleInfo info = new RouteModuleInfo("", null);
    RouteMeta meta = new RouteMeta(r, origMeta.getInjector(), info, config.getUrlEncoding());
    if (meta.getControllerInstance() == null) {
        finder.loadControllerIntoMetaObject(meta, false);
        meta.setService(serviceCreator.create());
    }
    String reason = "Your route was not found in routes table";
    if (e != null)
        reason = e.getMessage();
    RouterRequest newRequest = new RouterRequest();
    newRequest.putMultipart("webpiecesError", "Exception message=" + reason);
    newRequest.putMultipart("url", req.relativePath);
    return new NotFoundInfo(meta, meta.getService222(), newRequest);
}
Also used : MethodMeta(org.webpieces.router.api.dto.MethodMeta) NotFoundInfo(org.webpieces.router.impl.NotFoundInfo) Action(org.webpieces.router.api.actions.Action) RouteImpl(org.webpieces.router.impl.RouteImpl) RouteMeta(org.webpieces.router.impl.RouteMeta) RouteModuleInfo(org.webpieces.router.impl.model.RouteModuleInfo) RouterRequest(org.webpieces.ctx.api.RouterRequest)

Example 3 with RouteImpl

use of org.webpieces.router.impl.RouteImpl in project webpieces by deanhiller.

the class AbstractDomainBuilder method setInternalErrorRoute.

@Override
public void setInternalErrorRoute(String controllerMethod) {
    Route route = new RouteImpl(controllerMethod, RouteType.INTERNAL_SERVER_ERROR);
    setInternalSvrErrorRoute(route);
}
Also used : RouteImpl(org.webpieces.router.impl.RouteImpl) Route(org.webpieces.router.impl.Route)

Example 4 with RouteImpl

use of org.webpieces.router.impl.RouteImpl in project webpieces by deanhiller.

the class AbstractRouteBuilder method addRoute.

@Override
public void addRoute(HttpMethod method, String path, String controllerMethod, RouteId routeId, boolean checkToken) {
    UrlPath p = new UrlPath(routerInfo, path);
    Route route = new RouteImpl(method, p, controllerMethod, routeId, isHttpsOnlyRoutes, checkToken);
    addRoute(route, routeId);
}
Also used : RouteImpl(org.webpieces.router.impl.RouteImpl) UrlPath(org.webpieces.router.impl.UrlPath) Route(org.webpieces.router.impl.Route) MultiRoute(org.webpieces.router.api.routing.MultiRoute)

Example 5 with RouteImpl

use of org.webpieces.router.impl.RouteImpl in project webpieces by deanhiller.

the class AbstractDomainBuilder method setPageNotFoundRoute.

@Override
public void setPageNotFoundRoute(String controllerMethod) {
    Route route = new RouteImpl(controllerMethod, RouteType.NOT_FOUND);
    setNotFoundRoute(route);
}
Also used : RouteImpl(org.webpieces.router.impl.RouteImpl) Route(org.webpieces.router.impl.Route)

Aggregations

RouteImpl (org.webpieces.router.impl.RouteImpl)5 Route (org.webpieces.router.impl.Route)4 MultiRoute (org.webpieces.router.api.routing.MultiRoute)2 UrlPath (org.webpieces.router.impl.UrlPath)2 RouterRequest (org.webpieces.ctx.api.RouterRequest)1 Action (org.webpieces.router.api.actions.Action)1 MethodMeta (org.webpieces.router.api.dto.MethodMeta)1 NotFoundInfo (org.webpieces.router.impl.NotFoundInfo)1 RouteMeta (org.webpieces.router.impl.RouteMeta)1 RouteModuleInfo (org.webpieces.router.impl.model.RouteModuleInfo)1