Source:
private void getCanvasResponse(HttpServletRequest request, HttpServletResponse response, PrintWriter out) throws IOException { String queryString = request.getQueryString(); String pathInfo = request.getPathInfo(); String url; if(queryString!=null) { url = canvasURL+pathInfo+"?"+queryString; }else { url = canvasURL+pathInfo; } String uniqname = null; TcSessionData tc = (TcSessionData) request.getSession().getAttribute(TC_SESSION_DATA); M_log.debug("TC Session Data: " + tc); if( tc != null){ uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID); } logApiCall(uniqname, url, request); String stringToReplaceUser = "user=self"; String stringToReplaceCourse = "course_id"; String originalUrl = url; url = unmaskUrl(url, tc, stringToReplaceUser, stringToReplaceCourse); HttpUriRequest clientRequest = null; if(request.getMethod().equals(GET)) { clientRequest = new HttpGet(url); }else if (request.getMethod().equals(POST)) { clientRequest = new HttpPost(url); }else if(request.getMethod().equals(PUT)) { clientRequest=new HttpPut(url); }else if(request.getMethod().equals(DELETE)) { clientRequest=new HttpDelete(url); } HttpResponse canvasResponse = processApiCall(clientRequest); BufferedReader rd = new BufferedReader(new InputStreamReader(canvasResponse.getEntity().getContent())); String linkValue = null; linkValue = extractNextLink(canvasResponse, linkValue); if(linkValue != null){ response.addHeader("Next", linkValue); } String line = ""; StringBuilder sb = new StringBuilder(); while ((line = rd.readLine()) != null) { sb.append(line); } if( originalUrl.substring(originalUrl.indexOf("/api")).matches(appExtPropertiesFile.getProperty(CANVAS_API_GET_COURSE_ENROLL)) && request.getSession().getAttribute(LAUNCH_TYPE).equals("lti")){ addEnrollmentsToSession(request, sb); } out.print(sb.toString()); out.flush(); }

Target:
private void getCanvasResponse(HttpServletRequest request, HttpServletResponse response, PrintWriter out) throws IOException { String queryString = request.getQueryString(); String pathInfo = request.getPathInfo(); String url; if(queryString!=null) { url = canvasURL+pathInfo+"?"+queryString; }else { url = canvasURL+pathInfo; } String uniqname = null; TcSessionData tc = (TcSessionData) request.getSession().getAttribute(TC_SESSION_DATA); M_log.debug("TC Session Data: " + tc); if( tc != null){ uniqname = (String) tc.getCustomValuesMap().get(CUSTOM_CANVAS_USER_LOGIN_ID); } logApiCall(uniqname, url, request); String stringToReplaceUser = "user=self"; String stringToReplaceCourse = "course_id"; String originalUrl = url; url = unmaskUrl(url, tc, stringToReplaceUser, stringToReplaceCourse); HttpUriRequest clientRequest = null; if(request.getMethod().equals(GET)) { clientRequest = new HttpGet(url); }else if (request.getMethod().equals(POST)) { clientRequest = new HttpPost(url); }else if(request.getMethod().equals(PUT)) { clientRequest=new HttpPut(url); }else if(request.getMethod().equals(DELETE)) { clientRequest=new HttpDelete(url); } HttpResponse canvasResponse = processApiCall(clientRequest); BufferedReader rd = new BufferedReader(new InputStreamReader(canvasResponse.getEntity().getContent())); String linkValue = null; linkValue = extractNextLink(canvasResponse); if(linkValue != null){ response.addHeader("Next", linkValue); } String line = ""; StringBuilder sb = new StringBuilder(); while ((line = rd.readLine()) != null) { sb.append(line); } if( originalUrl.substring(originalUrl.indexOf("/api")).matches(appExtPropertiesFile.getProperty(CANVAS_API_GET_COURSE_ENROLL)) && request.getSession().getAttribute(LAUNCH_TYPE).equals("lti")){ addEnrollmentsToSession(request, sb); } out.print(sb.toString()); out.flush(); }