[NETTY]: map urlpath to method

..Sekonda..

New Member
I am using netty and trying implement a simple HTTP server for some API. While I have incoming requests I can get the path of url = /foo/bar/other/. How can I map the path to the following?\[code\]class = foo method = bar param = other\[/code\]Can I use Regex? Or is there a better solution?yeah i know how to split url path and get query string params. I get all params from http headers, ip etc... it's not problem. Question is, how map these path to classes and methods. So that I could bring required class and method.simple implement some (just pseudo code):\[code\]public class Mapper { private String htttpMethod; private String controllerName; private String methodName;}ArrayList<Mapper> m = new ArrayList<Mapper>();m.add(new Mapper("GET","HomeController","index"));\[/code\]So /Home/index/1/ must rise HomeController.index(1);for each pattern that I want to find, I need a new regular expression? Check for all, will too many if / else blocks...Any solution about that?But thanks for not too lazy, for the sake of this question read the docks. And sry for my English
 
Top