看下面几个测试:
String res = "user/wanxing";
String urlPattern = "user/{userId}";
assertTrue(Utils.determineUrlsPatternMatchResValue(res, urlPattern));
res = "user/edit/wanxing";
urlPattern = "user/{userId}/edit";//如果有个userId恰好叫edit怎么办?
assertFalse(Utils.determineUrlsPatternMatchResValue(res, urlPattern));
res = "user/like";//usrPattern="user/{userId}"李可,李克,此情况则有两个urlPattern都符合
String urlPattern1 = "user/like";//匹配到没有参数的方法上
String urlPattern2 = "user/{userId}";//匹配到有一个参数的方法上
assertTrue(Utils.determineUrlsPatternMatchResValue(res, urlPattern1));
assertTrue(Utils.determineUrlsPatternMatchResValue(res, urlPattern2));
我的问题:
如何避免业务数据与模板关键字的冲突问题?
String res = "user/wanxing";
String urlPattern = "user/{userId}";
assertTrue(Utils.determineUrlsPatternMatchResValue(res, urlPattern));
res = "user/edit/wanxing";
urlPattern = "user/{userId}/edit";//如果有个userId恰好叫edit怎么办?
assertFalse(Utils.determineUrlsPatternMatchResValue(res, urlPattern));
res = "user/like";//usrPattern="user/{userId}"李可,李克,此情况则有两个urlPattern都符合
String urlPattern1 = "user/like";//匹配到没有参数的方法上
String urlPattern2 = "user/{userId}";//匹配到有一个参数的方法上
assertTrue(Utils.determineUrlsPatternMatchResValue(res, urlPattern1));
assertTrue(Utils.determineUrlsPatternMatchResValue(res, urlPattern2));
我的问题:
如何避免业务数据与模板关键字的冲突问题?