/** * 返回响应结果 * * @param response * @return */ public static RestResponse returnResponse( BaseRestRequest request, RestResponse response, RestServiceMapping serviceMapping, RestServiceConfiguration configuration) { String cmd = request.getRestRequest().getCmd(); // 调用后置拦截器 List<RestRequestAfterInterceptor> requestAfterInterceptors = configuration.getRequestAfterInterceptors(); for (RestRequestAfterInterceptor requestInterceptor : requestAfterInterceptors) { String requestInterceptorName = requestInterceptor.getName(); logger.debug( "REST_AFTER_INTERCEPTOR_START, cmd: {}, name: {}", cmd, requestInterceptorName + "|" + requestInterceptor.getClass().getName()); try { requestInterceptor.setConfiguration(configuration); requestInterceptor.execute(serviceMapping, request, response); } catch (Exception e) { response.setException(e); logger.warn("执行拦截器 {} 失败", requestInterceptorName, e); } logger.debug( "REST_AFTER_INTERCEPTOR_COMPLETE, cmd: {}, name: {}", cmd, requestInterceptorName + "|" + requestInterceptor.getClass().getName()); } return response; }
protected void logParams() { Enumeration en = req.getParameterNames(); while (en.hasMoreElements()) { String name = (String) en.nextElement(); String vals[]; String dispval; if (StringUtil.indexOfIgnoreCase(name, "passw") >= 0) { dispval = req.getParameter(name).length() == 0 ? "" : "********"; } else if (log.isDebug2() && (vals = req.getParameterValues(name)).length > 1) { dispval = StringUtil.separatedString(vals, ", "); } else { dispval = req.getParameter(name); } log.debug(name + " = " + dispval); } }