@Override public String toString() { return uri(); }
@Override public String toString() { return uri(); }
@Override public String toString() { return uri(); }
@Override public String toString() { return uri(); }
@Override public String toString() { return uri(); }
private String getQueue(FullHttpRequest request) { List<Route<String>> routesByMethod = routes.get(request.method().name()); QueryStringDecoder decoder = new QueryStringDecoder(request.uri()); if (routesByMethod != null) { Optional<Route<String>> route = routesByMethod.stream().filter(r -> r.matches(decoder.uri())).findFirst(); String path = URI.create(decoder.uri()).getPath(); if (route.isPresent()) { return route.get().apply(route.get(), path); } } return cfg.get("queue"); } }
@Override public boolean process(@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest fullHttpRequest, @NotNull ChannelHandlerContext context) { if (!urlDecoder.uri().startsWith(ServerNames.MAIN_NAME)) { return false; } TreeManager.INSTANCE.updateLastTime(); if (fullHttpRequest.method() == HttpMethod.POST) { return processPostMethod(urlDecoder, fullHttpRequest, context); } else { return processGetMethod(urlDecoder, context, fullHttpRequest); } }
@Override public String select(long id, Serializable context) { Context ctx = (Context) context; FullHttpRequest request = ctx.get(REQUEST); ctx.log ("Method: " + request.method().name()); ctx.log ("Routes: " + routes); List<Route<String>> routesByMethod = routes.get(request.method().name()); QueryStringDecoder decoder = new QueryStringDecoder(request.uri()); if (!decoder.parameters().isEmpty()) ctx.put(QUERYPARAMS, decoder.parameters()); if (routesByMethod != null) { Optional<Route<String>> route = routesByMethod.stream().filter(r -> r.matches(decoder.uri())).findFirst(); String path = URI.create(decoder.uri()).getPath(); if (route.isPresent()) { Map m = route.get().parameters(path); if (m != null) ctx.put(PATHPARAMS, m); return route.get().apply(route.get(), path); } } return null; }