router.addContext(action.toString(), path); } else { H.Method m = H.Method.valueOfIgnoreCase(method); router.addMapping(m, path, action.toString(), RouteSource.ROUTE_TABLE);
router.addContext(action.toString(), path); } else { H.Method m = H.Method.valueOfIgnoreCase(method); router.addMapping(m, path, action.toString(), RouteSource.ROUTE_TABLE);
@Override public H.Method method() { if (null == method) { method = _method(); if (method == H.Method.POST) { // check the method overload String s = header(H.Header.Names.X_HTTP_METHOD_OVERRIDE); if (S.blank(s)) { s = paramVal("_method"); // Spring convention } if (S.notBlank(s)) { method = H.Method.valueOfIgnoreCase(s); } } } return method; }
@Command(name = "act.route.add", help = "add a route entry") public void add( @Required("specify http method") String method, @Required("specify URL path") String path, @Required("specify handler") String handler, @Optional("specify the port name") String name ) { final Router router = S.blank(name) ? app.router() : app.router(name); try { router.addMapping(H.Method.valueOfIgnoreCase(method), path, handler, RouteSource.ADMIN_ADD); context.println("route entry has been added"); } catch (DuplicateRouteMappingException e) { context.println("Route entry already exist"); } }
@Override public H.Method method() { if (null == method) { method = _method(); if (method == H.Method.POST) { // check the method overload String s = header(H.Header.Names.X_HTTP_METHOD_OVERRIDE); if (S.blank(s)) { s = paramVal("_method"); // Spring convention } if (S.notBlank(s)) { method = H.Method.valueOfIgnoreCase(s); } } } return method; }
private H.Method _method() { return H.Method.valueOfIgnoreCase(methodName()); }
private H.Method _method() { return H.Method.valueOfIgnoreCase(methodName()); }
@Command(name = "act.route.add", help = "add a route entry") public void add( @Required("specify http method") String method, @Required("specify URL path") String path, @Required("specify handler") String handler, @Optional("specify the port name") String name ) { final Router router = S.blank(name) ? app.router() : app.router(name); try { router.addMapping(H.Method.valueOfIgnoreCase(method), path, handler, RouteSource.ADMIN_ADD); context.println("route entry has been added"); } catch (DuplicateRouteMappingException e) { context.println("Route entry already exist"); } }
@Command(name = "act.route.overwrite", help = "overwrite a route entry") public void overwrite( @Required("specify http method") String method, @Required("specify path") String path, @Required("specify handler") String handler, @Optional("specify the port name") String name ) { final Router router = S.blank(name) ? app.router() : app.router(name); router.addMapping(H.Method.valueOfIgnoreCase(method), path, handler, RouteSource.ADMIN_OVERWRITE); context.println("route entry has been added/overwritten"); }
@Command(name = "act.route.overwrite", help = "overwrite a route entry") public void overwrite( @Required("specify http method") String method, @Required("specify path") String path, @Required("specify handler") String handler, @Optional("specify the port name") String name ) { final Router router = S.blank(name) ? app.router() : app.router(name); router.addMapping(H.Method.valueOfIgnoreCase(method), path, handler, RouteSource.ADMIN_OVERWRITE); context.println("route entry has been added/overwritten"); }