要做个权限的过滤器,简单来说就是先把用户拥有的URL放入Session,然后通过filter过滤,在filter里取得当前页面的url跟session里的比对.
一般URL格式:****.do?method=*****
现在用:
HttpServletRequest httpRequest=(HttpServletRequest)request;
String path=httpRequest.getServletPath();取得的path只是:****.do 没有后面的method请问各位大虾,如何才能取到完整的路径::****.do?method=*****这种格式
一般URL格式:****.do?method=*****
现在用:
HttpServletRequest httpRequest=(HttpServletRequest)request;
String path=httpRequest.getServletPath();取得的path只是:****.do 没有后面的method请问各位大虾,如何才能取到完整的路径::****.do?method=*****这种格式
+ httpRequest.getQueryString();
HttpServletRequest httpRequest=(HttpServletRequest)request;
String path=httpRequest.getServletPath();
String url=path+"?"+httpRequest.getQueryString();
String url=String.format("%s?%s", httpRequest.getRequestURI(),httpRequest.getQueryString());
先用httpRequest.getServletPath();取得***.do
然后用request.getQueryString()取得method
拼起来