url上参数解析笔记

 

很多时候会在url上拼接参数,通过request可以获取,下面是解析的笔记。

 public InvokeResult findByNo(HttpServletRequest request, String no) {
        try {
            String params = request.getQueryString();
            InvokeResult result;
            if (null != params && params.contains("?")) {
                StringTokenizer st = new StringTokenizer(params, "?");
                String applyNo = st.nextToken();
                result = InvokeResult.success(bnInfApplyService.getByInNo(applyNo.split("=")[1].toString()));
            } else {
                result = InvokeResult.success(bnInfApplyService.getByInNo(no));
            }
            return result;
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
            return InvokeResult.failure(e.getMessage());
        }
    }

 

posted @ 2017-07-12 09:25  Ysoo  Views(248)  Comments(0Edit  收藏  举报