Source:
<code>public PushHeaderItem push(List<PushItem> pushItems) { RequestCycle requestCycle = RequestCycle.get(); if (isHttp2(getContainerRequest(requestCycle.getRequest()))) for (PushItem pushItem : pushItems) { Object object = pushItem.getObject(); PageParameters parameters = pushItem.getPageParameters(); if (object == null) { throw new WicketRuntimeException( "Please provide an object to the items to be pushed, so that the url can be created for the given resource."); } CharSequence url = null; if (object instanceof ResourceReference) { url = requestCycle.urlFor((ResourceReference)object, parameters); } else if (Page.class.isAssignableFrom(object.getClass())) { url = requestCycle.urlFor((Class<? extends Page>)object, parameters); } else if (object instanceof IRequestHandler) { url = requestCycle.urlFor((IRequestHandler)object); } else if (pushItem.getUrl() != null) { url = pushItem.getUrl(); } else { Url encoded = new PageParametersEncoder().encodePageParameters(parameters); String queryString = encoded.getQueryString(); url = object.toString() + (queryString != null ? "?" + queryString : ""); } if (url.toString().equals(".")) { url = "/"; } else if (url.toString().startsWith(".")) { url = url.toString().substring(1); } <START> StringBuffer partialUrl = new StringBuffer(); <END> String contextPath = WebApplication.get().getServletContext().getContextPath(); partialUrl.append(contextPath); if (!contextPath.equals("/")) { partialUrl.append("/"); } String filterPath = WebApplication.get().getWicketFilter().getFilterPath(); if (filterPath.equals("/")) { filterPath = ""; } else if (filterPath.endsWith("/")) { filterPath = filterPath.replaceAll(".$", ""); } partialUrl.append(filterPath); partialUrl.append(url.toString()); pushItem.setUrl(partialUrl.toString()); this.pushItems.add(pushItem); } return this; }</code><technical_language>StringBuilder here</technical_language>

Target:
public PushHeaderItem push(List<PushItem> pushItems) { RequestCycle requestCycle = RequestCycle.get(); if (isHttp2(getContainerRequest(requestCycle.getRequest()))) for (PushItem pushItem : pushItems) { Object object = pushItem.getObject(); PageParameters parameters = pushItem.getPageParameters(); if (object == null) { throw new WicketRuntimeException( "Please provide an object to the items to be pushed, so that the url can be created for the given resource."); } CharSequence url = null; if (object instanceof ResourceReference) { url = requestCycle.urlFor((ResourceReference)object, parameters); } else if (Page.class.isAssignableFrom(object.getClass())) { url = requestCycle.urlFor((Class<? extends Page>)object, parameters); } else if (object instanceof IRequestHandler) { url = requestCycle.urlFor((IRequestHandler)object); } else if (pushItem.getUrl() != null) { url = pushItem.getUrl(); } else { Url encoded = new PageParametersEncoder().encodePageParameters(parameters); String queryString = encoded.getQueryString(); url = object.toString() + (queryString != null ? "?" + queryString : ""); } if (url.toString().equals(".")) { url = "/"; } else if (url.toString().startsWith(".")) { url = url.toString().substring(1); } StringBuilder partialUrl = new StringBuilder(); String contextPath = WebApplication.get().getServletContext().getContextPath(); partialUrl.append(contextPath); if (!"/".equals(contextPath)) { partialUrl.append('/'); } String filterPath = WebApplication.get().getWicketFilter().getFilterPath(); if ("/".equals(filterPath)) { filterPath = ""; } else if (filterPath.endsWith("/")) { filterPath = filterPath.substring(0, filterPath.length() - 1); } partialUrl.append(filterPath); partialUrl.append(url.toString()); pushItem.setUrl(partialUrl.toString()); this.pushItems.add(pushItem); } return this; }