Skip to content

Commit

Permalink
put METHOD in Context - reduce log verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Dec 15, 2021
1 parent 98bd1e5 commit 2da9812
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion modules/qrest/src/main/java/org/jpos/qrest/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ public enum Constants {
QUERYPARAMS,
PATHPARAMS,
RESPONSE,
RENDER_CONTEXT
RENDER_CONTEXT,
METHOD
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
import java.net.URI;
import java.util.*;

import static org.jpos.qrest.Constants.PATHPARAMS;
import static org.jpos.qrest.Constants.QUERYPARAMS;
import static org.jpos.qrest.Constants.REQUEST;
import static org.jpos.qrest.Constants.*;

public class Router implements GroupSelector, XmlConfigurable {
private Map<String,List<Route<String>>> routes = new HashMap<>();
Expand All @@ -47,9 +45,9 @@ public int prepare(long id, Serializable context) {
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());
String method = request.method().name();
ctx.put (METHOD, method);
List<Route<String>> routesByMethod = routes.get(method);
QueryStringDecoder decoder = new QueryStringDecoder(request.uri());
if (!decoder.parameters().isEmpty())
ctx.put(QUERYPARAMS, decoder.parameters());
Expand Down

0 comments on commit 2da9812

Please sign in to comment.